-
-
Notifications
You must be signed in to change notification settings - Fork 10
/
quickbuild.sh
executable file
·90 lines (78 loc) · 2.17 KB
/
quickbuild.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
#!/bin/bash
cleanup ()
{
kill -s SIGTERM $!
exit 0
}
trap cleanup SIGINT SIGTERM
POSITIONAL_ARGS=()
ASAN=1
TSAN=0
GCC=0
BUILDTYPE="Debug"
RUN_EXAMPLES=0
while [[ $# -gt 0 ]]; do
case $1 in
--gcc)
GCC=1
shift # past value
;;
--tsan)
ASAN=0
TSAN=1
shift # past value
;;
--nosan)
ASAN=0
TSAN=0
shift # past value
;;
--release)
ASAN=0
TSAN=0
BUILDTYPE="Release"
shift # past value
;;
--run-examples)
RUN_EXAMPLES=1
shift # past value
;;
-*|--*)
echo "Unknown option $1"
exit 1
;;
*)
POSITIONAL_ARGS+=("$1") # save positional arg
shift # past argument
;;
esac
done
set -- "${POSITIONAL_ARGS[@]}" # restore positional parameters
curr=`basename $(pwd)`
if [[ "$curr" != "build" ]]; then
echo "Not in build directory"
exit 1;
fi
rm -rf ./*
rm -rf ../bin/*
if [[ $GCC -eq 1 ]]; then
CC=/opt/gcc/12/bin/gcc CXX=/opt/gcc/12/bin/g++ cmake -DCMAKE_BUILD_TYPE=${BUILDTYPE} -DICHOR_ARCH_OPTIMIZATION=X86_64_AVX2 -DICHOR_USE_BACKWARD=0 -DICHOR_USE_BOOST_BEAST=1 -DICHOR_USE_HIREDIS=1 -DICHOR_USE_SANITIZERS=${ASAN} -DICHOR_USE_THREAD_SANITIZER=${TSAN} -DICHOR_USE_MOLD=1 -GNinja ..
else
CC=clang CXX=clang++ cmake -DCMAKE_BUILD_TYPE=${BUILDTYPE} -DICHOR_ARCH_OPTIMIZATION=X86_64_AVX2 -DICHOR_USE_BACKWARD=0 -DICHOR_USE_BOOST_BEAST=1 -DICHOR_USE_HIREDIS=1 -DICHOR_USE_LIBCPP=0 -DICHOR_USE_SANITIZERS=${ASAN} -DICHOR_USE_THREAD_SANITIZER=${TSAN} -DICHOR_USE_MOLD=1 -GNinja ..
fi
ninja && ninja test
if [[ $RUN_EXAMPLES -eq 1 ]]; then
../bin/ichor_http_example || exit 1
../bin/ichor_multithreaded_example || exit 1
../bin/ichor_optional_dependency_example || exit 1
../bin/ichor_event_statistics_example || exit 1
../bin/ichor_serializer_example || exit 1
../bin/ichor_tcp_example || exit 1
../bin/ichor_timer_example || exit 1
../bin/ichor_factory_example || exit 1
../bin/ichor_introspection_example || exit 1
../bin/ichor_websocket_example || exit 1
../bin/ichor_websocket_example -t4 || exit 1
../bin/ichor_yielding_timer_example || exit 1
../bin/ichor_etcd_example || exit 1
fi