-
Notifications
You must be signed in to change notification settings - Fork 54
/
build-nix.sh
executable file
·73 lines (56 loc) · 1.67 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#! /bin/bash -e
# Check that a valid build type has been specified.
if [ $# -ne 2 ] || ([ "$1" != "Unix Makefiles" ] && [ "$1" != "Ninja" ] && [ "$1" != "Eclipse CDT4 - Unix Makefiles" ] && [ "$1" != "Xcode" ]) || ([ $2 != "Debug" ] && [ $2 != "Release" ] && [ $2 != "RelWithDebInfo" ])
then
echo "Usage: build-nix.sh {Unix Makefiles|Ninja|Eclipse CDT4 - Unix Makefiles|Xcode} {Debug|Release|RelWithDebInfo}"
exit
fi
# Detect whether this is being run on Linux or Mac OS X.
PLATFORM=linux
if [ "$(uname)" == "Darwin" ]
then
PLATFORM=mac
fi
# Build/extract the libraries.
cd libraries
./build-boost_1_58_0-nix.sh
./build-lodepng-20160501-nix.sh
#./build-opencv-3.1.0-nix.sh
./extract-Eigen-3.2.2.sh
if [ $PLATFORM == "linux" ]
then
./build-glew-1.12.0-nix.sh
fi
if [ $PLATFORM == "mac" ]
then
./build-SDL2-2.0.3-nix.sh
else
./build-SDL2-2.0.7-nix.sh
fi
cd ..
# Set the source and build directories for spaint itself.
SOURCE_DIR=`pwd`
BUILD_DIR="$SOURCE_DIR/build"
if [ "$1" == "Eclipse CDT4 - Unix Makefiles" ]
then
# Eclipse doesn't like having the build directory inside the project: use a sibling directory instead.
BUILD_DIR="$SOURCE_DIR/../spaint-build"
fi
# Build spaint.
echo "[spaint] Building spaint in $BUILD_DIR"
if [ ! -d $BUILD_DIR ]
then
mkdir $BUILD_DIR
cd $BUILD_DIR
# Note: We need to configure twice to handle conditional building.
echo "[spaint] ...Configuring using CMake..."
cmake -G"$1" -DCMAKE_BUILD_TYPE=$2 $SOURCE_DIR
cmake $SOURCE_DIR
cd $SOURCE_DIR
fi
cd $BUILD_DIR
echo "[spaint] ...Running build..."
cmake --build . -- -j2
echo "[spaint] ...Installing..."
cmake --build . --target install
echo "[spaint] ...Finished building spaint."