-
Notifications
You must be signed in to change notification settings - Fork 19
/
cmake-testbuild.sh
executable file
·48 lines (39 loc) · 1.39 KB
/
cmake-testbuild.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/sh
# This script
#
# - clones and installs glfw3, dependency of the examples
# - installs imgui
# - builds the examples in separate build tree so the imgui config
# module is also tested
#
# Options:
#
# - you can set the variable `generator_option` to a
# non-default generator, example:
#
# generator_option=-GXcode ./cmake-testbuild.sh
root=$(cd $(dirname $0); pwd)
set -ex
make_install() {
configs=$1
srcdir=$2
builddir=$3
extraflags=$4
for c in $configs; do
cmake -DCMAKE_INSTALL_PREFIX=$root/out -DCMAKE_PREFIX_PATH=$root/out \
-H$srcdir -B$root/out/build/$builddir -DCMAKE_BUILD_TYPE=$c $extraflags \
$generator_option
cmake --build $root/out/build/$builddir --target install --config $c
done
}
if test ! -f $root/out/glfw_src/CMakeLists.txt; then
git clone --depth 1 https://github.com/shaxbee/glfw.git $root/out/glfw_src
fi
make_install "Debug Release" $root/out/glfw_src glfw "-DGLFW_BUILD_DOCS=0 -DGLFW_BUILD_EXAMPLES=0 -DGLFW_BUILD_TESTS=0 -DCMAKE_DEBUG_POSTFIX=d"
make_install Release $root imgui
make_install "Debug Release" $root/examples/opengl_example opengl_example
make_install "Debug Release" $root/examples/opengl3_example opengl3_example
make_install "Debug Release" $root/examples/imconfig_example imconfig_example
set +x
echo "---- You can run these examples from $root/out/bin: ----"
ls -l $root/out/bin