forked from tum-vision/lsd_slam
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.sh
executable file
·47 lines (38 loc) · 913 Bytes
/
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
#!/bin/bash
# Thanks to https://gist.github.com/JamieMason/4761049
function program_is_installed {
# set to 1 initially
local return_=1
# set to 0 if not found
type $1 >/dev/null 2>&1 || { local return_=0; }
# return value
echo "$return_"
}
numberOfThreads=$(grep -c ^processor /proc/cpuinfo)
if [ $(program_is_installed ninja) == 1 ]; then
buildSystem="Ninja"
buildCommand=ninja
else
buildSystem="Unix Makefiles"
buildCommand=make
fi
if [ -d build ]; then
cd build
if [ ! -d Debug ]; then
mkdir Debug
fi
if [ ! -d Release ]; then
mkdir Release
fi
cd ..
else
mkdir build/Release build/Debug -p
fi
# Build Debug
cd build/Debug
cmake -G $buildSystem -DCMAKE_BUILD_TYPE=Debug ../..
$buildCommand -j $numberOfThreads
# Build Release
cd ../Release
cmake -G $buildSystem -DCMAKE_BUILD_TYPE=Release ../..
$buildCommand -j $numberOfThreads