-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.sh
executable file
·61 lines (44 loc) · 1.23 KB
/
configure.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
#!/usr/bin/env bash
set -e -o pipefail
BUILD_DIR=build
debug=no
static=no
#--------------------------------------------------------------------------#
die () {
echo "*** configure.sh: $*" 1>&2
exit 1
}
usage () {
cat <<EOF
usage: ./configure.sh [<option> ...]
where <option> is one of the following:
-O optimized compilation (default)
-g compile with debugging support
--static static compilation
You might also want to use the environment variables
CC and CXX to specify the used C and C++ compiler, as in
CC=gcc-4.4 CXX=g++-4.4 ./configure.sh
which forces to use 'gcc-4.4' and 'g++-4.4'.
EOF
exit 0
}
#--------------------------------------------------------------------------#
while [ $# -gt 0 ]
do
case $1 in
-g) debug=yes;;
-O) debug=no;;
--static) static=yes;;
-h|-help|--help) usage;;
-*) die "invalid option '$1' (try '-h')";;
esac
shift
done
#--------------------------------------------------------------------------#
rm -rf "${BUILD_DIR}"
mkdir -p "${BUILD_DIR}"
cmake_opts=""
[ $debug = yes ] && cmake_opts="$cmake_opts -DCMAKE_BUILD_TYPE=Debug"
[ $static = yes ] && cmake_opts="$cmake_opts -DBUILD_SHARED_LIBS=OFF"
cd "${BUILD_DIR}"
cmake .. $cmake_opts