-
Notifications
You must be signed in to change notification settings - Fork 34
/
build.sh
executable file
·63 lines (56 loc) · 1.5 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
54
55
56
57
58
59
60
61
62
63
#!/bin/bash
# ------------------------------------------------------------------------------
# Requirements to build...
# ------------------------------------------------------------------------------
which cmake g++ make || {
echo "Failed to find required build packages. Please install with: sudo apt-get install cmake make g++"
exit 1
}
# ------------------------------------------------------------------------------
# Build
# ------------------------------------------------------------------------------
main() {
build_asan=0
while getopts ":a" opt; do
case "${opt}" in
a)
build_asan=1
;;
\?)
echo "Invalid option: -$OPTARG" >&2
exit $?
;;
esac
done
if [ "$(uname)" == "Darwin" ]; then
NPROC=$(sysctl -n hw.ncpu)
else
NPROC=$(nproc)
fi
mkdir -p build
pushd build
if [[ "${build_asan}" -eq 1 ]]; then
cmake ../ \
-DBUILD_SYMBOLS=ON \
-DDEBUG_MODE=ON \
-DBUILD_TCMALLOC=OFF \
-DBUILD_ASAN=ON\
-DBUILD_TESTS=ON \
-DBUILD_LINUX=ON \
-DCMAKE_INSTALL_PREFIX=/usr
else
cmake ../ \
-DBUILD_SYMBOLS=ON \
-DBUILD_TCMALLOC=ON \
-DBUILD_TESTS=ON \
-DBUILD_LINUX=ON \
-DCMAKE_INSTALL_PREFIX=/usr
fi
make -j${NPROC} && \
make test && \
umask 0022 && chmod -R a+rX . && \
make package && \
popd && \
exit $?
}
main "${@}"