forked from SVF-tools/SVF
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
executable file
·70 lines (54 loc) · 1.37 KB
/
setup.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
#!/usr/bin/env bash
echo "Setting up environment for SVF"
#########
# export SVF_DIR, LLVM_DIR and Z3_DIR
# Please change LLVM_DIR and Z3_DIR if they are different
########
# in a local installation $SVF_DIR is the directory containing setup.sh
SVF_DIR="$(cd -- "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1; pwd -P)"
export SVF_DIR
echo "SVF_DIR=$SVF_DIR"
function set_llvm {
# LLVM_DIR already set
[ -n "$LLVM_DIR" ] && return 0
# use local download directory
LLVM_DIR="$SVF_DIR/llvm-13.0.0.obj"
[ -d "$LLVM_DIR" ] && return 0
# ... otherwise don't set LLVM_DIR
return 1
}
if set_llvm; then
export LLVM_DIR
export PATH="$LLVM_DIR/bin:$PATH"
echo "LLVM_DIR=$LLVM_DIR"
else
echo "- LLVM_DIR not set, probably system-wide installation"
fi
function set_z3 {
# Z3_DIR already set
[ -n "$Z3_DIR" ] && return 0
# use local download directory
Z3_DIR="$SVF_DIR/z3.obj"
[ -d "$Z3_DIR" ] && return 0
# ... otherwise don't set Z3_DIR
return 1
}
if set_z3; then
export Z3_DIR
echo "Z3_DIR=$Z3_DIR"
else
echo "- Z3_DIR not set, probably system-wide installation"
fi
#########
#export PATH FOR SVF and LLVM executables
#########
if [[ $1 == 'debug' ]]
then
PTAOBJTY='Debug'
else
PTAOBJTY='Release'
fi
Build=$PTAOBJTY'-build'
export PATH=$LLVM_DIR/bin:$PATH
PTABIN=$SVF_DIR/$Build/bin
export PATH=$PTABIN:$PATH