generated from DrkWithT/CMakePreset_Demo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
utility.sh
executable file
·27 lines (24 loc) · 860 Bytes
/
utility.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
# File: utility.sh
# By: DrkWithT
# Brief: wraps CMake & CTest invocations, even other useful cmds.
if [[ $# -ne 1 ]]; then
echo "Usage: ./utility.sh [info | debug | release | test | sloc]"
exit 1
fi
option="$1"
if [[ "$option" = "debug" ]]; then
cmake --fresh -S . -B build --preset vsc-clang-debug-config && cmake --build build;
cp ./build/compile_commands.json .
elif [[ "$option" = "release" ]]; then
cmake --fresh -S . -B build --preset vsc-clang-release-config && cmake --build build;
cp ./build/compile_commands.json .
elif [[ "$option" = "info" ]]; then
echo "Usage: ./utility.sh [info | debug | release | test]"
elif [[ "$option" = "test" ]]; then
ctest --test-dir build -V --timeout 3
elif [[ "$option" = "sloc" ]]; then
wc -l ./src/**/*.cpp ./src/include/**/*.hpp
else
echo "Invalid option!"
exit 1
fi