-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathready.sh
More file actions
56 lines (50 loc) · 1.06 KB
/
ready.sh
File metadata and controls
56 lines (50 loc) · 1.06 KB
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
#!/bin/bash
now=$(stty -g)
trap 'stty "$now"' EXIT
stty sane
stty -echo
cd "$(dirname "$0")"
echo "Compiling..."
build_en=false
build_zh=false
en_suc=0
zh_suc=0
if [[ " $* " == *" -A "* ]]; then
build_zh=true
build_en=true
elif [[ " $* " == *" -ZH "* ]]; then
build_zh=true
elif [[ " $* " == *" -EN "* ]]; then
build_en=true
else
build_zh=true
fi
if $build_zh; then
echo -e " [ZH] Compiling..."
err1=$(g++ -fdiagnostics-color=always .code/main.cpp -o main.run -O2 2>&1)
zh_suc=$?
if [[ $zh_suc -ne 0 ]]; then
echo -e " [ZH] Compilation failed"
echo -e "$err1"
else
echo -e " [ZH] Compilation successful"
fi
fi
if $build_en ; then
echo -e " [EN] Compiling..."
err2=$(g++ -fdiagnostics-color=always .code/main.cpp -o mainEN.run -DEN -O2 2>&1)
en_suc=$?
if [[ $en_suc -ne 0 ]]; then
echo -e " [EN] Compilation failed"
echo -e "$err2"
else
echo -e " [EN] Compilation successful"
fi
fi
if [[ $zh_suc -ne 0 || $en_suc -ne 0 ]];then
stty "$now"
exit 1
fi
chmod u+x setup.sh
echo "Compilation successful"
stty "$now"