-
Notifications
You must be signed in to change notification settings - Fork 88
/
CMakeLists.txt
227 lines (204 loc) · 5.74 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
cmake_minimum_required(VERSION 2.8)
project(orb_slam3_ros)
IF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE Release)
ENDIF()
MESSAGE("Build type: " ${CMAKE_BUILD_TYPE})
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -O3")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -O3")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -march=native")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -march=native")
# Check C++14 or C++0x support
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++14" COMPILER_SUPPORTS_CXX14)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
if(COMPILER_SUPPORTS_CXX14)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
add_definitions(-DCOMPILEDWITHC11)
message(STATUS "Using flag -std=c++14.")
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++14 support. Please use a different C++ compiler.")
endif()
LIST(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake_modules)
find_package(OpenCV 4.2)
if(NOT OpenCV_FOUND)
message(FATAL_ERROR "OpenCV 4.2 not found.")
endif()
MESSAGE("OPENCV VERSION:")
MESSAGE(${OpenCV_VERSION})
## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS
cv_bridge
image_transport
geometry_msgs
sensor_msgs
nav_msgs
std_msgs
message_filters
roscpp
rospy
tf
tf2
message_generation
)
find_package(Eigen3 3.1.0 REQUIRED)
find_package(Pangolin REQUIRED)
add_service_files(
FILES
SaveMap.srv
)
generate_messages(
DEPENDENCIES
std_msgs
)
catkin_package (
CATKIN_DEPENDS roscpp rospy std_msgs cv_bridge image_transport tf sensor_msgs dynamic_reconfigure message_runtime
LIBRARIES {PROJECT_NAME} libDBoW2 libg2o
)
## Specify additional locations of header files
## Your package locations should be listed before other locations
include_directories(
${PROJECT_SOURCE_DIR}
${PROJECT_SOURCE_DIR}/include
${PROJECT_SOURCE_DIR}/orb_slam3
${PROJECT_SOURCE_DIR}/orb_slam3/include
${PROJECT_SOURCE_DIR}/orb_slam3/include/CameraModels
${PROJECT_SOURCE_DIR}/orb_slam3/Thirdparty
${PROJECT_SOURCE_DIR}/orb_slam3/Thirdparty/Sophus
${EIGEN3_INCLUDE_DIR}
${Pangolin_INCLUDE_DIRS}
${catkin_INCLUDE_DIRS}
)
include(${PROJECT_SOURCE_DIR}/orb_slam3/Thirdparty/DBoW2/CMakeLists.txt)
include(${PROJECT_SOURCE_DIR}/orb_slam3/Thirdparty/g2o/CMakeLists.txt)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/orb_slam3/lib)
add_library(${PROJECT_NAME} SHARED
orb_slam3/src/System.cc
orb_slam3/src/Tracking.cc
orb_slam3/src/LocalMapping.cc
orb_slam3/src/LoopClosing.cc
orb_slam3/src/ORBextractor.cc
orb_slam3/src/ORBmatcher.cc
orb_slam3/src/FrameDrawer.cc
orb_slam3/src/Converter.cc
orb_slam3/src/MapPoint.cc
orb_slam3/src/KeyFrame.cc
orb_slam3/src/Atlas.cc
orb_slam3/src/Map.cc
orb_slam3/src/MapDrawer.cc
orb_slam3/src/Optimizer.cc
orb_slam3/src/Frame.cc
orb_slam3/src/KeyFrameDatabase.cc
orb_slam3/src/Sim3Solver.cc
orb_slam3/src/Viewer.cc
orb_slam3/src/ImuTypes.cc
orb_slam3/src/G2oTypes.cc
orb_slam3/src/CameraModels/Pinhole.cpp
orb_slam3/src/CameraModels/KannalaBrandt8.cpp
orb_slam3/src/OptimizableTypes.cpp
orb_slam3/src/MLPnPsolver.cpp
orb_slam3/src/GeometricTools.cc
orb_slam3/src/TwoViewReconstruction.cc
orb_slam3/src/Config.cc
orb_slam3/src/Settings.cc
orb_slam3/include/System.h
orb_slam3/include/Tracking.h
orb_slam3/include/LocalMapping.h
orb_slam3/include/LoopClosing.h
orb_slam3/include/ORBextractor.h
orb_slam3/include/ORBmatcher.h
orb_slam3/include/FrameDrawer.h
orb_slam3/include/Converter.h
orb_slam3/include/MapPoint.h
orb_slam3/include/KeyFrame.h
orb_slam3/include/Atlas.h
orb_slam3/include/Map.h
orb_slam3/include/MapDrawer.h
orb_slam3/include/Optimizer.h
orb_slam3/include/Frame.h
orb_slam3/include/KeyFrameDatabase.h
orb_slam3/include/Sim3Solver.h
orb_slam3/include/Viewer.h
orb_slam3/include/ImuTypes.h
orb_slam3/include/G2oTypes.h
orb_slam3/include/CameraModels/GeometricCamera.h
orb_slam3/include/CameraModels/Pinhole.h
orb_slam3/include/CameraModels/KannalaBrandt8.h
orb_slam3/include/OptimizableTypes.h
orb_slam3/include/MLPnPsolver.h
orb_slam3/include/GeometricTools.h
orb_slam3/include/TwoViewReconstruction.h
orb_slam3/include/SerializationUtils.h
orb_slam3/include/Config.h
orb_slam3/include/Settings.h
)
target_link_libraries(${PROJECT_NAME}
${OpenCV_LIBS}
${EIGEN3_LIBS}
${Pangolin_LIBRARIES}
${PROJECT_SOURCE_DIR}/orb_slam3/Thirdparty/DBoW2/lib/libDBoW2.so
${PROJECT_SOURCE_DIR}/orb_slam3/Thirdparty/g2o/lib/libg2o.so
-lboost_system
-lboost_serialization
-lcrypto
)
## ROS node
add_executable(ros_mono
src/ros_mono.cc
src/common.cc
)
target_link_libraries(ros_mono
${PROJECT_NAME}
${catkin_LIBRARIES}
)
## ROS node
add_executable(ros_mono_inertial
src/ros_mono_inertial.cc
src/common.cc
)
target_link_libraries(ros_mono_inertial
${PROJECT_NAME}
${catkin_LIBRARIES}
)
## ROS node
add_executable(ros_stereo
src/ros_stereo.cc
src/common.cc
)
target_link_libraries(ros_stereo
${PROJECT_NAME}
${catkin_LIBRARIES}
)
## ROS node
add_executable(ros_stereo_inertial
src/ros_stereo_inertial.cc
src/common.cc
)
target_link_libraries(ros_stereo_inertial
${PROJECT_NAME}
${catkin_LIBRARIES}
)
## ROS node
add_executable(ros_rgbd
src/ros_rgbd.cc
src/common.cc
)
target_link_libraries(ros_rgbd
${PROJECT_NAME}
${catkin_LIBRARIES}
)
## ROS node
add_executable(ros_rgbd_inertial
src/ros_rgbd_inertial.cc
src/common.cc
)
target_link_libraries(ros_rgbd_inertial
${PROJECT_NAME}
${catkin_LIBRARIES}
)