-
Notifications
You must be signed in to change notification settings - Fork 1
/
build-clang15.sh
executable file
·60 lines (53 loc) · 1.71 KB
/
build-clang15.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
51
52
53
54
55
56
57
58
59
60
#!/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 CMAKE_C_COMPILER=/usr/lib/llvm/15/bin/clang \
-D CMAKE_CXX_COMPILER=/usr/lib/llvm/15/bin/clang++ \
-D CMAKE_AR=/usr/lib/llvm/15/bin/llvm-ar \
-D CMAKE_RANLIB=/usr/lib/llvm/15/bin/llvm-ranlib \
-D CMAKE_LINKER=/usr/lib/llvm/15/bin/llvm-link \
-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 CMAKE_C_COMPILER=/usr/lib/llvm/15/bin/clang \
-D CMAKE_CXX_COMPILER=/usr/lib/llvm/15/bin/clang++ \
-D CMAKE_AR=/usr/lib/llvm/15/bin/llvm-ar \
-D CMAKE_RANLIB=/usr/lib/llvm/15/bin/llvm-ranlib \
-D CMAKE_LINKER=/usr/lib/llvm/15/bin/llvm-link \
-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