-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.sh
executable file
·53 lines (45 loc) · 1.08 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
#!/bin/bash
help()
{
echo "Basic script to build mercator"
echo
echo "Syntax: ./build.sh [-b|-s]"
echo "options:"
echo "h Print this help."
echo "b [BUILD_TYPE] Build type: {Release, Debug}."
echo "s [SYSTEM] OS type: {win, linux, mac}."
echo
}
while getopts ":hb:s:" option; do
case $option in
h)
help
exit;;
b)
build_type=$OPTARG;;
s)
os_type=$OPTARG;;
\?)
echo "Error: Invalid option"
exit;;
esac
done
if [[ -z $build_type ]]; then
build_type="Release"
fi
if [[ -z $os_type ]]; then
os_type="linux"
fi
mkdir -p build && cd build/ # go to build folder
#export OMP_NUM_THREADS=$(nproc)
# Windows 10
if [[ $os_type == "win" ]]; then
cmake .. -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=$build_type
cmake --build . --config $build_type -j 8
fi
# Linux or Mac
if [[ "$os_type" == "linux" || "$os_type" == "mac" ]]; then
cmake .. -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=$build_type
cmake --build . -j 8
fi
mv mercator ../ # copy mercator to project directory