-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
460 lines (414 loc) · 10.1 KB
/
CMakeLists.txt
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
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
cmake_minimum_required(VERSION 3.5)
set(CMAKE_CXX_FLAGS "-std=c++17 -fopenmp")
find_package(OpenMP REQUIRED)
if(OPENMP_FOUND)
message(STATUS "Compiling with OpenMP ${OpenMP_C_FLAGS}" )
endif(OPENMP_FOUND)
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -g -fopenmp") # -g -fsanitize=address
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
MESSAGE(${PROJECT_NAME} " Build type: " ${CMAKE_BUILD_TYPE})
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
add_subdirectory(src/floam)
add_subdirectory(src/orb_slam)
add_subdirectory(src/scancontext)
# g2o
set(g2o_DIR "/usr/local/lib")
set(NOMAD_LIB_DIRS
"/data/Pacakge/nomad/build/release/lib"
"/data/Pacakge/nomad/src")
set(NOMAD_INCLUDE_DIR "/data/Pacakge/nomad/build/release/include/nomad")
set(IGL_INCLUDE_DIR
"/data/Pacakge/libigl/include"
)
set(IGL_VIEWER_INCLUDE_DIR "/data/Pacakge/libigl/build/_deps/glfw-src/deps")
set(IGL_LIB_DIR "/data/Pacakge/libigl/build/lib")
set(GLOG_LIB /usr/local/lib/libglog.so)
set(YAML_CPP_LIB /usr/local/lib/libyaml-cpp.so)
link_libraries(${YAML_CPP_LIB})
include_directories(${G2O_INCLUDE_DIRS} "/usr/include/eigen3")
link_directories(${g2o_DIR} ${NOMAD_LIB_DIRS} ${IGL_LIB_DIR})
# OpenCV
find_package(OpenCV 4 REQUIRED)
# Eigen3
find_package(Eigen3)
if(NOT EIGEN3_FOUND)
# Fallback to cmake_modules
find_package(cmake_modules REQUIRED)
find_package(Eigen REQUIRED)
set(EIGEN3_INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS})
set(EIGEN3_LIBRARIES ${EIGEN_LIBRARIES}) # Not strictly necessary as Eigen is head only
# Possibly map additional variables to the EIGEN3_ prefix.
else()
set(EIGEN3_INCLUDE_DIRS ${EIGEN3_INCLUDE_DIR})
endif()
find_package(PCL REQUIRED)
find_package(Ceres REQUIRED)
find_package(Pangolin REQUIRED)
find_package(GTSAM REQUIRED QUIET)
find_package(Open3D HINTS REQUIRD)
list(APPEND Open3D_LIBRARIES dl)
if (Open3D_FOUND)
message(STATUS "Found Open3D ${Open3D_VERSION}")
link_directories(${Open3D_LIBRARY_DIRS})
endif()
include_directories(
include
${PROJECT_SOURCE_DIR}/include
${PROJECT_SOURCE_DIR}/src
)
set(G2O_LIBS
g2o_csparse_extension
g2o_core
g2o_solver_cholmod
g2o_solver_csparse
g2o_solver_dense
g2o_solver_pcg
g2o_stuff
g2o_types_icp
g2o_types_sba
g2o_types_sim3
g2o_types_slam2d
g2o_types_slam3d)
set(NOMAD_LIBS
nomadAlgos
nomadUtils
nomadEval
)
set(IO_LIBS
${OpenCV_LIBS}
${PCL_LIBRARIES}
)
set(GMP_LIB /usr/lib/x86_64-linux-gnu/libgmp.so)
set(IGL_LIBS
CoMISo
glad
glfw3
igl
igl_copyleft_cgal
igl_copyleft_comiso
igl_copyleft_core
igl_copyleft_tetgen
igl_embree
igl_glfw
igl_imgui
igl_opengl
igl_png
igl_predicates
igl_restricted_triangle
igl_xml
imgui
imguizmo
predicates
stb
tetgen
tinyxml2
triangle
${GMP_LIB}
)
add_executable(ba_demo src/ba_demo.cpp)
target_link_libraries(ba_demo ${OpenCV_LIBS} ${G2O_LIBS})
add_executable(ba_demo_data src/ba_demo_data.cpp)
target_link_libraries(ba_demo_data
${OpenCV_LIBS}
${G2O_LIBS}
${GLOG_LIB} # ??
)
add_library(backend SHARED src/backend_opt.cpp)
add_dependencies(backend scancontext)
target_link_libraries(backend
${OpenCV_LIBS}
${PCL_LIBRARIES}
scancontext
gtsam
${Open3D_LIBRARIES}
)
target_include_directories(backend PRIVATE
include
${PCL_INCLUDE_DIRS}
${GTSAM_INCLUDE_DIR}
)
set(ORB_INCLUDE_DIRS
${PROJECT_SOURCE_DIR}/src/orb_slam
)
set(ORB_LIBARIES
${OpenCV_LIBS}
${EIGEN3_LIBS}
${Pangolin_LIBRARIES}
${G2O_LIBS}
${PROJECT_SOURCE_DIR}/lib/libORB_SLAM2.so
${GLOG_LIB} # ??
)
set(FLOAM_LIBRARIES
${PROJECT_SOURCE_DIR}/lib/libfloam.so
${PCL_LIBRARIES}
)
add_executable(floam_run src/examples/floam_kitti.cpp)
add_dependencies(floam_run floam)
target_link_libraries(floam_run
${FLOAM_LIBRARIES}
)
add_executable(floam_backend
src/examples/floam_backend.cpp
)
add_dependencies(floam_backend backend)
target_link_libraries(floam_backend
backend
)
add_executable(orb_run src/examples/orb_kitti.cpp)
add_dependencies(orb_run ORB_SLAM2)
target_link_libraries(orb_run
${ORB_LIBARIES}
)
target_include_directories(orb_run PRIVATE
${ORB_INCLUDE_DIRS}
)
add_executable(orb_store src/examples/orb_kitti_store.cpp)
add_dependencies(orb_store ORB_SLAM2)
target_link_libraries(orb_store
${ORB_LIBARIES}
${PCL_LIBRARIES}
)
target_include_directories(orb_store PRIVATE
${ORB_INCLUDE_DIRS}
)
add_executable(orb_restore src/examples/orb_restore.cpp)
add_dependencies(orb_restore ORB_SLAM2)
target_link_libraries(orb_restore
${ORB_LIBARIES}
)
target_include_directories(orb_restore PRIVATE
${ORB_INCLUDE_DIRS}
)
add_executable(orb_save_map src/examples/orb_save_map.cpp)
add_dependencies(orb_save_map ORB_SLAM2)
target_link_libraries(orb_save_map
${ORB_LIBARIES}
${Open3D_LIBRARIES}
)
target_include_directories(orb_save_map PRIVATE
${ORB_INCLUDE_DIRS}
)
# add_executable(kitti_union src/examples/union_kitti.cpp)
# add_dependencies(kitti_union floam ORB_SLAM2)
# target_link_libraries(kitti_union
# ${FLOAM_LIBRARIES}
# ${ORB_LIBARIES}
# )
# target_include_directories(kitti_union PRIVATE
# include
# ${ORB_INCLUDE_DIRS}
# )
add_executable(ba_calib src/examples/ba_calib.cpp)
add_dependencies(ba_calib floam ORB_SLAM2)
target_link_libraries(ba_calib
${ORB_LIBARIES}
)
add_executable(he_calib src/examples/he_calib.cpp)
target_link_libraries(
he_calib
${EIGEN3_LIBS}
${G2O_LIBS}
${GLOG_LIB}
)
add_executable(icp_calib src/examples/icp_calib.cpp)
target_link_libraries(icp_calib
${Open3D_LIBRARIES}
)
# add_executable(iba_calib_test src/examples/iba_calib_test.cpp)
# add_dependencies(iba_calib_test ORB_SLAM2)
# target_link_libraries(iba_calib_test
# ${ORB_LIBARIES}
# ${PCL_LIBRARIES}
# ${G2O_LIBS}
# ${GLOG_LIB}
# )
# target_include_directories(iba_calib_test PRIVATE
# ${ORB_INCLUDE_DIRS}
# )
# add_executable(iba_calib_plane src/examples/iba_calib_plane.cpp)
# add_dependencies(iba_calib_plane ORB_SLAM2)
# target_link_libraries(iba_calib_plane
# ${ORB_LIBARIES}
# ${PCL_LIBRARIES}
# ${G2O_LIBS}
# ${GLOG_LIB}
# )
# target_include_directories(iba_calib_plane PRIVATE
# ${ORB_INCLUDE_DIRS}
# )
# add_executable(iba_calib_plane2 src/examples/iba_calib_plane2.cpp)
# add_dependencies(iba_calib_plane2 ORB_SLAM2)
# target_link_libraries(iba_calib_plane2
# ${ORB_LIBARIES}
# ${PCL_LIBRARIES}
# ${G2O_LIBS}
# ${GLOG_LIB}
# ${CERES_LIBRARIES}
# )
# target_include_directories(iba_calib_plane2 PRIVATE
# ${ORB_INCLUDE_DIRS}
# ${CERES_INCLUDE_DIRS}
# )
# add_executable(iba_calib_gpr2 src/examples/iba_calib_gpr2.cpp)
# add_dependencies(iba_calib_gpr2 ORB_SLAM2)
# target_link_libraries(iba_calib_gpr2
# ${ORB_LIBARIES}
# ${PCL_LIBRARIES}
# ${G2O_LIBS}
# ${GLOG_LIB}
# ${CERES_LIBRARIES}
# )
# target_include_directories(iba_calib_gpr2 PRIVATE
# ${ORB_INCLUDE_DIRS}
# ${CERES_INCLUDE_DIRS}
# )
# add_executable(iba_calib3d_gpr src/examples/iba_calib3d_gpr.cpp)
# add_dependencies(iba_calib3d_gpr ORB_SLAM2)
# target_link_libraries(iba_calib3d_gpr
# ${ORB_LIBARIES}
# ${PCL_LIBRARIES}
# ${G2O_LIBS}
# ${GLOG_LIB}
# ${CERES_LIBRARIES}
# )
# target_include_directories(iba_calib3d_gpr PRIVATE
# ${ORB_INCLUDE_DIRS}
# ${CERES_INCLUDE_DIRS}
# )
# add_executable(iba_calib3dq_gpr src/examples/iba_calib3dq_gpr.cpp)
# add_dependencies(iba_calib3dq_gpr ORB_SLAM2)
# target_link_libraries(iba_calib3dq_gpr
# ${ORB_LIBARIES}
# ${PCL_LIBRARIES}
# ${G2O_LIBS}
# ${GLOG_LIB}
# ${CERES_LIBRARIES}
# ${Open3D_LIBRARIES}
# ${IGL_LIBS}
# )
# target_include_directories(iba_calib3dq_gpr PRIVATE
# ${ORB_INCLUDE_DIRS}
# ${CERES_INCLUDE_DIRS}
# ${IGL_INCLUDE_DIR}
# )
# add_executable(uiba_local src/examples/uiba_local.cpp)
# add_dependencies(uiba_local ORB_SLAM2)
# target_link_libraries(uiba_local
# ${ORB_LIBARIES}
# ${PCL_LIBRARIES}
# ${G2O_LIBS}
# ${GLOG_LIB}
# ${CERES_LIBRARIES}
# )
# target_include_directories(uiba_local PRIVATE
# ${ORB_INCLUDE_DIRS}
# ${CERES_INCLUDE_DIRS}
# )
add_executable(iba_local src/examples/iba_local.cpp)
add_dependencies(iba_local ORB_SLAM2)
target_link_libraries(iba_local
${ORB_LIBARIES}
${PCL_LIBRARIES}
${G2O_LIBS}
${GLOG_LIB}
${CERES_LIBRARIES}
)
target_include_directories(iba_local PRIVATE
${ORB_INCLUDE_DIRS}
${CERES_INCLUDE_DIRS}
)
add_executable(iba_global src/examples/iba_global.cpp)
add_dependencies(iba_global ORB_SLAM2)
target_link_libraries(iba_global
${ORB_LIBARIES}
${PCL_LIBRARIES}
${G2O_LIBS}
${GLOG_LIB}
${NOMAD_LIBS}
)
target_include_directories(iba_global PRIVATE
${ORB_INCLUDE_DIRS}
${NOMAD_INCLUDE_DIR}
)
add_executable(iba_func src/examples/iba_func.cpp)
add_dependencies(iba_func ORB_SLAM2)
target_link_libraries(iba_func
${ORB_LIBARIES}
${PCL_LIBRARIES}
${G2O_LIBS}
${GLOG_LIB}
)
target_include_directories(iba_func PRIVATE
${ORB_INCLUDE_DIRS}
)
# add_executable(iba_global_bias src/examples/iba_global_bias.cpp)
# add_dependencies(iba_global_bias ORB_SLAM2)
# target_link_libraries(iba_global_bias
# ${ORB_LIBARIES}
# ${PCL_LIBRARIES}
# ${G2O_LIBS}
# ${GLOG_LIB}
# ${NOMAD_LIBS}
# )
# target_include_directories(iba_global_bias PRIVATE
# ${ORB_INCLUDE_DIRS}
# ${NOMAD_INCLUDE_DIR}
# )
# add_executable(iba_global_split src/examples/iba_global_split.cpp)
# add_dependencies(iba_global_split ORB_SLAM2)
# target_link_libraries(iba_global_split
# ${ORB_LIBARIES}
# ${PCL_LIBRARIES}
# ${G2O_LIBS}
# ${GLOG_LIB}
# ${NOMAD_LIBS}
# )
# target_include_directories(iba_global_split PRIVATE
# ${ORB_INCLUDE_DIRS}
# ${NOMAD_INCLUDE_DIR}
# )
# add_executable(uiba_calib_gpr src/examples/uiba_calib_gpr.cpp)
# add_dependencies(uiba_calib_gpr ORB_SLAM2)
# target_link_libraries(uiba_calib_gpr
# ${ORB_LIBARIES}
# ${PCL_LIBRARIES}
# ${G2O_LIBS}
# ${GLOG_LIB}
# ${CERES_LIBRARIES}
# )
# target_include_directories(uiba_calib_gpr PRIVATE
# ${ORB_INCLUDE_DIRS}
# ${CERES_INCLUDE_DIRS}
# ${IGL_INCLUDE_DIR}
# ${IGL_VIEWER_INCLUDE_DIR}
# )
# add_executable(uiba_calib_plane src/examples/uiba_calib_plane.cpp)
# add_dependencies(uiba_calib_plane ORB_SLAM2)
# target_link_libraries(uiba_calib_plane
# ${ORB_LIBARIES}
# ${PCL_LIBRARIES}
# ${G2O_LIBS}
# ${GLOG_LIB}
# ${CERES_LIBRARIES}
# )
# target_include_directories(uiba_calib_plane PRIVATE
# ${ORB_INCLUDE_DIRS}
# ${CERES_INCLUDE_DIRS}
# )
# add_executable(test_gpr src/test/test_gpr.cpp)
# target_link_libraries(test_gpr
# ${GLOG_LIB}
# ${CERES_LIBRARIES}
# )
# add_executable(test_igl src/test/test_igl.cpp)
# target_link_libraries(test_igl
# ${IO_LIBS}
# ${Open3D_LIBRARIES}
# ${IGL_LIBS}
# )
# target_include_directories(test_igl PRIVATE
# ${IGL_INCLUDE_DIR}
# ${IGL_VIEWER_INCLUDE_DIR}
# )