-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.sh
34 lines (31 loc) · 967 Bytes
/
run.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
#!/bin/sh
project="timer"
if [ "$1" = "build" ] || [ "$1" = "make" ]; then
cmake -B build/cmake/ -S .
make -C build/cmake/
elif [ "$1" = "rebuild" ]; then
rm -rf build/bin/* build/cmake/*
cmake -B build/cmake/ -S .
make -C build/cmake/
elif [ "$1" = "clean" ]; then
rm -rf build/
elif [ "$1" = "help" ]; then
echo -e "Build project:\t ./run build"
echo -e "Rebuild project: ./run rebuild"
echo -e "Clean project:\t ./run clean"
echo -e "Run project:\t ./run"
else
if [ -e build/bin/$project ]; then
exec build/bin/$project "$@"
else
echo "No binary executable named \"$project\" found in the directory \"build/bin/\"."
echo "Building..."
cmake -B build/cmake/ -S .
make -C build/cmake/
if [ -e build/bin/$project ]; then
exec build/bin/$project "$@"
else
echo "Project built, but no binary executable found. Verify your project names match between the shell script and CMakeLists.txt"
fi
fi
fi