-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·64 lines (46 loc) · 1.7 KB
/
build.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
#!/bin/bash
# Bash "strict mode"
set -euo pipefail
function link {
if [ ! -L $1 ]; then
ln -sf $2 $1
fi
}
R3S_DIR=$(dirname $(realpath -s $0))
BUILD_DIR=`pwd`
BUILD_TYPES_DIR="$BUILD_DIR/builds"
DEBUG_BUILD="$BUILD_TYPES_DIR/debug"
RELEASE_BUILD="$BUILD_TYPES_DIR/release"
R3S_LIBS_DIR="$BUILD_DIR/libs"
R3S_INCLUDE_DIR="$BUILD_DIR/include"
R3S_EXAMPLES_DIR="$BUILD_DIR/examples"
R3S_DOCS_DIR="$BUILD_DIR/docs"
if [[ -z "${Z3_DIR}" ]]; then
echo "This project is dependent on the Z3 project."
echo "Please set the environmental variable \"Z3_DIR\" with the path to that project."
echo "Another alternative is to let this script grab the necessary dependencies."
echo "If you want to let it grab its dependencies, run this script with the flag \"--grab-deps\"."
exit 1
fi
# Build debug
echo "[*] Building debug and examples"
mkdir -p $DEBUG_BUILD
cd $DEBUG_BUILD
CMAKE_PREFIX_PATH="$Z3_DIR/build" CMAKE_INCLUDE_PATH="$Z3_DIR/build/include/" cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_EXAMPLES=ON $R3S_DIR > /dev/null
make > /dev/null
# Build release and generate documentation
echo "[*] Building release"
mkdir -p $RELEASE_BUILD
cd $RELEASE_BUILD
CMAKE_PREFIX_PATH="$Z3_DIR/build" CMAKE_INCLUDE_PATH="$Z3_DIR/build/include/" cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_EXAMPLES=ON $R3S_DIR > /dev/null
make > /dev/null
echo "[*] Generating documentation"
make docs > /dev/null 2> /dev/null
# Symlink results
echo "[*] Symlinking"
mkdir -p $R3S_LIBS_DIR
link $R3S_LIBS_DIR/libr3sd.so $DEBUG_BUILD/lib/libr3sd.so
link $R3S_LIBS_DIR/libr3s.so $RELEASE_BUILD/lib/libr3s.so
link $R3S_INCLUDE_DIR $R3S_DIR/include/
link $R3S_EXAMPLES_DIR $DEBUG_BUILD/bin/
link $R3S_DOCS_DIR $RELEASE_BUILD/docs/html/