generated from tlemane/cpp-app-template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall.sh
executable file
·86 lines (76 loc) · 1.86 KB
/
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/bin/bash
function project_build ()
{
echo "Type=${1}, Tests=${2}, Static=${3}, Dev=${4}, j=${5}"
mkdir -p build
cd build
cmake .. -DCMAKE_BUILD_TYPE=${1} \
-DWITH_TESTS=${2} \
-DWITH_COVERAGE=${2} \
-DSTATIC_BUILD=${3} \
-DDEV_BUILD="${4}"
make -j${5}
alrighty=$(($? == 0)) # is the return code of make 0 ?
if [[ ${1} == "Coverage" && ${alrighty} == 1 ]]; then
make coverage-report
elif [[ ${6} == 1 && ${alrighty} == 1 ]]; then
ctest --verbose
fi
}
function usage ()
{
echo "fimpera build script."
echo "Usage: "
echo " ./install.sh [-r str] [-t int] [-j int] [-d] [-s]"
echo "Options: "
echo " -r <Release|Debug> -> build type {Release}."
echo " -t <0|1|2> -> tests: 0 = disabled, 1 = compile, 2 = compile and run {2}."
echo " -j <INT> -> nb threads {8}."
echo " -d -> dev build {disabled}."
echo " -s -> static build {disabled}."
echo " -h -> show help."
exit 1
}
rel="Release"
deb="Debug"
cov="Coverage"
mode="Release"
dev="OFF"
static="OFF"
tests=2
tests_str="ON"
tests_run=1
jopt=8
while getopts "r:k:t:c:j:onwmsh" option; do
case "$option" in
r)
mode=${OPTARG}
[[ ${mode} != ${rel} && ${mode} != ${deb} && ${mode} != ${cov} ]] && usage
;;
t)
tests=${OPTARG}
[[ ${tests} == 0 ]] || [[ ${tests} == 1 ]] || [[ ${tests} == 2 ]] || usage
[[ ${tests} == 0 ]] && tests_str="OFF"
[[ ${tests} == 1 ]] && tests_run=0
;;
j)
jopt=${OPTARG}
;;
s)
static="ON"
;;
d)
dev="ON"
;;
h)
usage
;;
*)
usage
;;
esac
done
project_build ${mode} ${tests_str} ${static} ${dev} ${jopt} ${tests_run}
# move bins to bin folder
mkdir -p ../bin
cp app/fimpera_index app/fimpera_info app/fimpera_query ../bin