-
Notifications
You must be signed in to change notification settings - Fork 0
/
linux_build.sh
executable file
·56 lines (51 loc) · 1.18 KB
/
linux_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
###
# @author Yanqing Wu
# @email [email protected]
# @create date 2023-02-10 05:39:00
# @modify date 2023-04-04 00:18:10
# @desc build file
###
# Flag to build Qt GUI.
IS_GUI=0
while [ True ]; do
if [ "$1" = "--gui" -o "$1" = "-g" ]; then
IS_GUI=1
shift 1
elif [ "$1" = "--cli" -o "$1" = "-c" ];then
IS_GUI=0
shift1
# elif [ "$1" = "--config" -o "$1" = "-c" ]; then
# CONFIG=$2
# shift 2
else
break
fi
done
## update qrc; only for GUI
if [ $IS_GUI -eq 1 ]; then
if [[ "$(python3 -V)" =~ "Python 3" ]]; then
echo "python3 is installed"
else
echo "python3 is NOT installed"
exit 1
fi
python3 ./generate_qrc.py > fillgame.qrc
fi
## build
# cmake --build . --target clean
mkdir -p build
if [ $IS_GUI -eq 1 ]; then
cmake -DCMAKE_BUILD_TYPE=Release -DIS_BUILD_GUI:BOOL=ON -S . -B build
else
cmake -DCMAKE_BUILD_TYPE=Release -DIS_BUILD_GUI:BOOL=OFF -S . -B build
fi
cd build
make
## move the executable to the root folder
cd ..
if [ -f ./build/src/fillgame_gui ]; then
mv ./build/src/fillgame_gui .
elif [ -f ./build/src/fillgame_cli ]; then
mv ./build/src/fillgame_cli .
fi
mv ./build/test/test_main .