-
Notifications
You must be signed in to change notification settings - Fork 0
/
builder.sh
executable file
·60 lines (50 loc) · 1.48 KB
/
builder.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
#!/bin/bash
BUILD_DIR_X86=build_x86
BUILD_DIR_ARM=build_arm
case $1 in
--arm)
cd /home/pi
if [ ! -d "$BUILD_DIR_ARM" ]; then
cmake -B $BUILD_DIR_ARM -DCMAKE_BUILD_TYPE=Release -DBUILD_PLATFORM_ARM=ON -DCMAKE_TOOLCHAIN_FILE=/opt/cross/Toolchain-RaspberryPi.cmake
fi
cd /home/pi/$BUILD_DIR_ARM
make
result=$?
;;
--x86)
if [ ! -d "$BUILD_DIR_X86" ]; then
cmake -B $BUILD_DIR_X86 -DCMAKE_BUILD_TYPE=Release
fi
cd ./$BUILD_DIR_X86
make
result=$?
;;
--clean-arm)
if rm -rf /home/pi/$BUILD_DIR_ARM/; then
echo "Folder /home/pi/$BUILD_DIR_ARM/ was removed successfully."
else
echo "[WARN] Folder /home/pi/$BUILD_DIR_ARM/ wasn't removed."
result=-1
fi
result=0
;;
--clean-x86)
if rm -rf ./$BUILD_DIR_X86/; then
echo "Folder ./$BUILD_DIR_X86/ was removed successfully."
else
echo "[WARN] Folder ./$BUILD_DIR_X86/ wasn't removed."
result=-1
fi
result=0
;;
*)
echo "--x86 - compile release for x86 platform."
echo "--arm - cross-compile release for ARM platform."
echo "--clean-arm - cleans all the ARM build files in the project"
echo "--clean-x86 - cleans all the x86 build files in the project"
;;
esac
if [[ $result != 0 ]]
then
exit 1 # terminate if an error occurs
fi