forked from mmertama/Gempyre
-
Notifications
You must be signed in to change notification settings - Fork 0
/
raspberry_install.sh
executable file
·64 lines (46 loc) · 1.36 KB
/
raspberry_install.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
set -e
CMD_STR='$ ./raspberry_install.sh [-all] [-dir <DIR>] [-debug] [-release]'
ONOFF="OFF"
PREFIX=""
TARGET=""
while [ -n "$1" ]; do # while loop starts
if [ "$1" == '-all' ]; then
ONOFF="ON"
fi
if [ "$1" == '-dir' ]; then
PREFIX="$2"
shift
fi
if [ "$1" == '-debug' ]; then
TARGET="DEBUG"
fi
if [ "$1" == '-release' ]; then
TARGET="RELEASE"
fi
shift
done
if [[ $PREFIX -ne "" && ! -d $PREFIX ]]; then
echo "$PREFIX not found"
return
fi
if [[ $PREFIX -ne "" && -d $PREFIX ]]; then
PREFIX=-DCMAKE_INSTALL_PREFIX=$PREFIX
return
fi
mkdir -p build
pushd build
if [[ ! "$TARGET" == "RELEASE" ]]; then
cmake .. -DRASPBERRY=1 -DCMAKE_BUILD_TYPE=Debug -DHAS_AFFILIATES=OFF -DHAS_TEST=$ONOFF -DHAS_EXAMPLES=$ONOFF $PREFIX
cmake --build . --config Debug
# if cmake is installed using snap, you may need to crete its symbolic link to /usr/local/bin
# otherwise sudo may not find it
sudo cmake --install . --config Debug
fi
if [[ ! "$TARGET" == "DEBUG" ]]; then
cmake .. -DRASPBERRY=1 -DCMAKE_BUILD_TYPE=Release -DHAS_AFFILIATES=OFF -DHAS_TEST=$ONOFF -DHAS_EXAMPLES=$ONOFF $PREFIX
cmake --build . --config Release
sudo cmake --install . --config Release
fi
popd
echo "Run install test"
export EXTRA_FLAGS="-DRASPBERRY=1";test/install_test/install_test.sh build