forked from bumplzz69/openvslam
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
223 lines (212 loc) · 5.93 KB
/
Dockerfile
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
FROM ubuntu:18.04
# install dependencies via apt
RUN set -x && \
apt update -y -qq && \
apt upgrade -y -qq --no-install-recommends && \
: "basic dependencies" && \
apt install -y -qq \
build-essential \
pkg-config \
cmake \
git \
wget \
curl \
tar \
unzip && \
: "g2o dependencies" && \
apt install -y -qq \
libgoogle-glog-dev \
libatlas-base-dev \
libsuitesparse-dev && \
: "OpenCV dependencies" && \
apt install -y -qq \
libgtk-3-dev \
libjpeg-dev \
libpng++-dev \
libtiff-dev \
libopenexr-dev \
libwebp-dev \
ffmpeg \
libavcodec-dev \
libavformat-dev \
libavutil-dev \
libswscale-dev \
libavresample-dev && \
: "Pangolin dependencies" && \
apt install -y -qq \
libglew-dev && \
: "other dependencies" && \
apt install -y -qq \
libyaml-cpp-dev && \
: "remove cache" && \
apt autoremove -y -qq && \
rm -rf /var/lib/apt/lists/*
ARG CMAKE_INSTALL_PREFIX=/usr/local
ARG NUM_THREADS=4
ENV CPATH=${CMAKE_INSTALL_PREFIX}/include:${CPATH}
ENV C_INCLUDE_PATH=${CMAKE_INSTALL_PREFIX}/include:${C_INCLUDE_PATH}
ENV CPLUS_INCLUDE_PATH=${CMAKE_INSTALL_PREFIX}/include:${CPLUS_INCLUDE_PATH}
ENV LIBRARY_PATH=${CMAKE_INSTALL_PREFIX}/lib:${LIBRARY_PATH}
ENV LD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX}/lib:${LD_LIBRARY_PATH}
ENV NVIDIA_VISIBLE_DEVICES ${NVIDIA_VISIBLE_DEVICES:-all}
ENV NVIDIA_DRIVER_CAPABILITIES ${NVIDIA_DRIVER_CAPABILITIES:+$NVIDIA_DRIVER_CAPABILITIES,}graphics
# Eigen
ARG EIGEN3_VERSION=3.3.7
WORKDIR /tmp
RUN set -x && \
wget -q http://bitbucket.org/eigen/eigen/get/${EIGEN3_VERSION}.tar.bz2 && \
tar xf ${EIGEN3_VERSION}.tar.bz2 && \
rm -rf ${EIGEN3_VERSION}.tar.bz2 && \
mv eigen-eigen-* eigen-${EIGEN3_VERSION} && \
cd eigen-${EIGEN3_VERSION} && \
mkdir -p build && \
cd build && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} \
.. && \
make -j${NUM_THREADS} && \
make install && \
cd /tmp && \
rm -rf *
ENV Eigen3_DIR=${CMAKE_INSTALL_PREFIX}/share/eigen3/cmake
# g2o
ARG G2O_COMMIT=9b41a4ea5ade8e1250b9c1b279f3a9c098811b5a
WORKDIR /tmp
RUN set -x && \
git clone https://github.com/RainerKuemmerle/g2o.git && \
cd g2o && \
git checkout ${G2O_COMMIT} && \
mkdir -p build && \
cd build && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} \
-DBUILD_SHARED_LIBS=ON \
-DBUILD_UNITTESTS=OFF \
-DBUILD_WITH_MARCH_NATIVE=ON \
-DG2O_USE_CHOLMOD=ON \
-DG2O_USE_CSPARSE=ON \
-DG2O_USE_OPENGL=OFF \
-DG2O_USE_OPENMP=ON \
-DG2O_BUILD_APPS=OFF \
-DG2O_BUILD_EXAMPLES=OFF \
-DG2O_BUILD_LINKED_APPS=OFF \
.. && \
make -j${NUM_THREADS} && \
make install && \
cd /tmp && \
rm -rf *
ENV G2O_ROOT=${CMAKE_INSTALL_PREFIX}
# OpenCV
ARG OPENCV_VERSION=4.1.0
WORKDIR /tmp
RUN set -x && \
wget -q https://github.com/opencv/opencv/archive/${OPENCV_VERSION}.zip && \
unzip -q ${OPENCV_VERSION}.zip && \
rm -rf ${OPENCV_VERSION}.zip && \
cd opencv-${OPENCV_VERSION} && \
mkdir -p build && \
cd build && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} \
-DBUILD_DOCS=OFF \
-DBUILD_EXAMPLES=OFF \
-DBUILD_JASPER=OFF \
-DBUILD_OPENEXR=OFF \
-DBUILD_PERF_TESTS=OFF \
-DBUILD_TESTS=OFF \
-DBUILD_opencv_apps=OFF \
-DBUILD_opencv_dnn=OFF \
-DBUILD_opencv_ml=OFF \
-DBUILD_opencv_python_bindings_generator=OFF \
-DENABLE_CXX11=ON \
-DENABLE_FAST_MATH=ON \
-DWITH_EIGEN=ON \
-DWITH_FFMPEG=ON \
-DWITH_OPENMP=ON \
.. && \
make -j${NUM_THREADS} && \
make install && \
cd /tmp && \
rm -rf *
ENV OpenCV_DIR=${CMAKE_INSTALL_PREFIX}/share/OpenCV
# DBoW2
ARG DBOW2_COMMIT=687fcb74dd13717c46add667e3fbfa9828a7019f
WORKDIR /tmp
RUN set -x && \
git clone https://github.com/shinsumicco/DBoW2.git && \
cd DBoW2 && \
git checkout ${DBOW2_COMMIT} && \
mkdir -p build && \
cd build && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} \
.. && \
make -j${NUM_THREADS} && \
make install && \
cd /tmp && \
rm -rf *
ENV DBoW2_DIR=${CMAKE_INSTALL_PREFIX}/lib/cmake/DBoW2
# Pangolin
ARG PANGOLIN_COMMIT=ad8b5f83222291c51b4800d5a5873b0e90a0cf81
WORKDIR /tmp
RUN set -x && \
git clone https://github.com/stevenlovegrove/Pangolin.git && \
cd Pangolin && \
git checkout ${PANGOLIN_COMMIT} && \
sed -i -e "193,198d" ./src/utils/file_utils.cpp && \
mkdir -p build && \
cd build && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} \
-DBUILD_EXAMPLES=OFF \
-DBUILD_PANGOLIN_DEPTHSENSE=OFF \
-DBUILD_PANGOLIN_FFMPEG=OFF \
-DBUILD_PANGOLIN_LIBDC1394=OFF \
-DBUILD_PANGOLIN_LIBJPEG=OFF \
-DBUILD_PANGOLIN_LIBOPENEXR=OFF \
-DBUILD_PANGOLIN_LIBPNG=OFF \
-DBUILD_PANGOLIN_LIBREALSENSE=OFF \
-DBUILD_PANGOLIN_LIBREALSENSE2=OFF \
-DBUILD_PANGOLIN_LIBTIFF=OFF \
-DBUILD_PANGOLIN_LIBUVC=OFF \
-DBUILD_PANGOLIN_LZ4=OFF \
-DBUILD_PANGOLIN_OPENNI=OFF \
-DBUILD_PANGOLIN_OPENNI2=OFF \
-DBUILD_PANGOLIN_PLEORA=OFF \
-DBUILD_PANGOLIN_PYTHON=OFF \
-DBUILD_PANGOLIN_TELICAM=OFF \
-DBUILD_PANGOLIN_TOON=OFF \
-DBUILD_PANGOLIN_UVC_MEDIAFOUNDATION=OFF \
-DBUILD_PANGOLIN_V4L=OFF \
-DBUILD_PANGOLIN_VIDEO=OFF \
-DBUILD_PANGOLIN_ZSTD=OFF \
-DBUILD_PYPANGOLIN_MODULE=OFF \
.. && \
make -j${NUM_THREADS} && \
make install && \
cd /tmp && \
rm -rf *
ENV Pangolin_DIR=${CMAKE_INSTALL_PREFIX}/lib/cmake/Pangolin
# OpenVSLAM
COPY . /openvslam/
WORKDIR /openvslam/
RUN set -x && \
mkdir -p build && \
cd build && \
cmake \
-DBUILD_WITH_MARCH_NATIVE=ON \
-DUSE_PANGOLIN_VIEWER=ON \
-DUSE_STACK_TRACE_LOGGER=ON \
-DBOW_FRAMEWORK=DBoW2 \
-DBUILD_TESTS=OFF \
.. && \
make -j${NUM_THREADS} && \
rm -rf CMakeCache.txt CMakeFiles Makefile cmake_install.cmake example src && \
chmod -R 777 ./*
WORKDIR /openvslam/build/
ENTRYPOINT ["/bin/bash"]