-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·62 lines (47 loc) · 1 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
#!/bin/bash
ROOT_DIR=~/Development/trikonasana
TARGET=main
EXECUTABLE=main
CONFIGURE=false
COMPILE_CMD="make"
WIN=false
while getopts "t:c" option; do
case $option in
c)
CONFIGURE=true
;;
t)
TARGET=$OPTARG
EXECUTABLE=$OPTARG
;;
esac
done
if [ "$OSTYPE" = "msys" ]; then
WIN=true
COMPILE_CMD="MSBuild.exe -target:Build /property:Configuration=Debug"
ROOT_DIR="c:/Users/darko/Development/trikonasana/"
TARGET=${TARGET}.vcxproj
EXECUTABLE=${EXECUTABLE}.exe
fi
# configure
if [ $CONFIGURE == true ]; then
cd $ROOT_DIR/build/
cmake ..
if [ $? != 0 ]; then
exit 1
fi
if [ $WIN == true ]; then
cd $ROOT_DIR/ninja/
cmake -G"Ninja" ..
mv compile_commands.json ..
fi
exit 0
fi
# build
cd $ROOT_DIR/build/
echo "COMPILE_CMD: $COMPILE_CMD ${TARGET}"
$COMPILE_CMD ${TARGET}
# run
cd $ROOT_DIR/bin/
echo "EXECUTABLE: $EXECUTABLE"
./${EXECUTABLE}