forked from ethz-asl/okvis
-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
492 lines (448 loc) · 18.2 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
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
cmake_minimum_required(VERSION 3.0.00)
project(okvis)
# The version number.
set(OKVIS_MAJOR_VERSION 1)
set(OKVIS_MINOR_VERSION 1)
set(OKVIS_PATCH_VERSION 3)
set(OKVIS_VERSION
${OKVIS_MAJOR_VERSION}.${OKVIS_MINOR_VERSION}.${OKVIS_PATCH_VERSION})
# options for build configuration
option (USE_SYSTEM_BRISK
"Use brisk via find_package rather than downloading it as part of okvis" OFF)
option (USE_SYSTEM_CERES
"Use ceres via find_package rather than downloading it as part of okvis" ON)
option (BUILD_APPS
"Builds a demo app (which requires boost)" ON)
option (BUILD_TESTS
"Builds all gtests" OFF)
option (DO_TIMING
"Enable timing" OFF)
SET(N_CORES 3 CACHE STRING "Using N number of cores for parallel compilation")
add_definitions(-DOKVIS_N_CORES=${N_CORES})
# could manually switch on timing here
if(NOT DO_TIMING)
add_definitions(-DDEACTIVATE_TIMERS)
message(STATUS "Deactivating timers.")
endif()
# Offer the user the choice of overriding the installation directories
set(INSTALL_LIB_DIR lib CACHE PATH "Installation directory for libraries")
set(INSTALL_BIN_DIR bin CACHE PATH "Installation directory for executables")
set(INSTALL_INCLUDE_DIR include CACHE PATH
"Installation directory for header files")
if(WIN32 AND NOT CYGWIN)
set(DEF_INSTALL_CMAKE_DIR CMake)
else()
set(DEF_INSTALL_CMAKE_DIR lib/CMake/okvis)
endif()
set(INSTALL_CMAKE_DIR ${DEF_INSTALL_CMAKE_DIR} CACHE PATH
"Installation directory for CMake files")
# Make relative paths absolute (needed later on)
foreach(p LIB BIN INCLUDE CMAKE)
set(var INSTALL_${p}_DIR)
if(NOT IS_ABSOLUTE "${${var}}")
set(${var} "${CMAKE_INSTALL_PREFIX}/${${var}}")
endif()
endforeach()
# make sure we use Release and warn otherwise
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to 'Release' as none was specified.")
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release"
"MinSizeRel" "RelWithDebInfo")
endif()
if (NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Release")
message(WARNING "CMAKE_BUILD_TYPE not set to 'Release'. Performance may be terrible.")
else()
message(STATUS "Building with build type '${CMAKE_BUILD_TYPE}'")
endif()
if(APPLE)
# The clang compiler (on osx) is somehow much more strict
# than the compilers on ubuntu and so this does not seem
# possible on OSX just yet.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fPIC")
set(CMAKE_CXX_FLAGS_EXTERNAL_PROJECTS "${CMAKE_CXX_FLAGS} -Wall -fPIC")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fPIC")
set(CMAKE_CXX_FLAGS_EXTERNAL_PROJECTS "${CMAKE_CXX_FLAGS} -Wall -fPIC")
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wpedantic -Wextra -Werror") # use for code cleaning
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wpedantic -Wextra")
endif()
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
if(${CMAKE_HOST_SYSTEM_PROCESSOR} MATCHES "arm*")
message(STATUS "ARM processor detected, will attempt to use NEON.")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpu=neon")
else()
message(STATUS "Assuming SSE instructions available.")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mssse3")
endif()
get_directory_property(defs COMPILE_DEFINITIONS)
# EXTERNAL DEPENDENCIES
include(ExternalProject)
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
include_directories(${CMAKE_BINARY_DIR}/include)
link_directories(${CMAKE_BINARY_DIR}/lib)
# require Eigen
find_package( Eigen REQUIRED )
include_directories(${EIGEN_INCLUDE_DIR})
# require OpenCV
find_package( OpenCV REQUIRED )
include_directories(BEFORE ${OpenCV_INCLUDE_DIRS})
# libvisensor
find_package(VISensor)
if(VISENSORDRIVER_FOUND)
add_definitions(-DHAVE_LIBVISENSOR)
set(LIBVISENSOR TRUE)
message(STATUS "Found libvisensor. Setting HAVE_LIBVISENSOR flag.")
include_directories(${VISensorDriver_INCLUDE_DIR})
# install find script
install(FILES ${PROJECT_SOURCE_DIR}/cmake/FindVISensor.cmake
DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/CMake)
else()
message(STATUS "libvisensor not found")
endif()
find_package(glog REQUIRED)
include_directories(BEFORE ${GLOG_INCLUDE_DIRS})
# brisk
if(${USE_SYSTEM_BRISK})
find_package( brisk 2 REQUIRED )
include_directories(BEFORE ${BRISK_INCLUDE_DIRS})
message(STATUS "Using system brisk. Found at ${BRISK_INCLUDE_DIRS}.")
else()
ExternalProject_Add(brisk_external
URL "https://www.doc.ic.ac.uk/~sleutene/software/brisk-experimental2.zip"
UPDATE_COMMAND ""
INSTALL_DIR ${CMAKE_BINARY_DIR}
CMAKE_ARGS
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS_EXTERNAL_PROJECTS}
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/brisk
BUILD_IN_SOURCE 0
BUILD_COMMAND make -j${N_CORES}
INSTALL_COMMAND make install
)
add_library(brisk STATIC IMPORTED)
add_library(agast STATIC IMPORTED)
set(BRISK_LIBRARIES brisk agast)
set_target_properties(brisk PROPERTIES IMPORTED_LOCATION ${CMAKE_BINARY_DIR}/lib/libbrisk.a)
set_target_properties(agast PROPERTIES IMPORTED_LOCATION ${CMAKE_BINARY_DIR}/lib/libagast.a)
add_dependencies(brisk brisk_external)
add_dependencies(agast brisk_external)
# install it once built
install(FILES ${CMAKE_BINARY_DIR}/lib/libbrisk.a ${CMAKE_BINARY_DIR}/lib/libagast.a
DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
install(DIRECTORY ${CMAKE_BINARY_DIR}/include/brisk/
DESTINATION ${CMAKE_INSTALL_PREFIX}/include/brisk/)
install(DIRECTORY ${CMAKE_BINARY_DIR}/lib/CMake/brisk/
DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/CMake/brisk/)
endif()
# Find OpenMP
if(APPLE)
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
set(OpenMP_C "${CMAKE_C_COMPILER}")
set(OpenMP_C_LIB_NAMES "/usr/local/opt/libomp/lib/libomp.dylib")
set(OpenMP_libomp_LIBRARY ${OpenMP_C_LIB_NAMES})
set(OpenMP_libgomp_LIBRARY ${OpenMP_C_LIB_NAMES})
set(OpenMP_libiomp5_LIBRARY ${OpenMP_C_LIB_NAMES})
set(OpenMP_LIBRARY ${OpenMP_C_LIB_NAMES})
endif()
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(OpenMP_CXX "${CMAKE_CXX_COMPILER}")
set(OpenMP_CXX_LIB_NAMES "/usr/local/opt/libomp/lib/libomp.dylib")
set(OpenMP_libomp_LIBRARY ${OpenMP_CXX_LIB_NAMES})
set(OpenMP_libgomp_LIBRARY ${OpenMP_CXX_LIB_NAMES})
set(OpenMP_libiomp5_LIBRARY ${OpenMP_CXX_LIB_NAMES})
set(OpenMP_LIBRARY ${OpenMP_CXX_LIB_NAMES})
endif()
set(OpenMP_FOUND TRUE)
else()
find_package(OpenMP REQUIRED)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS_EXTERNAL_PROJECTS "${CMAKE_CXX_FLAGS_EXTERNAL_PROJECTS} ${OpenMP_CXX_FLAGS}")
endif()
# ceres
find_package(SuiteSparse REQUIRED QUIET) #will be needed in any case...
find_package(CXSparse QUIET) #optional
if (OpenMP_FOUND)
message(STATUS "OpenMP found")
add_definitions(-DUSE_OPENMP)
else ()
message(STATUS "OpenMP NOT found")
endif ()
if(${USE_SYSTEM_CERES})
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
find_package(Ceres 2.0 REQUIRED )
include_directories(BEFORE ${CERES_INCLUDE_DIRS})
message(STATUS "Using system Ceres at ${CERES_INCLUDE_DIRS}.")
else()
set(CERES_VERSION 2.1.0)
set(CERES_TAG f68321e7de8929fbcdb95dd42877531e64f72f66) # a commit between 1.14 and 2.0.
if(APPLE)
ExternalProject_Add(ceres_external
GIT_REPOSITORY https://github.com/ceres-solver/ceres-solver.git
GIT_TAG ${CERES_TAG}
UPDATE_COMMAND ""
INSTALL_DIR ${CMAKE_BINARY_DIR}
CMAKE_ARGS
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS_EXTERNAL_PROJECTS}
-DBUILD_EXAMPLES:BOOL=OFF
-DBUILD_TESTING:BOOL=OFF
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/ceres
BUILD_IN_SOURCE 0
BUILD_COMMAND make -j${N_CORES}
INSTALL_COMMAND make install
)
else()
ExternalProject_Add(ceres_external
GIT_REPOSITORY https://ceres-solver.googlesource.com/ceres-solver
GIT_TAG ${CERES_TAG}
UPDATE_COMMAND ""
INSTALL_DIR ${CMAKE_BINARY_DIR}
CMAKE_ARGS
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS_EXTERNAL_PROJECTS}
-DBUILD_EXAMPLES:BOOL=OFF
-DBUILD_TESTING:BOOL=OFF
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/ceres
BUILD_IN_SOURCE 0
BUILD_COMMAND make -j${N_CORES}
INSTALL_COMMAND make install
)
endif()
add_library(ceres UNKNOWN IMPORTED)
# Heuristic for determining LIB_SUFFIX from ceres
set(CERES_LIB_PREFIX "lib")
if (CMAKE_SYSTEM_NAME MATCHES "Linux" AND
NOT DEFINED LIB_SUFFIX AND
NOT CMAKE_CROSSCOMPILING AND
CMAKE_SIZEOF_VOID_P EQUAL "8" AND
NOT EXISTS "/etc/debian_version" AND
NOT EXISTS "/etc/arch-release")
set(CERES_LIB_PREFIX "lib64")
endif ()
# to find it from 3rd party software, since not added to registry:
set(OKVIS_CERES_CONFIG "${CMAKE_BINARY_DIR}/share/Ceres/")
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
set_property(TARGET ceres PROPERTY IMPORTED_LOCATION
${CMAKE_BINARY_DIR}/${CERES_LIB_PREFIX}/libceres-debug.a )
else ()
set_property(TARGET ceres PROPERTY IMPORTED_LOCATION
${CMAKE_BINARY_DIR}/${CERES_LIB_PREFIX}/libceres.a )
endif ()
if(${OpenMP_FOUND})
set(CERES_LIBRARIES ceres ${OpenMP_LIBRARY} ${SUITESPARSE_LIBRARIES} ${CXSPARSE_LIBRARIES} ${Eigen_LIBS} ${GLOG_LIBRARY}) #ceres won't export these
else()
set(CERES_LIBRARIES ceres ${SUITESPARSE_LIBRARIES} ${CXSPARSE_LIBRARIES} ${Eigen_LIBS} ${GLOG_LIBRARY}) #ceres won't export these
endif()
add_dependencies(ceres ceres_external)
# install it once built
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
install(FILES ${CMAKE_BINARY_DIR}/${CERES_LIB_PREFIX}/libceres-debug.a
DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
else ()
install(FILES ${CMAKE_BINARY_DIR}/${CERES_LIB_PREFIX}/libceres.a
DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
endif()
install(DIRECTORY ${CMAKE_BINARY_DIR}/include/ceres/
DESTINATION ${CMAKE_INSTALL_PREFIX}/include/ceres/)
install(DIRECTORY ${CMAKE_BINARY_DIR}/lib/cmake/Ceres/
DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/cmake/Ceres/)
endif()
# OpenGV
set(CMAKE_CXX_FLAGS_WSUPPRESS
"${CMAKE_CXX_FLAGS_EXTERNAL_PROJECTS} -Wno-unused-parameter -Wno-maybe-uninitialized -Wno-sign-compare -Wno-unused-but-set-variable -Wno-unused-variable -Wno-pedantic")
message(STATUS "NOTE: Suppressing some warnings when compiling OpenGV.")
ExternalProject_Add(opengv_external
GIT_REPOSITORY https://github.com/laurentkneip/opengv
GIT_TAG 306a54e6c6b94e2048f820cdf77ef5281d4b48ad
UPDATE_COMMAND ""
PATCH_COMMAND # forcing static libs
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/cmake/opengv/CMakeLists.txt ${CMAKE_CURRENT_BINARY_DIR}/opengv/src/opengv/CMakeLists.txt
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/cmake/opengv/opengvConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/opengv/src/opengv/opengvConfig.cmake.in
COMMENT "Forcing our own CMakeLists.txt to build OpenGV (static library support)."
CMAKE_ARGS
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS_EXTERNAL_PROJECTS} # suppress warnings...
#-DBUILD_TESTS:BOOL=OFF
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/opengv
SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/opengv/src/opengv
INSTALL_DIR ${CMAKE_BINARY_DIR}
BUILD_IN_SOURCE 0
BUILD_COMMAND make
INSTALL_COMMAND make install
)
add_library(opengv STATIC IMPORTED)
set(OpenGV_LIBRARIES opengv)
set_target_properties(opengv PROPERTIES IMPORTED_LOCATION ${CMAKE_BINARY_DIR}/lib/libopengv.a)
add_dependencies(${OpenGV_LIBRARIES} opengv_external)
# install it once built
install(FILES ${CMAKE_BINARY_DIR}/lib/libopengv.a
DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
install(DIRECTORY ${CMAKE_BINARY_DIR}/include/opengv/
DESTINATION ${CMAKE_INSTALL_PREFIX}/include/opengv/)
install(DIRECTORY ${CMAKE_BINARY_DIR}/lib/CMake/opengv/
DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/CMake/opengv/)
# the absolute path to the target template image
set(OKVIS_TARGET_IMAGE_PATH \"${PROJECT_SOURCE_DIR}/config\")
add_definitions(-DOKVIS_TARGET_IMAGE_PATH=${OKVIS_TARGET_IMAGE_PATH})
if(${BUILD_TESTS})
# gmock
# http://stackoverflow.com/questions/9689183/cmake-googletest
ExternalProject_Add(
googlemock
URL https://github.com/google/googletest/archive/release-1.8.0.zip
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/gmock
CMAKE_ARGS
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS_EXTERNAL_PROJECTS}
-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
BUILD_COMMAND make -j7
INSTALL_COMMAND ""
)
ExternalProject_Get_Property(googlemock source_dir)
set(GMOCK_INCLUDE_DIR ${source_dir}/googlemock/include)
set(GTEST_INCLUDE_DIR ${source_dir}/googletest/include)
include_directories(BEFORE ${GMOCK_INCLUDE_DIR})
include_directories(BEFORE ${GTEST_INCLUDE_DIR})
ExternalProject_Get_Property(googlemock binary_dir)
set(GMOCK_LIBRARY_PATH ${binary_dir}/googlemock/${CMAKE_FIND_LIBRARY_PREFIXES}gmock.a)
set(GMOCK_LIBRARY gmock)
add_library(${GMOCK_LIBRARY} UNKNOWN IMPORTED)
set_property(TARGET ${GMOCK_LIBRARY} PROPERTY IMPORTED_LOCATION
${GMOCK_LIBRARY_PATH} )
add_dependencies(${GMOCK_LIBRARY} googlemock)
set(GTEST_LIBRARY_PATH ${binary_dir}/googlemock/gtest/${CMAKE_FIND_LIBRARY_PREFIXES}gtest.a)
set(GTEST_LIBRARY gtestlocal)
add_library(${GTEST_LIBRARY} UNKNOWN IMPORTED)
set_property(TARGET ${GTEST_LIBRARY} PROPERTY IMPORTED_LOCATION
${GTEST_LIBRARY_PATH})
add_dependencies(${GTEST_LIBRARY} googlemock)
endif()
# BUILD LOCAL DEPENDENCIES
include_directories(okvis_util/include)
add_subdirectory(okvis_util)
include_directories(okvis_kinematics/include)
add_subdirectory(okvis_kinematics)
add_dependencies(okvis_kinematics okvis_util)
include_directories(okvis_time/include)
add_subdirectory(okvis_time)
add_dependencies(okvis_time okvis_util)
include_directories(okvis_cv/include)
add_subdirectory(okvis_cv)
add_dependencies(okvis_cv brisk okvis_util)
include_directories(okvis_common/include)
add_subdirectory(okvis_common)
include_directories(okvis_timing/include)
add_subdirectory(okvis_timing)
include_directories(loop_closure/include)
add_subdirectory(loop_closure)
include_directories(okvis_ceres/include)
add_subdirectory(okvis_ceres)
add_dependencies(okvis_ceres ceres okvis_util)
include_directories(okvis_matcher/include)
add_subdirectory(okvis_matcher)
add_dependencies(okvis_matcher okvis_util)
include_directories(okvis_frontend/include)
add_subdirectory(okvis_frontend)
add_dependencies(okvis_frontend opengv okvis_util)
include_directories(okvis_multisensor_processing/include)
add_subdirectory(okvis_multisensor_processing)
add_dependencies(okvis_multisensor_processing okvis_util)
# also build the apps
if(BUILD_APPS)
FIND_PACKAGE(Boost COMPONENTS filesystem system REQUIRED)
include_directories(${Boost_INCLUDE_DIRS})
add_executable(okvis_app_synchronous okvis_apps/src/okvis_app_synchronous.cpp)
target_link_libraries(okvis_app_synchronous
okvis_util
okvis_kinematics
okvis_time
okvis_cv
okvis_common
loop_closure_structs
okvis_ceres
okvis_timing
okvis_matcher
okvis_frontend
okvis_multisensor_processing
pthread
${CERES_LIBRARIES}
${Boost_LIBRARIES}
)
if(${VISENSORDRIVER_FOUND})
target_link_libraries(okvis_app_synchronous ${VISensorDriver_LIBRARY})
endif()
install(TARGETS okvis_app_synchronous
# IMPORTANT: Add the executable to the "export-set"
EXPORT okvisTargets
RUNTIME DESTINATION "${INSTALL_BIN_DIR}" COMPONENT bin)
endif()
# installation is invoked in the individual modules...
export (TARGETS
okvis_app_synchronous
okvis_util
okvis_kinematics
okvis_time
okvis_cv
okvis_common
loop_closure_structs
okvis_ceres
okvis_timing
okvis_matcher
okvis_frontend
okvis_multisensor_processing
FILE "${PROJECT_BINARY_DIR}/okvisTargets.cmake")
export ( PACKAGE okvis )
# Create the okvisConfig.cmake and okvisConfigVersion files
file(RELATIVE_PATH REL_INCLUDE_DIR "${INSTALL_CMAKE_DIR}"
"${INSTALL_INCLUDE_DIR}")
# ... for the build tree
set(CONF_INCLUDE_DIRS
"${PROJECT_SOURCE_DIR}/okvis_util/include"
"${PROJECT_SOURCE_DIR}/okvis_kinematics/include"
"${PROJECT_SOURCE_DIR}/okvis_time/include"
"${PROJECT_SOURCE_DIR}/okvis_cv/include"
"${PROJECT_SOURCE_DIR}/okvis_common/include"
"${PROJECT_SOURCE_DIR}/loop_closure/include"
"${PROJECT_SOURCE_DIR}/okvis_ceres/include"
"${PROJECT_SOURCE_DIR}/okvis_timing/include"
"${PROJECT_SOURCE_DIR}/okvis_matcher/include"
"${PROJECT_SOURCE_DIR}/okvis_frontend/include"
"${PROJECT_SOURCE_DIR}/okvis_multisensor_processing/include"
"${PROJECT_BINARY_DIR}/include"
)
configure_file(cmake/okvisConfig.cmake.in
"${PROJECT_BINARY_DIR}/okvisConfig.cmake" @ONLY)
# ... for the install tree
set(CONF_INCLUDE_DIRS "\${OKVIS_CMAKE_DIR}/${REL_INCLUDE_DIR}")
configure_file(cmake/okvisConfig.cmake.in
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/okvisConfig.cmake" @ONLY)
# ... for both
configure_file(cmake/okvisConfigVersion.cmake.in
"${PROJECT_BINARY_DIR}/okvisConfigVersion.cmake" @ONLY)
# Install the okvisConfig.cmake and okvisConfigVersion.cmake
install(FILES
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/okvisConfig.cmake"
"${PROJECT_BINARY_DIR}/okvisConfigVersion.cmake"
DESTINATION "${INSTALL_CMAKE_DIR}")
# Install the export set for use with the install-tree
install(EXPORT okvisTargets DESTINATION
"${INSTALL_CMAKE_DIR}")