This repository has been archived by the owner on Aug 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 62
/
configure.sh
executable file
·231 lines (171 loc) · 6.27 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
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
#--------------------------------------------------------------------------#
BUILDDIR=build
#--------------------------------------------------------------------------#
asan=no
ubsan=no
debug=no
check=no
log=no
shared=no
prefix=
path=
gmp=no
testing=unknown
lingeling=unknown
minisat=unknown
picosat=unknown
cadical=unknown
cms=unknown
gcov=no
gprof=no
python=no
py2=no
py3=no
timestats=no
# Enable macOS universal binaries
univeral=no
ninja=no
flags=""
#--------------------------------------------------------------------------#
usage () {
cat <<EOF
usage: $0 [<option> ...]
where <option> is one of the following:
-h, --help print this message and exit
-g compile with debugging support
-f...|-m... add compiler options
--ninja use Ninja build system
--prefix <dir> install prefix
--path <dir> look for dependencies in <dir>/{include,lib}
specify multiple --path options for multiple directories
--shared shared library
-l compile with logging support (default for '-g')
-c check assertions even in optimized compilation
--testing enable unit and regression testing
--no-testing disable unit and regression testing
--asan compile with -fsanitize=address -fsanitize-recover=address
--ubsan compile with -fsanitize=undefined
--gcov compile with -fprofile-arcs -ftest-coverage
--gprof compile with -pg
--python compile python API
--py2 prefer Python 2.7
--py3 prefer Python 3
--time-stats compile with time statistics
--universal produce macOS universal x86_64/arm64 binaries
--gmp use gmp for bit-vector implementation
By default all supported SAT solvers available are used and linked.
If explicitly enabled, configuration will fail if the SAT solver library
can not be found.
--no-cadical do not use CaDiCaL
--no-cms do not use CryptoMiniSat
--no-lingeling do not use Lingeling
--no-minisat do not use MiniSAT
--no-picosat do not use PicoSAT
--only-cadical only use CaDiCaL
--only-cms only use CryptoMiniSat
--only-lingeling only use Lingeling
--only-minisat only use MiniSAT
--only-picosat only use PicoSAT
EOF
exit 0
}
#--------------------------------------------------------------------------#
die () {
echo "*** configure.sh: $*" 1>&2
exit 1
}
msg () {
echo "[configure.sh] $*"
}
#--------------------------------------------------------------------------#
[ ! -e src/boolector.c ] && die "$0 not called from Boolector base directory"
while [ $# -gt 0 ]
do
opt=$1
case $opt in
-h|--help) usage;;
-g) debug=yes;;
-f*|-m*) if [ -z "$flags" ]; then flags=$1; else flags="$flags;$1"; fi;;
--ninja) ninja=yes;;
--prefix)
shift
[ $# -eq 0 ] && die "missing argument to $opt"
prefix=$1
;;
--path)
shift
[ $# -eq 0 ] && die "missing argument to $opt"
[ -n "$path" ] && path="$path;"
path="$path$1"
;;
--shared) shared=yes;;
-l) log=yes;;
-c) check=yes;;
--testing) testing=yes;;
--no-testing) testing=no;;
--asan) asan=yes;;
--ubsan) ubsan=yes;;
--gcov) gcov=yes;;
--gprof) gprof=yes;;
--python) python=yes;;
--py2) py2=yes;;
--py3) py3=yes;;
--time-stats) timestats=yes;;
--universal) universal=yes;;
--gmp) gmp=yes;;
--no-cadical) cadical=no;;
--no-cms) cms=no;;
--no-lingeling) lingeling=no;;
--no-minisat) minisat=no;;
--no-picosat) picosat=no;;
--only-cadical) lingeling=no;minisat=no;picosat=no;cadical=yes;cms=no;;
--only-cms) lingeling=no;minisat=no;picosat=no;cadical=no;cms=yes;;
--only-lingeling) lingeling=yes;minisat=no;picosat=no;cadical=no;cms=no;;
--only-minisat) lingeling=no;minisat=yes;picosat=no;cadical=no;cms=no;;
--only-picosat) lingeling=no;minisat=no;picosat=yes;cadical=no;cms=no;;
-*) die "invalid option '$opt' (try '-h')";;
esac
shift
done
#--------------------------------------------------------------------------#
cmake_opts="$CMAKE_OPTS"
[ $ninja = yes ] && cmake_opts="$cmake_opts -G Ninja"
[ $asan = yes ] && cmake_opts="$cmake_opts -DASAN=ON"
[ $ubsan = yes ] && cmake_opts="$cmake_opts -DUBSAN=ON"
[ $debug = yes ] && cmake_opts="$cmake_opts -DCMAKE_BUILD_TYPE=Debug"
[ $check = yes ] && cmake_opts="$cmake_opts -DCHECK=ON"
[ $log = yes ] && cmake_opts="$cmake_opts -DLOG=ON"
[ $shared = yes ] && cmake_opts="$cmake_opts -DBUILD_SHARED_LIBS=ON"
[ $testing = yes ] && cmake_opts="$cmake_opts -DTESTING=ON"
[ $testing = no ] && cmake_opts="$cmake_opts -DTESTING=OFF"
[ -n "$prefix" ] && cmake_opts="$cmake_opts -DCMAKE_INSTALL_PREFIX=$prefix"
[ -n "$path" ] && cmake_opts="$cmake_opts -DCMAKE_PREFIX_PATH=$path"
[ $gmp = yes ] && cmake_opts="$cmake_opts -DUSE_GMP=ON"
[ $cadical = yes ] && cmake_opts="$cmake_opts -DUSE_CADICAL=ON"
[ $cms = yes ] && cmake_opts="$cmake_opts -DUSE_CMS=ON"
[ $lingeling = yes ] && cmake_opts="$cmake_opts -DUSE_LINGELING=ON"
[ $minisat = yes ] && cmake_opts="$cmake_opts -DUSE_MINISAT=ON"
[ $picosat = yes ] && cmake_opts="$cmake_opts -DUSE_PICOSAT=ON"
[ $cadical = no ] && cmake_opts="$cmake_opts -DUSE_CADICAL=OFF"
[ $cms = no ] && cmake_opts="$cmake_opts -DUSE_CMS=OFF"
[ $lingeling = no ] && cmake_opts="$cmake_opts -DUSE_LINGELING=OFF"
[ $minisat = no ] && cmake_opts="$cmake_opts -DUSE_MINISAT=OFF"
[ $picosat = no ] && cmake_opts="$cmake_opts -DUSE_PICOSAT=OFF"
[ $gcov = yes ] && cmake_opts="$cmake_opts -DGCOV=ON"
[ $gprof = yes ] && cmake_opts="$cmake_opts -DGPROF=ON"
[ $python = yes ] && cmake_opts="$cmake_opts -DPYTHON=ON"
[ $py2 = yes ] && cmake_opts="$cmake_opts -DUSE_PYTHON2=ON"
[ $py3 = yes ] && cmake_opts="$cmake_opts -DUSE_PYTHON3=ON"
[ $timestats = yes ] && cmake_opts="$cmake_opts -DTIME_STATS=ON"
[ -n "$flags" ] && cmake_opts="$cmake_opts -DFLAGS=$flags"
# Create a universal binary on macOS
case "$(uname -a)" in
Darwin*)
[ $universal = yes ] && cmake_opts="$cmake_opts -DCMAKE_OSX_ARCHITECTURES='x86_64;arm64'"
;;
esac
mkdir -p $BUILDDIR
cd $BUILDDIR || exit 1
[ -e CMakeCache.txt ] && rm CMakeCache.txt
cmake .. $cmake_opts