-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
44 lines (32 loc) · 941 Bytes
/
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
#!/bin/bash
# This script executes all the commands I use to build, static analyze and run the
# project.
#
# It must be executed from the root directory of the project.
set -e
# Creating the build directory if it doesn't exist.
mkdir -p build
cd build
if [[ $1 = "debug" ]]; then
cmake .. -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DBUILD_MODE=Debug
else
cmake .. -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DBUILD_MODE=Release
fi
make -j7
echo -e "\n\e[93mStarting static check.\e[0m\n"
cppcheck --enable=all --inconclusive -q ../src
echo -e "\n\e[92mBuilt successfully.\e[0m\n"
# Asking while no correct answer is provided.
while :
do
read -n1 -r -p "Are you want to launch the program? [Y/n] " key
if [[ $key = "" ]] || [[ $key = "Y" ]] || [[ $key = "y" ]]; then
./FantasyWar
break
elif [[ $key = "N" ]] || [[ $key = "n" ]]; then
break
fi
echo ""
done
# Leaving the build directory.
cd ..