-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathbuild_linux.sh
More file actions
executable file
·55 lines (51 loc) · 955 Bytes
/
build_linux.sh
File metadata and controls
executable file
·55 lines (51 loc) · 955 Bytes
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
set -x
CLEAN_BUILD=NO
BUILD_TEST=false
EXAMPLE_NAME=""
# parse command line args
# https://stackoverflow.com/a/14203146/12003165
for i in "$@"; do
case $i in
--clean)
CLEAN_BUILD=YES
;;
--test)
BUILD_TEST=true
;;
-e=*|--example=*)
EXAMPLE_NAME="${i#*=}"
;;
-*|--*)
echo "Unknown option $i"
exit 1
;;
*)
;;
esac
done
if [ "$CLEAN_BUILD" = "YES" ]; then
rm -fr ./build
echo "Removed build directory"
exit 0
fi
mkdir build
cd build
cmake .. -DBUILD_TEST=${BUILD_TEST} -DEXAMPLE_NAME=${EXAMPLE_NAME} -DPLATFORM_NAME="linux"
make -j7
if [ $? -eq 0 ]; then
# Run tests
if [ "${BUILD_TEST}" = "true" ]; then
echo "Running tests"
./tests
else # Run examples
if [ "${EXAMPLE_NAME}" = "" ]; then
EXAMPLE_NAME="body_minimal"
fi
echo "./${EXAMPLE_NAME}"
./${EXAMPLE_NAME}
fi
else
echo "Building failed!"
exit 1
fi