-
Notifications
You must be signed in to change notification settings - Fork 24
/
build.sh
executable file
·32 lines (27 loc) · 1.25 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
CORES=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || sysctl -n hw.ncpu)
if [ "a$BUILDTYPE" == "a" ]; then
if [ `uname -s` == Linux ]; then
BUILDTYPE="Unix Makefiles"
elif [ `uname -s` == Darwin ]; then
BUILDTYPE=Xcode
elif [ `uname -o` == Msys ]; then
BUILDTYPE=VS
fi
fi
if [ "$BUILDTYPE" == "Unix Makefiles" ]; then
mkdir -p build
cd build
# Create 4 different makefiles (each in a separate directory)
mkdir release; cd release ; cmake -G "$BUILDTYPE" -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON ../.. ; cd ..
mkdir debug; cd debug ; cmake -G "$BUILDTYPE" -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=ON ../.. ; cd ..
mkdir release-static; cd release-static ; cmake -G "$BUILDTYPE" -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF ../.. ; cd ..
mkdir debug-static; cd debug-static ; cmake -G "$BUILDTYPE" -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=OFF ../.. ; cd ..
cd release ; make -j$CORES ; cd ..
cd debug ; make -j$CORES ; cd ..
cd release-static ; make -j$CORES ; cd ..
cd debug-static ; make -j$CORES ; cd ..
elif [ "$BUILDTYPE" == "Xcode" ]; then
cmake -G "$BUILDTYPE" -Bbuild -H.
elif [ "$BUILDTYPE" == "VS" ]; then
cmake -G "Visual Studio 14 2015" -Bbuild -H.
fi