-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·63 lines (53 loc) · 1.72 KB
/
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
57
58
59
60
61
62
63
#!/bin/bash
args1="$1"
args2="$2"
buildType="client"
platform='unknown'
executableExtension=''
if [[ "$args1" == "server" ]]; then
buildType="server"
fi
# Check Platform
case "$OSTYPE" in
linux*)
platform="LINUX"
# executableExtension=".so"
;;
msys*)
platform="WINDOWS"
executableExtension=".exe"
;;
cygwin*)
platform="WINDOWS"
executableExtension=".exe"
;;
*)
platform="$OSTYPE"
executableExtension=""
;;
esac
buildExecutable="${buildType}${executableExtension}"
if [[ "$args2" == "run" ]]; then
if [ "$args1" == "server" ]; then
killall -9 $buildExecutable;
fi
clear;
fi
if [[ "$args2" == "init" || ! -d "./build/$buildType/CMakeFiles" ]]; then
cd "build/$buildType" && cmake ../../ && cd ../../
else
if [[ "$args1" == "server" ]]; then
echo -e "\n\033[0;36m=========================================================="
echo -e "= \033[0;36m-------------------- \033[5;34mBUILD SERVER\033[0;36m -------------------- =\033[0m"
echo -e "\033[0;36m==========================================================\033[0m"
elif [[ "$args1" == "client" ]]; then
echo -e "\n\033[0;34m=========================================================="
echo -e "= \033[0;34m-------------------- \033[5;36mBUILD CLIENT\033[0;34m -------------------- =\033[0m"
echo -e "\033[0;34m==========================================================\033[0m"
fi
fi
make -C "build/$buildType" -s
if [[ "$args2" == "run" ]]; then
echo -e "\n\033[6;33m========================= \033[5;31mOUTPUT\033[5;33m =========================\033[0m"
exec "./build/bin/$buildExecutable"
fi