-
Notifications
You must be signed in to change notification settings - Fork 3
/
build-nix.sh
executable file
·51 lines (39 loc) · 1.04 KB
/
build-nix.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
#! /bin/bash -e
# Check that a valid build type has been specified.
if [ $# -ne 2 ] || ([ "$1" != "Ninja" ] && [ "$1" != "Unix Makefiles" ] && [ "$1" != "Xcode" ]) || ([ $2 != "Debug" ] && [ $2 != "Release" ])
then
echo "Usage: build-nix.sh {Ninja|Unix Makefiles|Xcode} {Debug|Release}"
exit
fi
# Detect whether this is being run on Linux or Mac OS X.
PLATFORM=linux
if [ "$(uname)" == "Darwin" ]
then
PLATFORM=mac
fi
# Build InfiniTAM itself.
echo "[InfiniTAM] Building InfiniTAM"
if [ ! -d build ]
then
mkdir build
cd build
echo "[InfiniTAM] ...Configuring using CMake..."
if [ "$1" == "Ninja" ] && [ $PLATFORM == "mac" ]
then
cmake -G"$1" -DCMAKE_BUILD_TYPE=$2 -DCMAKE_MAKE_PROGRAM="/usr/local/Cellar/ninja/1.7.2/bin/ninja" ..
else
cmake -G"$1" -DCMAKE_BUILD_TYPE=$2 ..
fi
# Note: We need to configure twice to handle conditional building.
cmake ..
cd ..
fi
cd build
echo "[InfiniTAM] ...Running build..."
if [ "$1" == "Ninja" ]
then
ninja
else
make -j2
fi
echo "[InfiniTAM] ...Finished building InfiniTAM."