-
Notifications
You must be signed in to change notification settings - Fork 39
/
local_pipeline_ubuntu.sh
executable file
·46 lines (41 loc) · 1.26 KB
/
local_pipeline_ubuntu.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
#!/usr/bin/env bash
set -eou pipefail
CLEAN_BUILD=false
BUILD_DEBUG=""
POSITIONAL=()
while [[ $# -gt 0 ]]; do
key="$1"
case $key in
-c|--clean-build)
CLEAN_BUILD=true
shift # past argument
;;
-d|--debug)
BUILD_DEBUG="-DCMAKE_BUILD_TYPE=Debug"
shift # past argument
;;
-h|--help)
printf "Usage: %s [-c] [-d] \n
This scripts configures, builds, and executes the dogm library, unit tests, and the demo.
You can use the following flags:\n
-c Clean build (removes previous build files)
-d Debug build\n" "$0"
exit 0
;;
*) # unknown option
POSITIONAL+=("$1") # save it in an array for later
shift # past argument
;;
esac
done
set -- "${POSITIONAL[@]}" # restore positional parameters
find dogm/demo dogm/include dogm/src dogm/test \( -iname '*.h' -o -iname '*.cpp' -o -iname '*.cu' \) -print0 | xargs -0 clang-format -i
mkdir -p build && cd build
if [ "$CLEAN_BUILD" = true ]; then rm -rf ./*; fi
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON "${BUILD_DEBUG}" ../dogm
make -j "$(nproc)"
# TODO: extend to check more/all .cpp (and .cu) files
cd ..
find . -iname '*.cpp' -print0 | xargs -0 clang-tidy -p build
ctest . -j "$(nproc)"
./demo/demo