forked from WohlSoft/Moondust-Project
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·93 lines (83 loc) · 2.49 KB
/
build.sh
File metadata and controls
executable file
·93 lines (83 loc) · 2.49 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#/bin/bash
bak=~+
if [[ "$OSTYPE" == "msys"* ]]; then
./build.bat
exit 0
fi
#flags
flag_pause_on_end=true
QMAKE_EXTRA_ARGS=""
MAKE_EXTRA_ARGS="-r -j 4"
for var in "$@"
do
case "$var" in
no-pause)
flag_pause_on_end=false
;;
use-ccache)
if [[ "$OSTYPE" == "linux-gnu" ]]; then
QMAKE_EXTRA_ARGS="$QMAKE_EXTRA_ARGS -spec linux-g++ CONFIG+=useccache"
else
QMAKE_EXTRA_ARGS="$QMAKE_EXTRA_ARGS CONFIG+=useccache"
fi
;;
esac
done
#=============Detect directory that contains script=====================
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
SCRDIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
SCRDIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
#=======================================================================
echo $SCRDIR
cd $SCRDIR
source ./_common/functions.sh
#=======================================================================
if [ -f "$SCRDIR/_paths.sh" ]
then
source "$SCRDIR/_paths.sh"
else
echo ""
echo "_paths.sh is not exist! Run \"generate_paths.sh\" first!"
errorofbuild
fi
PATH=$PATH:$QT_PATH
#=======================================================================
# build translations of the editor
#cd Editor
#$LRelease *.pro
#checkState
#cd ../Engine
#$LRelease -idbased *.pro
#checkState
#cd ..
#=======================================================================
# build all components
if [[ "$OSTYPE" == "linux-gnu" ]]; then
$QMake CONFIG+=release CONFIG-=debug QTPLUGIN.platforms=qxcb QMAKE_TARGET.arch=$(uname -m) $QMAKE_EXTRA_ARGS
else
$QMake CONFIG+=release CONFIG-=debug $QMAKE_EXTRA_ARGS
fi
checkState
#=======================================================================
TIME_STARTED=$(date +%s)
make $MAKE_EXTRA_ARGS
checkState
TIME_ENDED=$(date +%s)
TIME_PASSED=$(($TIME_ENDED-$TIME_STARTED))
#=======================================================================
# copy data and configs into the build directory
make install
checkState
#=======================================================================
echo ""
show_time $TIME_PASSED
printf "\n\n=========BUILT!!===========\n\n"
cd $bak
if $flag_pause_on_end ; then
read -n 1;
fi
exit 0