forked from actor-framework/actor-framework
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathconfigure
More file actions
executable file
·231 lines (207 loc) · 7.33 KB
/
configure
File metadata and controls
executable file
·231 lines (207 loc) · 7.33 KB
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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
#!/bin/sh
set -e
# Convenience wrapper for easily setting options that the project's CMake
# scripts will recognize.
CommandDirname=$(dirname $0)
SourceDir=$(cd $CommandDirname && pwd)
usage="\
Usage:
$0 [--<variable>=<value>...]
General CMake options:
--cmake=PATH set a custom path to the CMake binary
--build-dir=PATH set build directory [build]
--build-type=STRING set build type of single-configuration generators
--generator=STRING set CMake generator (see cmake --help)
--cxx-flags=STRING set CMAKE_CXX_FLAGS when running CMake
--prefix=PATH set installation directory
--debug-postfix=STRING set CMAKE_DEBUG_POSTFIX
Locating packages in non-standard locations:
--openssl-root-dir=PATH set root directory of an OpenSSL installation
Debugging options:
--enable-trace-logging build with trace logging enabled
--sanitizers=STRING build with this list of sanitizers enabled
Convenience options:
--dev-mode shortcut for passing:
--build-type=Debug
--disable-shared-libs
--enable-robot-tests
--enable-runtime-checks
--enable-trace-logging
--sanitizers=address,undefined
Flags (use --enable-<name> to activate and --disable-<name> to deactivate):
cpack build with CPack package description [OFF]
curl-examples build examples with libcurl [OFF]
examples build small programs showcasing CAF features [ON]
export-compile-commands write JSON compile commands database [ON]
io-module build networking I/O module [ON]
openssl-module build OpenSSL module [ON]
prefer-pthread-flag prefer -pthread flag if available [ON]
protobuf-examples build examples with Google Protobuf [OFF]
qt6-examples build examples with the Qt6 framework [OFF]
robot-tests add the Robot tests to CTest [OFF]
runtime-checks build CAF with extra runtime assertions [OFF]
shared-libs build shared library targets [ON]
testing build unit test suites [ON]
with-exceptions build CAF with support for exceptions [ON]
Influential Environment Variables (only on first invocation):
CXX C++ compiler command
CXXFLAGS Additional C++ compiler flags
LDFLAGS Additional linker flags
CAF_BUILD_DIR Overrides the default build directory [build]
"
# Appends a CMake cache entry definition to the CMakeCacheEntries variable.
# $1: variable name
# $2: CMake type
# $3: value
append_cache_entry() {
case "$3" in
*\ * )
# string contains whitespace
CMakeCacheEntries="$CMakeCacheEntries -D \"$1:$2=$3\""
;;
*)
# string contains no whitespace
CMakeCacheEntries="$CMakeCacheEntries -D $1:$2=$3"
;;
esac
}
# Appends a BOOL cache entry to the CMakeCacheEntries variable.
# $1: flag name
# $2: value (ON or OFF)
set_build_flag() {
FlagName=''
case "$1" in
cpack) FlagName='CAF_ENABLE_CPACK' ;;
curl-examples) FlagName='CAF_ENABLE_CURL_EXAMPLES' ;;
examples) FlagName='CAF_ENABLE_EXAMPLES' ;;
exceptions) FlagName='CAF_ENABLE_EXCEPTIONS' ;;
export-compile-commands) FlagName='CMAKE_EXPORT_COMPILE_COMMANDS' ;;
io-module) FlagName='CAF_ENABLE_IO_MODULE' ;;
net-module) FlagName='CAF_ENABLE_NET_MODULE' ;;
openssl-module) FlagName='CAF_ENABLE_OPENSSL_MODULE' ;;
prefer-pthread-flag) FlagName='THREADS_PREFER_PTHREAD_FLAG' ;;
protobuf-examples) FlagName='CAF_ENABLE_PROTOBUF_EXAMPLES' ;;
qt6-examples) FlagName='CAF_ENABLE_QT6_EXAMPLES' ;;
robot-tests) FlagName='CAF_ENABLE_ROBOT_TESTS' ;;
runtime-checks) FlagName='CAF_ENABLE_RUNTIME_CHECKS' ;;
shared-libs) FlagName='BUILD_SHARED_LIBS' ;;
testing) FlagName='CAF_ENABLE_TESTING' ;;
*)
echo "Invalid flag '$1'. Try $0 --help to see available options."
exit 1
;;
esac
append_cache_entry $FlagName BOOL $2
}
# Set defaults.
if [ -n "$CAF_BUILD_DIR" ]; then
CMakeBuildDir="$CAF_BUILD_DIR"
else
CMakeBuildDir="$SourceDir/build"
fi
CMakeCacheEntries=""
# Parse user input.
while [ $# -ne 0 ]; do
# Fetch the option argument.
case "$1" in
--*=*) optarg=$(echo "$1" | sed 's/[-_a-zA-Z0-9]*=//') ;;
--enable-*) optarg=$(echo "$1" | sed 's/--enable-//') ;;
--disable-*) optarg=$(echo "$1" | sed 's/--disable-//') ;;
*) ;;
esac
# Consume current input.
case "$1" in
--help|-h)
echo "${usage}" 1>&2
exit 1
;;
--cmake=*)
CMakeCommand="$optarg"
;;
--build-dir=*)
CMakeBuildDir="$optarg"
;;
--generator=*)
CMakeGenerator="$optarg"
;;
--build-type=*)
append_cache_entry CMAKE_BUILD_TYPE STRING "$optarg"
;;
--cxx-flags=*)
append_cache_entry CMAKE_CXX_FLAGS STRING "$optarg"
;;
--prefix=*)
append_cache_entry CMAKE_INSTALL_PREFIX PATH "$optarg"
;;
--enable-trace-logging)
append_cache_entry CAF_ENABLE_TRACE_LOGGING BOOL ON
;;
--sanitizers=*)
append_cache_entry CAF_SANITIZERS STRING "$optarg"
;;
--dev-mode)
append_cache_entry CAF_ENABLE_TRACE_LOGGING BOOL ON
append_cache_entry CAF_SANITIZERS STRING 'address,undefined'
append_cache_entry CMAKE_BUILD_TYPE STRING 'Debug'
set_build_flag shared-libs OFF
set_build_flag runtime-checks ON
set_build_flag robot-tests ON
;;
--enable-*)
set_build_flag $optarg ON
;;
--disable-*)
set_build_flag $optarg OFF
;;
--openssl-root-dir=*)
append_cache_entry OPENSSL_ROOT_DIR PATH "$optarg"
;;
--debug-postfix=*)
append_cache_entry CMAKE_DEBUG_POSTFIX STRING "$optarg"
;;
*)
echo "Invalid option '$1'. Try $0 --help to see available options."
exit 1
;;
esac
# Get next input.
shift
done
# Check for `cmake` command.
if [ -z "$CMakeCommand" ]; then
# Prefer cmake3 over "regular" cmake (cmake == cmake2 on RHEL).
if command -v cmake3 >/dev/null 2>&1 ; then
CMakeCommand="cmake3"
elif command -v cmake >/dev/null 2>&1 ; then
CMakeCommand="cmake"
else
echo "This package requires CMake, please install it first."
echo "Then you may use this script to configure the CMake build."
echo "Note: pass --cmake=PATH to use cmake in non-standard locations."
exit 1
fi
fi
# Make sure the build directory is an absolute path.
case "$CMakeBuildDir" in
/*)
CMakeAbsoluteBuildDir="$CMakeBuildDir"
;;
*)
CMakeAbsoluteBuildDir="$SourceDir/$CMakeBuildDir"
;;
esac
# If a build directory exists, delete any existing cache to have a clean build.
if [ -d "$CMakeAbsoluteBuildDir" ]; then
if [ -f "$CMakeAbsoluteBuildDir/CMakeCache.txt" ]; then
rm -f "$CMakeAbsoluteBuildDir/CMakeCache.txt"
fi
else
mkdir -p "$CMakeAbsoluteBuildDir"
fi
# Run CMake.
cd "$CMakeAbsoluteBuildDir"
if [ -n "$CMakeGenerator" ]; then
"$CMakeCommand" -G "$CMakeGenerator" $CMakeCacheEntries "$SourceDir"
else
"$CMakeCommand" $CMakeCacheEntries "$SourceDir"
fi