-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.sh
executable file
·57 lines (48 loc) · 1.44 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
# Parse command line arguments.
CleanBuild=dontclean
BuildConfiguration=none
for var in "$@"
do
if [[ $var =~ ^(Debug|Release|wxDebug|wxRelease)$ ]]; then
BuildConfiguration=$var;
fi
if [[ $var = clean ]]; then
CleanBuild=clean;
fi
done
# Exit if a valid build config wasn't specified.
if [[ ! $BuildConfiguration =~ ^(Debug|Release|wxDebug|wxRelease)$ ]]; then
echo "Specify a build configuration: Debug, Release, wxDebug, wxRelease"
echo "add 'clean' to clean that configuration"
exit 2
fi
# Clean and exit.
if [[ $CleanBuild == clean ]]; then
echo "$(tput setaf 5)==> Cleaning MyFramework$(tput sgr0)"
rm -r build/$BuildConfiguration
exit 1
fi
# Build bullet3. Clean must be done manually.
if [ ! -d "Libraries/bullet3/bin" ]; then
echo "$(tput setaf 5)==> Building Bullet3... this could take a while$(tput sgr0)"
pushd Libraries/bullet3/build3 > /dev/null
./premake4_linux64 gmake --double
cd gmake
make
popd > /dev/null
fi
# Build MyEngine.
let NumJobs=$(nproc)*2
echo "$(tput setaf 2)==> Building MyEngine (make -j$NumJobs)$(tput sgr0)"
if [ ! -d "build" ]; then
mkdir build
fi
if [ ! -d build/$BuildConfiguration ]; then
mkdir build/$BuildConfiguration
pushd build/$BuildConfiguration > /dev/null
cmake -DCMAKE_BUILD_TYPE=$BuildConfiguration ../..
popd > /dev/null
fi
pushd build/$BuildConfiguration > /dev/null
make -j$NumJobs
popd > /dev/null