-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.sh
executable file
·111 lines (84 loc) · 2.12 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
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
#!/bin/bash
BUILD_DIR="./build"
TESTS_DIR="./tests_bin"
# if dir exists remove it
check_for_dir() {
dir="$1"
if [ -d $dir ]; then
rm -rf $dir
mkdir $dir
else
mkdir $dir
fi
}
run_event_tests() {
folder_case="$1"
run_tests_flags="build/ tests/events/$folder_case/cases/ single-client no-valgrind 60 10"
compare_tests_flags="tests/events/$folder_case/cases/ tests/events/$folder_case/expected/"
echo $run_tests_flags
RUN_TESTS_EVENTS="./tests/events/$folder_case/run_tests.sh $run_tests_flags"
COMPARE_TESTS_EVENTS="./tests/events/$folder_case/compare_outputs.sh $compare_tests_flags"
$RUN_TESTS_EVENTS
$COMPARE_TESTS_EVENTS
}
# if ./build.sh
if [[ $# -eq 0 ]]; then
echo "Building project"
check_for_dir $BUILD_DIR
cd $BUILD_DIR
cmake .. -DPRODUCTION=ON
echo "Copying assets"
cp -r ../assets .
make
# if ./build.sh log
elif [[ $1 == "-debug" ]]; then
echo "Building with debugging info"
check_for_dir $BUILD_DIR
cd $BUILD_DIR
# Initialize cmake options variable
CMAKE_OPTIONS=""
# Check for additional parameters and set cmake options accordingly
for param in "${@:2}"; do
if [[ $param == "log" ]]; then
CMAKE_OPTIONS+=" -DLOG=ON"
elif [[ $param == "log_verbose" ]]; then
CMAKE_OPTIONS+=" -DLOG_VERBOSE=ON"
elif [[ $param == "cheats" ]]; then
CMAKE_OPTIONS+=" -DCHEATS=ON"
fi
done
cmake .. -DPRODUCTION=ON $CMAKE_OPTIONS
echo "Copying assets"
cp -r ../assets .
make
# if ./build.sh graphics
elif [[ $1 == "graphics" ]]; then
echo "Building tests"
check_for_dir $TESTS_DIR
cd tests_bin
cmake -DGRAPHICS=ON ..
echo "Copying assets"
cp -r ../assets .
make
# if ./build.sh events
elif [[ $1 == "events" ]]; then
echo "Building event tests"
check_for_dir $BUILD_DIR
cd $BUILD_DIR
cmake -DEVENTS=ON ..
make
cd ..
echo "Running event tests"
run_event_tests "client_to_server"
run_event_tests 'server_to_client'
rm -r $BUILD_DIR
else [[ $1 == "physics" ]]
echo "Building physics tests"
check_for_dir $BUILD_DIR
cd $BUILD_DIR
cmake -DPHYSICS=ON ..
make
./tests
cd ..
rm -r $BUILD_DIR
fi