-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·57 lines (49 loc) · 1.24 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
56
57
#!/bin/bash
BUILD_TYPE="Release"
BUILD_DOCS="OFF"
TOOLCHAIN_FILE=""
source config.sh
Help()
{
echo "Build GPIO Sync"
echo
echo "usage: build.sh [OPTION]..."
echo "options:"
echo -e "\tg enable debug info"
echo -e "\td build project docs"
echo -e "\tc cross compile for the beaglebone black"
echo -e "\th print this help message"
}
Main()
{
# Create the build directory if it does not already exist.
mkdir -pv $GSYNC_BUILD_DIR
pushd $GSYNC_BUILD_DIR
cmake ../ \
-DBUILD_DOCS=$BUILD_DOCS \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DCMAKE_TOOLCHAIN_FILE=$TOOLCHAIN_FILE \
-DCMAKE_BUILD_TYPE=$BUILD_TYPE && \
make -j$(nproc) all && \
make install
# Exit if any of the above commands fails.
if [ $? -ne 0 ];
then
exit 1
fi
popd
}
while getopts ":hgcd" flag
do
case "$flag" in
g) BUILD_TYPE="Debug";;
d) BUILD_DOCS="ON";;
c) TOOLCHAIN_FILE=${GSYNC_PROJECT_PATH}/cmake/arm-linux-gnueabihf-gcc.cmake;;
h) Help
exit;;
\?) echo "error: invalid option '$OPTARG'"
Help
exit;;
esac
done
Main