-
Notifications
You must be signed in to change notification settings - Fork 120
/
build_arch.sh
executable file
·126 lines (106 loc) · 2.87 KB
/
build_arch.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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#!/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_G2O=false
USE_GPERFTOOLS=false
for arg in "$@"
do
if [ $arg == "g2o" ]; then
BUILD_G2O=true
fi
if [ $arg == "gperf" ]; then
USE_GPERFTOOLS=true
fi
done
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
CPU_COUNT=4
OPENCV_INSTALL_DIR=/home/stephanie/DevelopmentEnvironments/xivo/share/OpenCV
PYTHON_BINARY=/home/stephanie/PythonEnvs/xivo-py39env/bin/python
# build dependencies
PROJECT_DIR=$(pwd)
echo $PROJECT_DIR
cd $PROJECT_DIR/thirdparty/googletest
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=..
make install -j $CPU_COUNT
cd $PROJECT_DIR/thirdparty/DBoW2
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=.. -DOpenCV_DIR=$OPENCV_INSTALL_DIR
make install -j $CPU_COUNT
cd $PROJECT_DIR/thirdparty/eigen
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=.. -DOpenGL_GL_PREFERENCE=GLVND
make install -j $CPU_COUNT
cd $PROJECT_DIR/thirdparty/Pangolin
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=.. -DOpenGL_GL_PREFERENCE=GLVND
make install -j $CPU_COUNT
cd $PROJECT_DIR/thirdparty/jsoncpp
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=.. -DBUILD_SHARED_LIBS=TRUE
make install -j $CPU_COUNT
cd $PROJECT_DIR/thirdparty/ceres-solver
mkdir build
cd build
cmake .. \
-DCMAKE_INSTALL_PREFIX=.. \
-DEigen3_DIR=$PROJECT_DIR/thirdparty/eigen/share/eigen3/cmake
make install -j $CPU_COUNT
cd $PROJECT_DIR/thirdparty/pnp
mkdir build
cd build
cmake .. \
-DBUILD_PNP_MAIN=ON \
-DEigen3_DIR=$PROJECT_DIR/thirdparty/eigen/share/eigen3/cmake \
-DCeres_DIR=$PROJECT_DIR/thirdparty/ceres-solver/lib/cmake/Ceres \
-DCMAKE_INSTALL_PREFIX=..
make -j $CPU_COUNT
# to build gperftools, need to install autoconf and libtool first
if [ $USE_GPERFTOOLS = true ]; then
sudo pacman -S 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 \
-DEIGEN3_INCLUDE_DIR=../eigen \
-DOpenGL_GL_PREFERENCE=GLVND
make install -j $CPU_COUNT
fi
# build xivo
mkdir ${PROJECT_DIR}/build
cd ${PROJECT_DIR}/build
cmake .. \
-DBUILD_G2O=$BUILD_G2O \
-DUSE_GPERFTOOLS=$USE_GPERFTOOLS \
-DCMAKE_BUILD_TYPE=Debug \
-DOpenCV_DIR=$OPENCV_INSTALL_DIR \
-DPYTHON_EXECUTABLE=$PYTHON_BINARY \
-DCMAKE_CXX_STANDARD=17 \
-DCMAKE_EXE_LINKER_FLAGS=-lcblas
make -j $CPU_COUNT