-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.sh
executable file
·50 lines (43 loc) · 1.2 KB
/
build.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
49
50
#!/bin/sh
processorCount=`grep -c ^processor /proc/cpuinfo`
for buildMode in Debug Release; do
# Delete existing CMake intermediate directory
#
# CMake doesn't support anything but a full rebuild unless you manually
# enter each and every source file into your CMakeLists.txt. See the
# documentation on file(GLOB_RECURSE ...) for that turd.
#
if [ $# -ge 1 ] && [ $1 == "full" ]; then
if [ -d obj ]; then
if [ -d obj/cmake-$buildMode ]; then
rm -rf obj/cmake-$buildMode
fi
fi
fi
# Let CMake build a Makefile or a Ninja build script
if [ $# -ge 1 ] && [ $1 == "ninja" ]; then
cmake \
-B obj/cmake-$buildMode \
-D CMAKE_BUILD_TYPE=$buildMode \
-D BUILD_UNIT_TESTS=ON \
-D BUILD_BENCHMARK=ON \
-D BENCHMARK_THIRD_PARTY_LIBRARIES=OFF \
-GNinja
else
cmake \
-B obj/cmake-$buildMode \
-D CMAKE_BUILD_TYPE=$buildMode \
-D BUILD_UNIT_TESTS=ON \
-D BUILD_BENCHMARK=ON \
-D BENCHMARK_THIRD_PARTY_LIBRARIES=OFF
fi
# Compile the binary
cmake \
--build obj/cmake-$buildMode \
--config $buildMode \
--parallel $processorCount
# Put build artifacts in ./bin/linux-gcc9.2-amd64-release/ or similar
cmake \
--install obj/cmake-$buildMode \
--config $buildMode
done