-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·74 lines (64 loc) · 1.58 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
65
66
67
68
69
70
71
72
73
#!/bin/sh
# License: dual license, pick your choice. Either Boost license 1.0, or GPL(v2
# or later, at your option).
# by Paul Dreik 20180919
set -e
root=$(readlink -f $(dirname "$0"))
me=$(basename $0)
# $1 - name
# $2... passed to cmake
dobuild() {
if [ -d $root/build-$1 ] ; then
cd $root/build-$1
else
mkdir $root/build-$1
cd $root/build-$1
shift
cmake -GNinja $root $@
fi
ninja
if [ -d tests ]; then
ninja test
fi
}
export CXX
export CXXFLAGS
#make a sanitizers debug build with the default compiler, C++17
CXXFLAGS="-fsanitize=undefined,address -g -O0 -std=c++1z -Wall -Wextra"
dobuild sanitizers_17 \
-DBUILD_EXAMPLES=On \
-DBUILD_FUZZERS=Off \
-DBUILD_UNITTESTS=On \
-DBUILD_EXHAUSTIVE_TESTS=On \
-DCMAKE_BUILD_TYPE=Debug \
-DFUZZ_LINKMAIN=On
#make sure the examples can be built with c++11
CXXFLAGS="-g -O0 -std=c++11 -Wall -Wextra"
dobuild normal_cpp11 \
-DBUILD_EXAMPLES=On \
-DBUILD_FUZZERS=Off \
-DBUILD_UNITTESTS=Off \
-DCMAKE_BUILD_TYPE=Debug \
-DFUZZ_LINKMAIN=On
#make a libfuzzer build with sanitizers
CXX=clang++
CXXFLAGS="-fsanitize=fuzzer-no-link,undefined,address -g -O0 -std=c++1z"
dobuild libfuzzer_with_sanitizers \
-DBUILD_EXAMPLES=Off \
-DBUILD_FUZZERS=On \
-DBUILD_UNITTESTS=Off \
-DCMAKE_BUILD_TYPE=Debug \
-DFUZZ_LINKMAIN=Off \
-DFUZZ_LDFLAGS=-fsanitize=fuzzer
#make a speed measurement build
CXXFLAGS="-std=c++1z -Wall -Wextra"
dobuild speedtest \
-DBUILD_EXAMPLES=Off \
-DBUILD_FUZZERS=Off \
-DBUILD_UNITTESTS=Off \
-DBUILD_SPEED_TESTS=On \
-DBUILD_EXHAUSTIVE_TESTS=Off \
-DCMAKE_BUILD_TYPE=Release \
-DFUZZ_LINKMAIN=On
echo $me: all tests passed
exit 0