forked from mmertama/Gempyre
-
Notifications
You must be signed in to change notification settings - Fork 0
/
osx_install.sh
executable file
·65 lines (49 loc) · 1.22 KB
/
osx_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
65
set -e
ONOFF="OFF"
TARGET=""
ALL_TARGETS=false
function build() {
build_folder=$(echo "$1" | tr '[:upper:]' '[:lower:]')
mkdir -p $build_folder
pushd $build_folder
cmake ../.. -G Ninja -DCMAKE_BUILD_TYPE=$1 -DHAS_AFFILIATES=$ONOFF -DHAS_TEST=$ONOFF -DHAS_EXAMPLES=$ONOFF
cmake --build . --config $1
sudo cmake --install . --config $1
popd
}
while [ -n "$1" ]; do # while loop starts
if [ "$1" == '-all' ]; then
ONOFF="ON"
fi
if [ "$1" == '-alltargets' ]; then
ALL_TARGETS=true
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
mkdir -p build
pushd build
if [[ ! "$TARGET" == "RELEASE" && "$ALL_TARGETS" == "false" ]]; then
build "Debug"
fi
if [[ ! "$TARGET" == "DEBUG" && "$ALL_TARGETS" == "false" ]]; then
build "Release"
fi
if [[ "$ALL_TARGETS" == "true" ]]; then
build_types=("Debug" "Release" "RelWithDebInfo" "MinSizeRel")
for build_type in "${build_types[@]}"; do
build $build_type
done
fi
popd
echo "Run install test"
bash test/install_test/install_test.sh build