-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·54 lines (39 loc) · 1.1 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
51
52
53
#!/bin/bash
# ----------------------------------------------------
build_dir=${PWD}/build
install_dir=${PWD}/installed
# ----------------------------------------------------
if [ ! -d ${build_dir} ] ; then
mkdir ${build_dir}
fi
# ----------------------------------------------------
# Make sure CMake uses clang as the compiler.
export CC=/usr/bin/clang
export CXX=/usr/bin/clang++
export CXXFLAGS="--stdlib=libc++"
# ----------------------------------------------------
# --trace \
cd ${build_dir}
cmake -DCMAKE_INSTALL_PREFIX=${install_dir} \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER=${CC} \
-DCMAKE_CXX_COMPILER=${CXX} \
-DCMAKE_CXX_FLAGS=${CXXFLAGS} \
-DCMAKE_VERBOSE_MAKEFILE=On \
-G "Ninja" \
..
if [ $? -ne 0 ] ; then
echo "Failed to configure"
exit
fi
# ----------------------------------------------------
cd ${build_dir}
cmake --build . \
--target install \
--config Release \
--parallel 24
if [ $? -ne 0 ] ; then
echo "Failed to build"
exit
fi
# ----------------------------------------------------