forked from Derecho-Project/cascade
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·84 lines (77 loc) · 1.81 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
80
81
82
83
84
#!/bin/bash
# case insensitive for string comparison
shopt -s nocasematch
colorful_print() {
color_prefix="0;30"
case $1 in
"red")
color_prefix="0;31"
;;
"green")
color_prefix="0;32"
;;
"orange")
color_prefix="0;33"
;;
"blue")
color_prefix="0;34"
;;
"purple")
color_prefix="0;35"
;;
"cyan")
color_prefix="0;36"
;;
"lightgray")
color_prefix="0;37"
;;
"darkgray")
color_prefix="1;30"
;;
"lightred")
color_prefix="1;31"
;;
"lightgreen")
color_prefix="1;32"
;;
"yellow")
color_prefix="1;33"
;;
"lightblue")
color_prefix="1;34"
;;
"lightpurple")
color_prefix="1;35"
;;
"lightcyan")
color_prefix="1;36"
;;
"white")
color_prefix="1;37"
;;
esac;
echo -e "\e[${color_prefix}m $2 $3 $4 $5 $6 $7 $8 $9 \e[0m"
}
if [[ $# -lt 1 ]]; then
colorful_print orange "USAGE: $0 <Release|Debug|RelWithDebInfo|Benchmark|Clear> [USE_VERBS_API]"
exit -1
fi
if [[ $1 == "Clear" ]]; then
rm -rf build-*
exit 0
fi
build_type=$1
# install_prefix="/usr/local"
install_prefix="/"
cmake_defs="-DCMAKE_BUILD_TYPE=${build_type} -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_INSTALL_PREFIX=${install_prefix}"
build_path="build-${build_type}"
if [[ $2 == "USE_VERBS_API" ]]; then
cmake_defs="${cmake_defs} -DUSE_VERBS_API=1"
fi
# begin building...
rm -rf ${build_path} 2>/dev/null
mkdir ${build_path}
cd ${build_path}
cmake ${cmake_defs} ..
make -j `nproc` 2>err.log
cd ..