forked from ucla-vision/xivo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·110 lines (89 loc) · 2.14 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#!/bin/bash
# Build script of XIVO software.
# Author: Xiaohan Fei ([email protected])
# Basic usage: execute the script in terminal
# ./build.sh
# Options:
# 1) ros: build with ROS support
# 2) g2o: build with pose graph optimization from g2o library
# 3) gperf: use google performance profiling tools
# Example:
# ./build.sh ros g2o gperf
# parsing options
BUILD_ROSNODE=false
BUILD_G2O=false
USE_GPERFTOOLS=false
for arg in "$@"
do
if [ $arg == "ros" ]; then
BUILD_ROSNODE=true
fi
if [ $arg == "g2o" ]; then
BUILD_G2O=true
fi
if [ $arg == "gperf" ]; then
USE_GPERFTOOLS=true
fi
done
if [ $BUILD_ROSNODE = true ]; then
echo "BUILD WITH ROS SUPPORT"
fi
if [ $BUILD_G2O = true ]; then
echo "BUILD WITH G2O SUPPORT"
fi
if [ $USE_GPERFTOOLS = true ]; then
echo "USE GOOGLE PERFORMANCE TOOLS (GPERFTOOLS) FOR PROFILING"
fi
# build dependencies
PROJECT_DIR=$(pwd)
echo $PROJECT_DIR
cd $PROJECT_DIR/thirdparty/googletest
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=..
make install -j
cd $PROJECT_DIR/thirdparty/gflags
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=..
make install -j
cd $PROJECT_DIR/thirdparty/glog
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=..
make install -j
cd $PROJECT_DIR/thirdparty/eigen-3.3.7
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=..
make install -j
cd $PROJECT_DIR/thirdparty/Pangolin
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=..
make install -j
cd $PROJECT_DIR/thirdparty/jsoncpp
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=.. -DBUILD_SHARED_LIBS=TRUE
make install -j
# to build gperftools, need to install autoconf and libtool first
if [ $USE_GPERFTOOLS = true ]; then
sudo apt-get install autoconf libtool
cd $PROJECT_DIR/thirdparty/gperftools
./autogen.sh
./configure --prefix=$PROJECT_DIR/thirdparty/gperftools
make install
fi
if [ $BUILD_G2O = true ]; then
cd $PROJECT_DIR/thirdparty/g2o
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=../release
make install -j
fi
# build xivo
mkdir ${PROJECT_DIR}/build
cd ${PROJECT_DIR}/build
cmake .. -DBUILD_G2O=$BUILD_G2O -DBUILD_ROSNODE=$BUILD_ROSNODE -DUSE_GPERFTOOLS=$USE_GPERFTOOLS
make -j