-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript_compile.sh
More file actions
49 lines (44 loc) · 1.46 KB
/
script_compile.sh
File metadata and controls
49 lines (44 loc) · 1.46 KB
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
#!/bin/bash
for i in "$@"
do
case $i in
-j2|--set-2-threads) WITH_2_THREADS=TRUE ;;
-j4|--set-4-threads) WITH_4_THREADS=TRUE ;;
-j8|--set-8-threads) WITH_8_THREADS=TRUE ;;
-jx|--set-max-threads) WITH_MAX_THREADS=TRUE ;;
-ct|--with-component-tests) WITH_COMPONENT_TESTS=TRUE ;;
-ut|--with-unit-tests) WITH_UNIT_TESTS=TRUE ;;
-h|--help|-?) echo "Use keys:
-j2|--set-2-threads - Compile binaries with 2 threads
-j4|--set-4-threads - Compile binaries with 4 threads
-j8|--set-8-threads - Compile binaries with 8 threads
-jx|--set-max-threads - Compile binaries with max threads
-ct|--with-component-tests - Compile binaries with component tests
-ut|--with-unit-tests - Compile binaries with unit tests
" && exit ;;
esac
done
rm -rf build
mkdir build && cd build
CMAKE_PARAMS=""
nproc=4
if [[ -n ${WITH_2_THREADS} ]]; then
nproc=2
elif [[ -n ${WITH_4_THREADS} ]]; then
nproc=4
elif [[ -n ${WITH_8_THREADS} ]]; then
nproc=8
elif [[ -n ${WITH_MAX_THREADS} ]]; then
nproc=$(grep -c ^processor /proc/cpuinfo)
fi
if [[ -n ${WITH_COMPONENT_TESTS} ]]; then
CMAKE_PARAMS+=" -DTEST_COMPONENT=TRUE"
fi
if [[ -n ${WITH_UNIT_TESTS} ]]; then
CMAKE_PARAMS+=" -DTEST_UNIT=TRUE"
fi
echo "CMAKE_PARAMS: ${CMAKE_PARAMS}"
echo "nproc=${nproc}"
#echo "cmake=${BASH_ALIASES[cmake]}"
cmake ${CMAKE_PARAMS} ..
make -j${nproc}