-
Notifications
You must be signed in to change notification settings - Fork 54
/
configure.sh
executable file
·182 lines (147 loc) · 4.47 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
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
#!/bin/sh
# This file for Linux users,
# launches CMake and creates configuration for
# Release and Debug modes.
echo
echo ============= Checking for CMake ============
echo
if (cmake --version); then
echo "Found CMake"
echo
else
echo "Error: CMake not found, please install it (see http://www.cmake.org/)"
exit 1
fi
# Parse command line arguments
cmake_options=
build_name_suffix=
while [ -n "$1" ]; do
case "$1" in
--debug)
cmake_options="$cmake_options --trace"
shift
;;
--with-*=*)
cmake_option=`echo "$1" | sed 's/--with-\([^=]*\)=\(.*\)$/-DVORPALINE_WITH_\U\1\E:STRING="\2"/'`
cmake_options="$cmake_options $cmake_option"
shift
;;
--with-*)
cmake_option=`echo "$1" | sed 's/--with-\(.*\)$/-DVORPALINE_WITH_\U\1:BOOL=TRUE/'`
cmake_options="$cmake_options $cmake_option"
shift
;;
--help-platforms)
echo "Supported platforms:"
for i in `find cmake/platforms/* -type d`
do
if [ $i != "xxxcmake/platforms" ]
then
echo "*" `basename $i`
fi
done
exit
;;
--build_name_suffix=*)
build_name_suffix=`echo "$1" | sed 's/--build_name_suffix=\(.*\)$/\1/'`
shift
;;
--help)
cat <<END
NAME
configure.sh
SYNOPSIS
Prepares the build environment for Geogram/Vorpaline.
- For Unix builds, the script creates 2 build trees for Debug and Release
build in a 'build' sub directory under the project root.
- For Windows builds, the script creates a single build tree that supports
all cmake build types (Debug, Release, RelWithDebInfo, MinSizeRel)
build in a 'build' sub directory under the project root.
USAGE
configure.sh [options] build-platform
OPTIONS
--help
Prints this page.
--with-gcov
Builds the project for coverage analysis with gcov
--with-gprof
Builds the project for performance analysis with gprof
--with-asan
Builds the project with Google's AddressSanitizer (dynamic builds only)
See: http://code.google.com/p/address-sanitizer/
--with-tsan
Builds the project with Google's ThreadSanitizer (dynamic builds only)
See: https://code.google.com/p/thread-sanitizer/
--with-ddt=ddt-root-dir
Builds the project for memory analysis with Allinea's DDT installed in
the specified directory: ddt-root-dir
--build_name_suffix=suffix-dir
Add a suffix to define the build directory
PLATFORM
Build platforms supported by Geogram/Vorpaline: use configure.sh --help-platforms
END
exit
;;
-*)
echo "Error: unrecognized option: $1"
return 1
;;
*)
break;
;;
esac
done
# Check the current OS
os="$1"
if [ -z "$os" ]; then
os=`uname -a`
case "$os" in
Linux*x86_64*)
os=Linux64-gcc-dynamic
;;
Linux*amd64*)
os=Linux64-gcc-dynamic
;;
Linux*i586*|Linux*i686*)
os=Linux32-gcc-dynamic
;;
Darwin*)
os=Darwin-clang-dynamic
;;
Linux*aarch64*Android)
os=Android-aarch64-gcc-dynamic
;;
*)
echo "Error: OS not supported: $os"
exit 1
;;
esac
fi
# Import plaform specific environment
if [ ! -f cmake/platforms/$os/setvars.sh ]
then
echo $os: no such platform
exit 1
fi
. cmake/platforms/$os/setvars.sh || exit 1
# Generate the Makefiles
for config in Release Debug; do
platform=$os-$config
echo
echo ============= Creating makefiles for $platform ============
echo
build_dir=build/$platform$build_name_suffix
mkdir -p $build_dir
(cd $build_dir; cmake -DCMAKE_BUILD_TYPE:STRING=$config -DVORPALINE_PLATFORM:STRING=$os $cmake_options ../../)
done
echo
echo ============== Geogram build configured ==================
echo
cat << EOF
To build geogram:
- go to build/$os-Release$build_name_suffix or build/$os-Debug$build_name_suffix
- run 'make' or 'cmake --build .'
Note: local configuration can be specified in CMakeOptions.txt
(see CMakeOptions.txt.sample for an example)
You'll need to re-run configure.sh if you create or modify CMakeOptions.txt
EOF