forked from Desbordante/desbordante-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·79 lines (69 loc) · 1.95 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/bin/bash
function print_help() {
cat << EOF
Usage: ./build.sh [-h|--help] [-p|--pybind] [-t|--tests] [-u|--unpack] [-jN|--jobs=N]
-h, --help Display help
-p, --pybind Compile python bindings
-n, --no-tests Don't build tests
-u, --no-unpack Don't unpack datasets
-j[N], --jobs[=N] Allow N jobs at once (default [=1])
-d, --debug Set debug build type
EOF
}
for i in "$@"
do
case $i in
-p|--pybind) # Enable python bindings compile
PYBIND=true
;;
-n|--no-tests) # Disable tests build
NO_TESTS=true
;;
-u|--no-unpack) # Don't unpack datasets
NO_UNPACK=true
;;
-j*|--jobs=*) # Allow N jobs at once
JOBS_OPTION=$i
;;
-d|--debug) # Set debug build type
DEBUG_MODE=true
;;
-h|--help|*) # Display help.
print_help
exit 0
;;
esac
done
mkdir -p lib
cd lib
if [[ ! -d "easyloggingpp" ]] ; then
git clone https://github.com/amrayn/easyloggingpp/ --branch v9.97.0 --depth 1
fi
if [[ ! -d "better-enums" ]] ; then
git clone https://github.com/aantron/better-enums.git --branch 0.11.3 --depth 1
fi
if [[ $NO_TESTS == true ]]; then
PREFIX="$PREFIX -D COMPILE_TESTS=OFF"
else
if [[ ! -d "googletest" ]] ; then
git clone https://github.com/google/googletest/ --branch v1.13.0 --depth 1
fi
fi
if [[ $NO_UNPACK == true ]]; then
PREFIX="$PREFIX -D UNPACK_DATASETS=OFF"
fi
if [[ $PYBIND == true ]]; then
if [[ ! -d "pybind11" ]] ; then
git clone https://github.com/pybind/pybind11.git --branch v2.10 --depth 1
fi
PREFIX="$PREFIX -D COMPILE_PYBIND=ON"
fi
if [[ $DEBUG_MODE != true ]]; then
PREFIX="$PREFIX -D CMAKE_BUILD_TYPE=Release"
fi
cd ..
mkdir -p build
cd build
rm CMakeCache.txt
cmake $PREFIX ..
make $JOBS_OPTION