-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-zmf.sh
executable file
·77 lines (63 loc) · 1.4 KB
/
build-zmf.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
#!/bin/bash
# Script for building the ZMF library
echo "### Start Build ZMF ###"
# Parse Parameters
SkiptTests=true
BuildTarget="default"
while getopts hb:tc flag; do
case $flag in
h)
echo "--- HELP ---:";
echo "<-t> to execute unittests during build";
echo "<-b pi> to build for Raspberry Pi ARM";
exit 0;
;;
b)
BuildTarget=$OPTARG;
;;
t)
SkiptTests=$false;
;;
c)
echo "Clear parameter redundant"
;;
?)
echo "!!Unknown parameter: $flag"
;;
esac
done
# Construct BuildArgs
BuildArgs=""
if [ "$SkiptTests" = true ] ; then
echo "Build skipping Tests"
BuildArgs=$BuildArgs" -DNoTests=ON"
else
echo "Build with Tests"
BuildArgs=$BuildArgs" -DNoTests=OFF"
fi
if [ "$BuildTarget" = "pi" ] ; then
echo "Building for RasPi ARM target"
BuildArgs=$BuildArgs" -DCMAKE_TOOLCHAIN_FILE=$HOME/raspberrypi/pi.cmake"
elif [ "$BuildTarget" = "default" ] ; then
echo "Build with default target"
else
echo "!!Unknown build target"
exit 1
fi
# Clear ZMF
find . -name CMakeCache.txt -delete
find . -name Makefile -delete
find . -name cmake_install.cmake -delete
find . -name CMakeFiles -type d -exec rm -rf {} +
echo "# Cleard ZMF"
# Build ZMF
cmake$BuildArgs .
if cmake --build .; then
echo "# Cmake ZMF success"
else
result=$?
echo "!! Failed to Cmake ZMF: "${result}
exit ${result}
fi
cd ..
echo "### Finished Build ZMF ###"