-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.sh
executable file
·55 lines (49 loc) · 981 Bytes
/
run.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
#!/bin/bash
#SCRIPT CONFIG
EXECUTABLE_NAME='VoxelGame'
set -e
bold=$(tput bold)
normal=$(tput sgr0)
function prim { # PRint IMportant
IFS="%"
echo $bold$@$normal
unset IFS
}
function usage {
prim 'Usage:'
echo ' Run after building with compile.sh.'
prim ' Options:'
prim ' -d'
echo ' Build in debug the debug build.'
}
BUILD_DIR='build'
DEBUG=false
while getopts ":dh" opt; do
case $opt in
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 [ ! -x $BUILD_DIR/game/$EXECUTABLE_NAME ]; then
echo 'Cannot find an executable at '$PWD'/'$BUILD_DIR'/game/'$EXECUTABLE_NAME'.'
echo 'Are you sure you have built it?'
exit 1
fi
cd $BUILD_DIR/game
./$EXECUTABLE_NAME