-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.sh
executable file
·53 lines (48 loc) · 1.2 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
#!/bin/bash
help()
{
echo "Build Botlab code."
echo
echo "Usage:"
echo " -h Print help and exit."
echo " -l Build for the laptop."
echo " -c Clean up by deleting compiled files."
echo " -b Basic build without creating a system compilation."
}
PACKAGE_SYSTEM=true
MBOT=true
CMAKE_FLAGS=""
ROOT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
while getopts "hlcb" option; do
case $option in
h) # Help
help
exit;;
l) # Build for the laptop.
MBOT=false;;
c) # Cleanup
rm -rf system_compilation
rm -rf build
exit;;
b) # Package
PACKAGE_SYSTEM=false ;;
\?) # Invalid.
echo "Invalid option provided."
help
exit;;
esac
done
if $MBOT ; then
CMAKE_FLAGS=-DBUILD_ON_BOT=ON
echo "Building for the MBot."
else
CMAKE_FLAGS=-DBUILD_ON_BOT=OFF
echo "Building for laptop."
fi
[ ! -d "build" ] && mkdir build
cd build
cmake $CMAKE_FLAGS .. && make
cd $ROOT_DIR
if $PACKAGE_SYSTEM ; then
bash $ROOT_DIR/scripts/package_built_system.sh
fi