forked from stanford-centaur/pono
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.sh
executable file
·135 lines (111 loc) · 4.17 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
#!/bin/sh
# Syntax and structure borrowed from cvc5's configure.sh script
CONF_FILE=Makefile.conf
usage () {
cat <<EOF
Usage: $0 [<option> ...]
Configures the CMAKE build environment.
-h, --help display this message and exit
--prefix=STR install directory (default: /usr/local/)
--build-dir=STR custom build directory (default: build)
--with-msat build with MathSAT which has a custom non-BSD compliant license. (default : off)
Required for interpolant based model checking
--with-msat-ic3ia build with the open-source IC3IA implementation as a backend. (default: off)
--with-coreir build the CoreIR frontend (default: off)
--with-coreir-extern build the CoreIR frontend using an installation of coreir in /usr/local/lib (default: off)
--debug build debug with debug symbols (default: off)
--python compile with python bindings (default: off)
--static-lib build a static library (default: shared)
--static build a static executable (default: dynamic); implies --static-lib
--with-profiling build with gperftools for profiling (default: off)
EOF
exit 0
}
die () {
echo "*** $0: $*" 1>&2
exit 1
}
build_dir=build
install_prefix=default
build_type=default
with_msat=default
with_msat_ic3ia=default
with_coreir=default
with_coreir_extern=default
debug=default
python=default
lib_type=SHARED
static_exec=NO
with_profiling=default
buildtype=Release
while [ $# -gt 0 ]
do
case $1 in
-h|--help) usage;;
--prefix) die "missing argument to $1 (see -h)" ;;
--prefix=*)
install_prefix=${1##*=}
# Check if install_prefix is an absolute path and if not, make it
# absolute.
case $install_prefix in
/*) ;; # absolute path
*) install_prefix=$(pwd)/$install_prefix ;; # make absolute path
esac
;;
--build-dir) die "missing argument to $1 (see -h)" ;;
--build-dir=*)
build_dir=${1##*=}
# Check if build_dir is an absolute path and if not, make it
# absolute.
case $build_dir in
/*) ;; # absolute path
*) build_dir=$(pwd)/$build_dir ;; # make absolute path
esac
;;
--with-msat) with_msat=ON;;
--with-msat-ic3ia) with_msat_ic3ia=ON;;
--with-coreir) with_coreir=ON;;
--with-coreir-extern) with_coreir_extern=ON;;
--debug)
debug=yes;
buildtype=Debug
;;
--python)
python=yes
;;
--static-lib)
lib_type=STATIC
;;
--static)
static_exec=YES;
lib_type=STATIC;
;;
--with-profiling) with_profiling=ON;;
*) die "unexpected argument: $1";;
esac
shift
done
[ $lib_type = STATIC ] && [ $with_coreir = ON -o $with_coreir_extern = ON ] && \
die "CoreIR and static build are incompatible, must omit either '--static/--static-lib' or '--with-coreir/--with-coreir-extern'"
cmake_opts="-DCMAKE_BUILD_TYPE=$buildtype -DPONO_LIB_TYPE=${lib_type} -DPONO_STATIC_EXEC=${static_exec}"
[ $install_prefix != default ] \
&& cmake_opts="$cmake_opts -DCMAKE_INSTALL_PREFIX=$install_prefix"
[ $with_msat != default ] \
&& cmake_opts="$cmake_opts -DWITH_MSAT=$with_msat"
[ $with_msat_ic3ia != default ] \
&& cmake_opts="$cmake_opts -DWITH_MSAT_IC3IA=$with_msat_ic3ia"
[ $with_coreir != default ] \
&& cmake_opts="$cmake_opts -DWITH_COREIR=$with_coreir"
[ $with_coreir_extern != default ] \
&& cmake_opts="$cmake_opts -DWITH_COREIR_EXTERN=$with_coreir_extern"
[ $python != default ] \
&& cmake_opts="$cmake_opts -DBUILD_PYTHON_BINDINGS=ON"
[ $with_profiling != default ] \
&& cmake_opts="$cmake_opts -DWITH_PROFILING=$with_profiling"
root_dir=$(pwd)
[ -e "$build_dir" ] && rm -r "$build_dir"
mkdir -p "$build_dir"
cd "$build_dir" || exit 1
[ -e CMakeCache.txt ] && rm CMakeCache.txt
echo "Running with cmake options: $cmake_opts"
cmake "$root_dir" $cmake_opts 2>&1