-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.sh
executable file
·67 lines (63 loc) · 1.22 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
#!/bin/bash
print_help() {
echo "Usage for build.sh:"
echo "-h --help Print help manual"
echo "-f --format Format C++ codes"
echo "-b --build Build C++ project"
}
POSITIONAL=()
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
-h|--help)
print_help
shift
shift
;;
-f|--format)
echo "Formatting the code"
find ./ -iname "*.hpp" -o -iname "*.cpp" | xargs clang-format -i
shift
shift
;;
-c|--clean)
echo "Cleaning builds"
rm -rf build
shift
shift
;;
-rt|--run_test)
echo "Running test"
set -a
cd build && ./graph_test
set +a
shift
shift
;;
-b|--build)
echo "Building the project"
mkdir -p build
cd build && cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DRUN_BENCHMARK=ON .. && ninja -j8
shift
shift
;;
-bm)
echo "Running the benchmark"
set -a
cd build && ./bmark
set +a
shift
shift
;;
*) # unknown option
POSITIONAL+=("$1") # save it in an array for later
shift
;;
esac
done
set -- "${POSITIONAL[@]}" # restore positional parameters
if [[ -n $1 ]]; then
echo "Last line of file specified as non-opt/last argument:"
tail -1 "$1"
fi