-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.sh
executable file
·55 lines (50 loc) · 1.53 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
#!/bin/bash
# gets the compilation function
source tools/unix_compile.func
build_type=RelWithDebInfo
while test $# -gt 0; do
case "$1" in
-h|--help)
echo "build.sh - Builds the source with cmake and make."
echo " "
echo "./build.sh [-h|--help] [-r|--release] [-d|--debug] [-c|--clean] TARGET"
echo " "
echo "options:"
echo " -h, --help show brief help"
echo " -r, --release use the Release build type (mutually exclusive with -d,--debug,-m, and --minsizerel)"
echo " -d, --debug use the Debug build type (mutually exclusive with -r,--release,-m, and --minsizerel)"
echo " -m, --minsizerel use the MinSizeRel build type (mutually exclusive with -r,--release,-d, and --debug)"
echo " -c, --clean cleans the build directory before compiling"
echo " TARGET specify a compile target"
echo " "
echo "if neither -r,--release,-d,--debug,-m, or --minsizerel are set, then the default build type used is Relwithdebinfo."
exit 0
;;
-r|--release)
build_type=Release
shift
;;
-d|--debug)
build_type=Debug
shift
;;
-m|--minsizerel)
build_type=MinSizeRel
shift
;;
-c|--clean)
clean=ON
shift
;;
*)
target=$1
shift
;;
esac
done
if [ -n "$clean" ]; then
compile ${build_type} clean
echo "Cleaned build directory."
echo " "
fi
compile ${build_type} "${target}"