Repository navigation
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·594 lines (521 loc) · 19.4 KB
/
Copy pathbuild.sh
File metadata and controls
executable file
·594 lines (521 loc) · 19.4 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
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
#!/usr/bin/env bash
# Usage examples:
# ./build.sh # Release build, shared libs, RTTI on
# ./build.sh debug # Debug build, shared libs, RTTI on
# ./build.sh minsize # MinSizeRel build, shared libs, RTTI on
# ./build.sh dyn_lib # Release build, shared libs, RTTI on
# ./build.sh debug dyn_lib # Debug build, shared libs, RTTI on
# ./build.sh sta_lib # Release build, static libs, RTTI on
# ./build.sh debug sta_lib # Debug build, static libs, RTTI on
# ./build.sh sta_lib nortti # Release build, static libs, RTTI off
# ./build.sh debug sta_lib nortti # Debug build, static libs, RTTI off
#
# If LLVM_DIR or Z3_DIR points to an existing directory, that installation is used.
# Otherwise, this script installs/downloads the supported prebuilt dependencies.
#
# Linux dependencies include: build-essential libncurses5 libncurses-dev cmake zlib1g-dev unzip xz-utils
set -e
set -o pipefail
jobs="${SVF_BUILD_JOBS:-8}"
#########
# Variables and paths
#########
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)
SVFHOME="${SCRIPT_DIR}"
sysOS=$(uname -s)
arch=$(uname -m)
MajorLLVMVer=21
LLVMVer=${MajorLLVMVer}.1.0
LLVM_SDK_TAG="llvm_${MajorLLVMVer}"
Z3Ver=4.15.4
# Keep LLVM version suffix for version checking and better debugging.
# Keep this consistent with LLVM_DIR in setup.sh and llvm_version in Dockerfile.
LLVMHome="llvm-${LLVMVer}.obj"
Z3Home="z3.obj"
UbuntuArmLLVM_RTTI="https://github.com/SVF-tools/SVF/releases/download/SVF-3.3/llvm-${LLVMVer}-ubuntu26-rtti-aarch64.tar.gz"
UbuntuArmLLVM="https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVMVer}/LLVM-${LLVMVer}-Linux-ARM64.tar.xz"
UbuntuLLVM_RTTI="https://github.com/SVF-tools/SVF/releases/download/SVF-3.3/llvm-${LLVMVer}-ubuntu26-rtti-x86-64.tar.gz"
UbuntuLLVM="https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVMVer}/LLVM-${LLVMVer}-Linux-X64.tar.xz"
SourceLLVM="https://github.com/llvm/llvm-project/archive/refs/tags/llvmorg-${LLVMVer}.zip"
Z3PrebuiltBase="https://github.com/SVF-tools/SVF-npm/raw/prebuilt-libs"
UbuntuZ3="${Z3PrebuiltBase}/z3-${Z3Ver}-x86_64-ubuntu-22.04.zip"
UbuntuZ3Arm="${Z3PrebuiltBase}/z3-${Z3Ver}-arm64-ubuntu-22.04.zip"
MacOSZ3Arm="${Z3PrebuiltBase}/z3-${Z3Ver}-arm64-macos-14.zip"
BUILD_TYPE="Release"
BUILD_DYN_LIB="ON"
RTTI="ON"
ENABLE_ASSERTIONS="${SVF_ENABLE_ASSERTIONS:-ON}"
PLATFORM=""
urlLLVM=""
urlZ3=""
usage() {
cat <<USAGE
Usage: ./build.sh [debug|minsize] [dyn_lib|sta_lib] [nortti]
Options:
debug Build Debug instead of Release.
minsize Build MinSizeRel to reduce binary size.
dyn_lib Build shared libraries. This is the default.
sta_lib Build static libraries.
nortti Disable LLVM RTTI. Valid only for static-library builds.
Environment variables:
LLVM_DIR Use an existing LLVM installation.
Z3_DIR Use an existing Z3 installation.
SVF_BUILD_JOBS Number of parallel build jobs. Default: 8.
SVF_SANITIZER Sanitizer option passed to CMake.
SVF_ENABLE_ASSERTIONS Enable assertions. Default: ON.
USAGE
}
parse_args() {
for arg in "$@"; do
case "$arg" in
[Dd]ebug)
BUILD_TYPE="Debug"
;;
[Mm]insize|[Mm]in[Ss]ize[Rr]el)
BUILD_TYPE="MinSizeRel"
;;
[Dd]yn_[Ll]ib)
BUILD_DYN_LIB="ON"
;;
[Ss]ta_[Ll]ib)
BUILD_DYN_LIB="OFF"
;;
[Nn]ortti)
RTTI="OFF"
;;
-h|--help|[Hh]elp)
usage
exit 0
;;
*)
echo "Warning: ignoring unknown argument '$arg'."
;;
esac
done
}
normalise_options() {
# Windows builds (both MSVC and MinGW) must use static libraries due to circular symbol dependencies across SvfCore and SvfLLVM
if [[ "$PLATFORM" == windows-* ]]; then
if [[ "$BUILD_DYN_LIB" == "ON" ]]; then
echo "Notice: Windows builds require static libraries. Forcing BUILD_DYN_LIB=OFF (sta_lib)."
BUILD_DYN_LIB="OFF"
fi
fi
# Shared-library builds require RTTI in the current SVF/LLVM setup.
if [[ "$BUILD_DYN_LIB" == "ON" && "$RTTI" == "OFF" ]]; then
echo "Warning: LLVM RTTI is always on when building shared libraries. Ignoring 'nortti'."
RTTI="ON"
fi
}
detect_platform() {
case "${sysOS}" in
MINGW*|MSYS*|CYGWIN*|Windows_NT)
if command -v cl >/dev/null 2>&1; then
PLATFORM="windows-msvc"
else
PLATFORM="windows-mingw"
fi
;;
*)
case "${sysOS}-${arch}" in
Linux-x86_64|Linux-amd64)
PLATFORM="ubuntu-x86_64"
;;
Linux-aarch64|Linux-arm64)
PLATFORM="ubuntu-aarch64"
;;
Darwin-arm64)
PLATFORM="macos-arm64"
;;
Darwin-x86_64|Darwin-amd64)
PLATFORM="macos-x86_64"
;;
*)
echo "Unsupported platform: ${sysOS}/${arch}"
echo "Supported platforms: Linux x86_64, Linux aarch64/arm64, macOS arm64, macOS x86_64, Windows (MSVC / MinGW)."
exit 1
;;
esac
;;
esac
}
select_dependency_urls() {
case "$PLATFORM" in
windows-msvc|windows-mingw)
urlLLVM="https://github.com/c3lang/llvm-for-c3/releases/download/${LLVM_SDK_TAG}/llvm-windows-amd64.tar.gz"
urlZ3="https://github.com/Z3Prover/z3/releases/download/z3-${Z3Ver}/z3-${Z3Ver}-x64-win.zip"
;;
ubuntu-x86_64)
if [[ "$RTTI" == "ON" ]]; then
urlLLVM="$UbuntuLLVM_RTTI"
else
urlLLVM="$UbuntuLLVM"
fi
urlZ3="$UbuntuZ3"
;;
ubuntu-aarch64)
if [[ "$RTTI" == "ON" ]]; then
urlLLVM="$UbuntuArmLLVM_RTTI"
else
urlLLVM="$UbuntuArmLLVM"
fi
urlZ3="$UbuntuZ3Arm"
;;
macos-arm64)
# LLVM is installed via Homebrew on macOS. Z3 uses SVF's prebuilt package.
urlLLVM=""
urlZ3="$MacOSZ3Arm"
;;
macos-x86_64)
# LLVM is installed via Homebrew on macOS. No owned prebuilt Z3 is provided for this case.
urlLLVM=""
urlZ3=""
if [[ -z "${Z3_DIR:-}" ]]; then
echo "Warning: no prebuilt Z3 package is available for macOS x86_64."
echo " Set Z3_DIR to a compatible z3.obj directory before running build.sh."
fi
;;
esac
}
print_config() {
echo "Build configuration:"
echo " Platform: ${PLATFORM} (${sysOS}/${arch})"
echo " Build type: ${BUILD_TYPE}"
echo " Shared libs: ${BUILD_DYN_LIB}"
echo " Assertions: ${ENABLE_ASSERTIONS}"
echo " LLVM RTTI: ${RTTI}"
echo " Jobs: ${jobs}"
echo " LLVM_DIR: ${LLVM_DIR:-n/a}"
echo " Z3_DIR: ${Z3_DIR:-n/a}"
}
require_cmd() {
if [[ $# -lt 1 || $# -gt 2 ]]; then
echo "$0: bad args to require_cmd!"
exit 1
fi
local cmd="$1"
local hint="${2:-$1}"
if ! command -v "$cmd" >/dev/null 2>&1; then
echo "Cannot find $cmd. Please install $hint."
exit 1
fi
}
# Downloads $1 (URL) to $2 (target destination) using curl or wget.
generic_download_file() {
if [[ $# -ne 2 ]]; then
echo "$0: bad args to generic_download_file!"
exit 1
fi
local url="$1"
local out="$2"
if [[ -z "$url" ]]; then
echo "No download URL is available for ${PLATFORM}."
exit 1
fi
if [[ -f "$out" ]]; then
echo "File $out exists, skip download."
return
fi
local download_failed=false
if command -v curl >/dev/null 2>&1; then
if ! curl -fL "$url" -o "$out"; then
download_failed=true
fi
elif command -v wget >/dev/null 2>&1; then
if ! wget -c "$url" -O "$out"; then
download_failed=true
fi
else
echo "Cannot find a download tool. Please install curl or wget."
exit 1
fi
if $download_failed; then
echo "Failed to download $url"
rm -f "$out"
exit 1
fi
}
check_and_install_brew() {
if command -v brew >/dev/null 2>&1; then
echo "Homebrew is already installed."
return
fi
echo "Homebrew not found. Installing Homebrew..."
require_cmd curl curl
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo "Homebrew installation completed."
}
install_llvm_with_brew() {
check_and_install_brew
echo "Installing LLVM ${MajorLLVMVer} via Homebrew for ${PLATFORM}."
brew install "llvm@${MajorLLVMVer}"
mkdir -p "$SVFHOME/$LLVMHome"
ln -s "$(brew --prefix llvm@${MajorLLVMVer})"/* "$SVFHOME/$LLVMHome"
echo "LLVM installation completed."
}
download_llvm_prebuilt() {
echo "Downloading LLVM ${LLVMVer} for ${PLATFORM}."
# Detect archive format from the URL so the correct filename and
# decompression tool are used (.tar.gz for RTTI builds, .tar.xz otherwise).
local llvm_archive
if [[ "$urlLLVM" == *.tar.gz ]]; then
llvm_archive="llvm.tar.gz"
else
llvm_archive="llvm.tar.xz"
require_cmd xz xz-utils
fi
generic_download_file "$urlLLVM" "$llvm_archive"
echo "Unpacking LLVM package..."
mkdir -p "./$LLVMHome"
if [[ "$PLATFORM" == windows-* ]]; then
tar -xf "$llvm_archive" -C "./$LLVMHome"
else
tar -xf "$llvm_archive" -C "./$LLVMHome" --strip-components 1
fi
rm "$llvm_archive"
# For Windows MSVC LLVM SDK, strip hardcoded diaguids.lib path from LLVMExports.cmake
if [[ "$PLATFORM" == windows-* ]]; then
local exports_file="./$LLVMHome/lib/cmake/llvm/LLVMExports.cmake"
if [[ -f "$exports_file" ]]; then
sed -i 's|[a-zA-Z]:/[^";]*DIA SDK/lib/amd64/diaguids\.lib;||g' "$exports_file" || true
fi
fi
# For Windows MinGW LLVM SDK, ensure libzstd.a is available for Ninja/CMake targets
if [[ "$PLATFORM" == "windows-mingw" ]]; then
if [[ -f "/clang64/lib/libzstd.a" ]]; then
cp "/clang64/lib/libzstd.a" "./$LLVMHome/lib/" || true
elif [[ -f "/mingw64/lib/libzstd.a" ]]; then
cp "/mingw64/lib/libzstd.a" "./$LLVMHome/lib/" || true
else
touch "./$LLVMHome/lib/libzstd.a" 2>/dev/null || true
fi
fi
}
ensure_llvm() {
if [[ -n "${LLVM_DIR:-}" && -d "$LLVM_DIR" ]]; then
echo "Using existing LLVM_DIR=$LLVM_DIR"
return
fi
# In MinGW / MSYS2, use native MinGW LLVM installation matching MajorLLVMVer
if [[ "$PLATFORM" == "windows-mingw" ]]; then
if [[ -d "/clang64/opt/llvm-${MajorLLVMVer}" ]]; then
export LLVM_DIR="/clang64/opt/llvm-${MajorLLVMVer}"
export PATH="/clang64/opt/llvm-${MajorLLVMVer}/bin:$PATH"
echo "Using MinGW system LLVM_DIR=$LLVM_DIR"
return
elif [[ -d "/mingw64/opt/llvm-${MajorLLVMVer}" ]]; then
export LLVM_DIR="/mingw64/opt/llvm-${MajorLLVMVer}"
export PATH="/mingw64/opt/llvm-${MajorLLVMVer}/bin:$PATH"
echo "Using MinGW system LLVM_DIR=$LLVM_DIR"
return
elif command -v "llvm-config-${MajorLLVMVer}" >/dev/null 2>&1; then
LLVM_DIR="$("llvm-config-${MajorLLVMVer}" --prefix)"
export LLVM_DIR
echo "Using MinGW system LLVM_DIR=$LLVM_DIR"
return
fi
# If LLVM is not yet installed in MSYS2, install pinned packages for MajorLLVMVer
if command -v pacman >/dev/null 2>&1; then
echo "Installing LLVM ${MajorLLVMVer} packages for MinGW in MSYS2..."
local msys_mirror="https://mirror.msys2.org/mingw/clang64"
local pkg_suffix="${MajorLLVMVer}.1.8-4-any"
pacman -U --noconfirm --needed \
"${msys_mirror}/mingw-w64-clang-x86_64-llvm-libs-${pkg_suffix}.pkg.tar.zst" \
"${msys_mirror}/mingw-w64-clang-x86_64-llvm-tools-${pkg_suffix}.pkg.tar.zst" \
"${msys_mirror}/mingw-w64-clang-x86_64-llvm-${pkg_suffix}.pkg.tar.zst" \
"${msys_mirror}/mingw-w64-clang-x86_64-clang-libs-${pkg_suffix}.pkg.tar.zst" \
"${msys_mirror}/mingw-w64-clang-x86_64-compiler-rt-${pkg_suffix}.pkg.tar.zst" \
"${msys_mirror}/mingw-w64-clang-x86_64-clang-${pkg_suffix}.pkg.tar.zst" \
"${msys_mirror}/mingw-w64-clang-x86_64-lld-${pkg_suffix}.pkg.tar.zst"
if command -v llvm-config >/dev/null 2>&1; then
LLVM_DIR="$(llvm-config --prefix)"
export LLVM_DIR
echo "Using MinGW system LLVM_DIR=$LLVM_DIR"
return
elif [[ -d "/clang64/include/llvm" ]]; then
export LLVM_DIR="/clang64"
echo "Using MinGW system LLVM_DIR=$LLVM_DIR"
return
elif [[ -d "/mingw64/include/llvm" ]]; then
export LLVM_DIR="/mingw64"
echo "Using MinGW system LLVM_DIR=$LLVM_DIR"
return
fi
fi
fi
if [[ ! -d "$LLVMHome" ]]; then
case "$PLATFORM" in
macos-*)
install_llvm_with_brew
;;
ubuntu-*|windows-*)
download_llvm_prebuilt
;;
*)
echo "Unsupported LLVM installation scenario for ${PLATFORM}."
exit 1
;;
esac
fi
export LLVM_DIR="$SVFHOME/$LLVMHome"
}
find_z3_root() {
local search_dir="$1"
local candidate=""
while IFS= read -r -d '' candidate; do
if [[ -d "$candidate/include" && (-d "$candidate/bin" || -d "$candidate/lib") ]]; then
echo "$candidate"
return 0
fi
done < <(find "$search_dir" -type d -print0)
return 1
}
unpack_z3_package() {
if [[ $# -ne 1 ]]; then
echo "$0: bad args to unpack_z3_package!"
exit 1
fi
local archive="$1"
local unpack_dir="z3-unpack"
local nested_zip=""
local nested_dir=""
local z3_dir=""
rm -rf "$unpack_dir" "$Z3Home"
mkdir "$unpack_dir"
unzip -q "$archive" -d "$unpack_dir"
# Some prebuilt packages may contain another z3-*.zip. Unpack any nested package once.
while IFS= read -r -d '' nested_zip; do
nested_dir="$unpack_dir/nested-$(basename "$nested_zip" .zip)"
mkdir -p "$nested_dir"
unzip -q "$nested_zip" -d "$nested_dir"
done < <(find "$unpack_dir" -type f -name 'z3-*.zip' -print0)
if ! z3_dir=$(find_z3_root "$unpack_dir"); then
rm -rf "$unpack_dir"
echo "Z3 package did not contain a directory with the expected bin/ and include/ layout."
exit 1
fi
if [[ "$z3_dir" == "$unpack_dir" ]]; then
mv "$unpack_dir" "$Z3Home"
else
mv "$z3_dir" "$Z3Home"
rm -rf "$unpack_dir"
fi
}
ensure_z3() {
if [[ -n "${Z3_DIR:-}" && -d "$Z3_DIR" ]]; then
echo "Using existing Z3_DIR=$Z3_DIR"
return
fi
# In MinGW / MSYS2, check if system Z3 is installed
if [[ "$PLATFORM" == "windows-mingw" ]]; then
if [[ -f "/clang64/include/z3.h" || -d "/clang64/include/z3" ]]; then
export Z3_DIR="/clang64"
echo "Using MinGW system Z3_DIR=$Z3_DIR"
return
elif [[ -f "/mingw64/include/z3.h" || -d "/mingw64/include/z3" ]]; then
export Z3_DIR="/mingw64"
echo "Using MinGW system Z3_DIR=$Z3_DIR"
return
fi
fi
if [[ ! -d "$Z3Home" ]]; then
if [[ -z "$urlZ3" ]]; then
echo "No prebuilt Z3 package is available for ${PLATFORM}."
echo "Set Z3_DIR to a compatible z3.obj directory before running build.sh."
exit 1
fi
echo "Downloading Z3 ${Z3Ver} for ${PLATFORM}."
generic_download_file "$urlZ3" z3.zip
require_cmd unzip unzip
echo "Unpacking Z3 package..."
unpack_z3_package z3.zip
rm z3.zip
fi
export Z3_DIR="$SVFHOME/$Z3Home"
# Only rewrite the prebuilt Z3 that build.sh owns, not a user-provided Z3_DIR.
# This fixes macOS dylib lookup while keeping external Z3_DIR installations untouched.
if [[ "$sysOS" == "Darwin" ]]; then
local z3_dylib="$Z3_DIR/bin/libz3.dylib"
if [[ -f "$z3_dylib" ]]; then
install_name_tool -id "@rpath/libz3.dylib" "$z3_dylib"
fi
fi
}
configure_runtime_env() {
export PATH="$LLVM_DIR/bin:$Z3_DIR/bin:$PATH"
export LD_LIBRARY_PATH="$LLVM_DIR/lib:$Z3_DIR/bin:${LD_LIBRARY_PATH:-}"
export DYLD_LIBRARY_PATH="$LLVM_DIR/lib:$Z3_DIR/bin:${DYLD_LIBRARY_PATH:-}"
echo "LLVM_DIR=$LLVM_DIR"
echo "Z3_DIR=$Z3_DIR"
}
build_svf() {
local build_dir="./${BUILD_TYPE}-build"
local cmake_rpath_args=()
local cmake_generator_args=()
if [[ "$sysOS" == "Darwin" ]]; then
cmake_rpath_args=(
-DCMAKE_MACOSX_RPATH=ON
"-DCMAKE_BUILD_RPATH=@loader_path/../lib;@loader_path/../../${Z3Home}/bin"
"-DCMAKE_INSTALL_RPATH=@loader_path/../lib;@loader_path/../../../${Z3Home}/bin"
)
fi
if [[ "$PLATFORM" == "windows-msvc" ]]; then
cmake_generator_args=(
-G "Ninja"
-DCMAKE_C_COMPILER=cl
-DCMAKE_CXX_COMPILER=cl
-DSVF_WARN_AS_ERROR=OFF
-DSVF_EXPORT_DYNAMIC=OFF
-DSVF_Z3=ON
)
elif [[ "$PLATFORM" == "windows-mingw" ]]; then
local c_comp="${CC:-clang}"
local cxx_comp="${CXX:-clang++}"
if [[ -x "$LLVM_DIR/bin/clang.exe" || -x "$LLVM_DIR/bin/clang" ]]; then
c_comp="$LLVM_DIR/bin/clang"
cxx_comp="$LLVM_DIR/bin/clang++"
elif command -v "clang-${MajorLLVMVer}" >/dev/null 2>&1; then
c_comp="clang-${MajorLLVMVer}"
cxx_comp="clang++-${MajorLLVMVer}"
fi
cmake_generator_args=(
-G "Ninja"
-DCMAKE_C_COMPILER="$c_comp"
-DCMAKE_CXX_COMPILER="$cxx_comp"
-DSVF_WARN_AS_ERROR=OFF
-DSVF_EXPORT_DYNAMIC=OFF
-DSVF_Z3=ON
)
fi
rm -rf "$build_dir"
mkdir "$build_dir"
cmake -D CMAKE_BUILD_TYPE:STRING="$BUILD_TYPE" \
-DSVF_ENABLE_ASSERTIONS:BOOL="$ENABLE_ASSERTIONS" \
-DSVF_ENABLE_RTTI:BOOL="$RTTI" \
${SVF_SANITIZER:+-DSVF_SANITIZE="$SVF_SANITIZER"} \
${SVF_COVERAGE:+-DSVF_COVERAGE=ON} \
${SVF_DEBUG_INFO:+-DSVF_DEBUG_INFO=ON} \
-DBUILD_SHARED_LIBS="$BUILD_DYN_LIB" \
"${cmake_generator_args[@]}" \
"${cmake_rpath_args[@]}" \
-S "$SVFHOME" -B "$build_dir"
cmake --build "$build_dir" -j "$jobs"
}
main() {
detect_platform
parse_args "$@"
normalise_options
select_dependency_urls
print_config
cd "$SVFHOME"
ensure_llvm
ensure_z3
configure_runtime_env
build_svf
# Set up SVF environment variables.
if [[ -f "$SVFHOME/setup.sh" ]]; then
# shellcheck disable=SC1091
source "$SVFHOME/setup.sh" "$BUILD_TYPE"
fi
}
main "$@"