forked from thejustinwalsh/libbulletml
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
executable file
·72 lines (62 loc) · 2.02 KB
/
setup.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
63
64
65
66
67
68
69
70
71
72
#!/usr/bin/env bash
pushd "$(dirname "$0")"
# Parse Arguments
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
--with-tests)
WITH_TESTS="--with-tests"
shift # past argument
;;
--force)
CLEAN="true"
shift # past argument
;;
*)
# unknown option
;;
esac
shift # past argument or value
done
# Install dependencies
if ! [ -z "$WITH_TESTS" ]; then
echo "Update test dependencies..."
git submodule update --init -- vendor/googletest
fi
# Create preamke working directory
[[ -d .premake ]] || mkdir .premake
pushd "./.premake"
# Remove existing premake archive
if [ -e premake.tar.gz ] && ! [ -z "$CLEAN"]; then
rm premake.tar.gz
fi
# Install premake
if ! [ -e premake.tar.gz ]; then
echo "Downloading premake binaries..."
if [ "$(uname)" == "Darwin" ]; then
curl -L -o premake.tar.gz https://github.com/premake/premake-core/releases/download/v5.0.0-beta2/premake-5.0.0-beta2-macosx.tar.gz
elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then
curl -L -o premake.tar.gz https://github.com/premake/premake-core/releases/download/v5.0.0-beta2/premake-5.0.0-beta2-linux.tar.gz
elif [ "$(expr substr $(uname -s) 1 10)" == "MINGW32_NT" ] || [ "$(expr substr $(uname -s) 1 10)" == "MINGW64_NT" ]; then
curl -L -o premake.zip https://github.com/premake/premake-core/releases/download/v5.0.0-beta2/premake-5.0.0-beta2-windows.zip
fi
echo "Extracting premake binaries..."
if [ -s premake.tar.gz ]; then
tar -xvzf premake.tar.gz
elif [ -s premake.zip ]; then
unzip premake.zip
else
echo "ERROR: premake archive does not exist"
fi
fi
# Run premake to generate our project
if [ "$(uname)" == "Darwin" ]; then
./premake5 --file=../premake.lua xcode4 $WITH_TESTS
elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then
./premake5 --file=../premake.lua gmake $WITH_TESTS
elif [ "$(expr substr $(uname -s) 1 10)" == "MINGW32_NT" ] || [ "$(expr substr $(uname -s) 1 10)" == "MINGW64_NT" ]; then
./premake5.exe --file=../premake.lua gmake $WITH_TESTS
fi
popd
popd