forked from navganti/SIVO
-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
151 lines (132 loc) · 3.88 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
cmake_minimum_required(VERSION 2.8)
project(SIVO)
if(NOT CMAKE_BUILD_TYPE)
MESSAGE(STATUS "Using 'Release' build type as CMAKE_BUILD_TYPE is not set")
set(CMAKE_BUILD_TYPE Release)
endif()
MESSAGE("Build type: " ${CMAKE_BUILD_TYPE})
if (CMAKE_BUILD_TYPE MATCHES Release)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -O3 -Wno-deprecated -march=native")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -O3 -Wno-deprecated -march=native")
elseif(CMAKE_BUILD_TYPE MATCHES Debug)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-deprecated -march=native")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-deprecated -march=native")
endif()
# Check C++11 or C++0x support
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
if(COMPILER_SUPPORTS_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
add_definitions(-DCOMPILEDWITHC11)
message(STATUS "Using flag -std=c++11.")
elseif(COMPILER_SUPPORTS_CXX0X)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
add_definitions(-DCOMPILEDWITHC0X)
message(STATUS "Using flag -std=c++0x.")
else()
message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
endif()
LIST(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake_modules)
find_package(OpenCV 3.0 QUIET)
if(NOT OpenCV_FOUND)
find_package(OpenCV 2.4.3 QUIET)
if(NOT OpenCV_FOUND)
message(FATAL_ERROR "OpenCV > 2.4.3 not found.")
endif()
endif()
find_package(Eigen3 REQUIRED)
find_package(Pangolin REQUIRED)
find_package(Caffe REQUIRED)
find_package(G2O REQUIRED QUIET)
include_directories(
${PROJECT_SOURCE_DIR}
${PROJECT_SOURCE_DIR}/include
${EIGEN3_INCLUDE_DIR}
${Pangolin_INCLUDE_DIRS}
${Caffe_INCLUDE_DIRS}
${G2O_INCLUDE_DIR}
)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib)
set(g2o_LIBRARIES
${G2O_STUFF_LIBRARY}
${G2O_CORE_LIBRARY}
${G2O_SOLVER_CHOLMOD}
${G2O_SOLVER_CSPARSE}
${G2O_SOLVER_DENSE}
${G2O_SOLVER_EIGEN}
${G2O_TYPES_DATA}
${G2O_TYPES_SBA}
${G2O_TYPES_SIM3}
${G2O_TYPES_SLAM3D}
)
add_library(bayesian_segnet SHARED
src/bayesian_segnet/bayesian_segnet.cpp
)
target_link_libraries(bayesian_segnet
${OpenCV_LIBS}
${EIGEN3_LIBS}
${Caffe_LIBRARIES}
)
add_library(sivo_helpers SHARED
src/sivo_helpers/sivo_helpers.cpp
)
target_link_libraries(sivo_helpers
${EIGEN3_LIBS}
${OpenCV_LIBS}
)
add_library(orbslam SHARED
src/orbslam/System.cc
src/orbslam/Tracking.cc
src/orbslam/LocalMapping.cc
src/orbslam/LoopClosing.cc
src/orbslam/ORBextractor.cc
src/orbslam/ORBmatcher.cc
src/orbslam/FrameDrawer.cc
src/orbslam/Converter.cc
src/orbslam/MapPoint.cc
src/orbslam/KeyFrame.cc
src/orbslam/Map.cc
src/orbslam/MapDrawer.cc
src/orbslam/Optimizer.cc
src/orbslam/PnPsolver.cc
src/orbslam/Frame.cc
src/orbslam/KeyFrameDatabase.cc
src/orbslam/Sim3Solver.cc
src/orbslam/Viewer.cc
)
target_link_libraries(orbslam
bayesian_segnet
sivo_helpers
${OpenCV_LIBS}
${EIGEN3_LIBS}
${Pangolin_LIBRARIES}
${PROJECT_SOURCE_DIR}/dependencies/DBoW2/lib/libDBoW2.so
${g2o_LIBRARIES}
cholmod
pthread
)
# Build examples
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin)
add_executable(${PROJECT_NAME}
src/sivo.cc
)
target_link_libraries(${PROJECT_NAME}
orbslam
)
# Testing
# ------------------------------------------
if (CMAKE_BUILD_TYPE MATCHES Debug)
MESSAGE("Building Tests...")
find_package(GTest REQUIRED)
include_directories(${GTEST_INCLUDE_DIRS})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin)
add_executable(test_bayesian_segnet
tests/test_bayesian_segnet.cpp
)
target_link_libraries(test_bayesian_segnet
${GTEST_LIBRARIES}
pthread
bayesian_segnet
)
endif()