Repository navigation
Expand file tree
/
Copy pathcompile.sh
More file actions
executable file
·83 lines (75 loc) · 1.7 KB
/
Copy pathcompile.sh
File metadata and controls
executable file
·83 lines (75 loc) · 1.7 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
#!/bin/bash
#SCRIPT CONFIG
PROJECT_FILE_RELATIVE_PATH="../VoxelGame.pro"
set -e
set -o pipefail
bold=$(tput bold)
normal=$(tput sgr0)
function prim { # PRint IMportant
IFS="%"
echo $bold$@$normal
unset IFS
}
function usage {
prim "Usage: "
echo " Configure the script accordingly and then run it from the project root directory."
prim " Options:"
prim " -d"
echo " Build in debug mode. This will enable consistency checks and debug logs."
prim " -r"
echo " Rebuild all. Will remove the previous build directory"
echo " and recreate the symbolic links."
}
REBUILD=false
DEBUG=false
BUILD_DIR="build"
while getopts ":rdh" opt; do
case $opt in
r)
REBUILD=true
;;
d)
DEBUG=true
BUILD_DIR="build-debug"
;;
h)
usage
exit 1
;;
\?)
echo "Invalid option: -$OPTARG" >&2
usage
exit 1
;;
:)
echo "Option -$OPTARG requires an argument." >&2
usage
exit 1
;;
esac
done
if [ $REBUILD = true ]; then
prim "Rebuilding all projects"
prim "Removing previous build..."
rm -rf $BUILD_DIR
fi
mkdir -p $BUILD_DIR
cd $BUILD_DIR
prim "Running qmake..."
if [ $DEBUG = true ]; then
prim "DEBUG BUILD"
qmake $PROJECT_FILE_RELATIVE_PATH -r -spec linux-g++-64 2>&1 CONFIG+=debug
else
prim "RELEASE BUILD"
qmake $PROJECT_FILE_RELATIVE_PATH -r -spec linux-g++-64 2>&1
fi
if [ ! -L "game/assets" ]; then
prim "Creating symbolic link for assets folder..."
ln -s $PWD/../game/assets game/assets
fi
prim "Building project..."
if hash colormake 2>/dev/null; then
colormake -j8 2>&1
else
make -j8 2>&1
fi