forked from QW-Group/ktx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_cmake.sh
executable file
·42 lines (35 loc) · 1.21 KB
/
build_cmake.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
#!/bin/bash
# Useful if you willing to stop on first error, also print what is executed.
#set -ex
BUILDIR="${BUILDIR:-build}" # Default build dir.
# Default bot support, CMake already have it as ON,
# provided here just for possibility to turn it OFF without modification of CMake or this script file.
BOT_SUPPORT="${BOT_SUPPORT:-ON}"
# If V variable is not empty then provide -v argument to Ninja (verbose output).
V="${V:-}"
[ ! -z ${V} ] && V="-v"
rm -rf ${BUILDIR}
mkdir -p ${BUILDIR}
# Define target platforms, feel free to comment out if you does not require some of it.
BUILD_LIST=(
linux-amd64
linux-armhf
linux-i686
windows-x64
windows-x86
qvm
)
# Build platforms one by one.
for name in "${BUILD_LIST[@]}"; do
mkdir -p ${BUILDIR}/$name
case "$name" in
"qvm" ) # Build QVM library.
cmake -B ${BUILDIR}/$name -S . -DBOT_SUPPORT=${BOT_SUPPORT} -G Ninja
cmake --build ${BUILDIR}/$name --config Release --target qvm ${V}
;;
* ) # Build native library.
cmake -B ${BUILDIR}/$name -S . -DBOT_SUPPORT=${BOT_SUPPORT} -G Ninja -DCMAKE_TOOLCHAIN_FILE=tools/cross-cmake/$name.cmake
cmake --build ${BUILDIR}/$name --config Release ${V}
;;
esac
done