-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
237 lines (202 loc) · 7.22 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
cmake_minimum_required(VERSION 3.2)
project(ag_mapping)
IF (NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE Release)
ENDIF ()
set(CMAKE_CXX_STANDARD 14)
MESSAGE("Build type: " ${CMAKE_BUILD_TYPE})
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -march=native -std=c++14")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -march=native -std=c++14")
# 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)
set(OpenCV_DIR "/home/lacie/opencv-4.5.2/build")
find_package(OpenCV 4.5 REQUIRED NO_MODULE PATHS /usr/local NO_DEFAULT_PATH)
if (NOT OpenCV_FOUND)
message(FATAL_ERROR "OpenCV 4.5 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
vision_msgs
std_msgs
message_filters
roscpp
rospy
tf
tf2
pcl_ros
message_generation
)
find_package(Qt5 COMPONENTS Core Widgets REQUIRED)
find_package(Eigen3 3.1.0 REQUIRED)
find_package(Pangolin REQUIRED)
find_package(PCL 1.8 REQUIRED)
add_definitions(${PCL_DEFINITIONS})
include_directories(${PCL_INCLUDE_DIRS})
message("PCL Include Directory: ${PCL_INCLUDE_DIRS}")
find_package(octomap REQUIRED)
include_directories(${OCTOMAP_INCLUDE_DIRS})
find_package(Boost COMPONENTS system filesystem serialization REQUIRED)
include_directories(${Boost_INCLUDE_DIR})
link_directories(${Boost_LIBRARY_DIR})
# cuda
find_package(CUDA REQUIRED)
include_directories(${CUDA_INCLUDE_DIRS})
link_directories(${CUDA_LIBRARY_DIRS})
include_directories(/usr/local/cuda/include)
link_directories(/usr/local/cuda/lib64)
# tensorrt
include_directories(/usr/include/x86_64-linux-gnu/)
link_directories(/usr/lib/x86_64-linux-gnu/)
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 pcl_ros
LIBRARIES {PROJECT_NAME} libDBoW2 libg2o libyolov5-detector icm20948
)
## 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}/semantic_slam
${PROJECT_SOURCE_DIR}/semantic_slam/include
${PROJECT_SOURCE_DIR}/semantic_slam/include/CameraModels
${PROJECT_SOURCE_DIR}/semantic_slam/include/cuda
${PROJECT_SOURCE_DIR}/semantic_slam/Thirdparty
${PROJECT_SOURCE_DIR}/semantic_slam/Thirdparty/Sophus
${PROJECT_SOURCE_DIR}/semantic_slam/Thirdparty/yolov5
${EIGEN3_INCLUDE_DIR}
${Pangolin_INCLUDE_DIRS}
${catkin_INCLUDE_DIRS}
)
include(${PROJECT_SOURCE_DIR}/semantic_slam/Thirdparty/DBoW2/CMakeLists.txt)
include(${PROJECT_SOURCE_DIR}/semantic_slam/Thirdparty/g2o/CMakeLists.txt)
include(${PROJECT_SOURCE_DIR}/semantic_slam/Thirdparty/IMU/CMakeLists.txt)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/semantic_slam/lib)
file(GLOB HEADERS
${CMAKE_CURRENT_SOURCE_DIR}/semantic_slam/include/*.h
${CMAKE_CURRENT_SOURCE_DIR}/semantic_slam/include/*.hpp
${CMAKE_CURRENT_SOURCE_DIR}/semantic_slam/include/CameraModels/*.h
${CMAKE_CURRENT_SOURCE_DIR}/semantic_slam/include/cuda/*.hpp
${CMAKE_CURRENT_SOURCE_DIR}/semantic_slam/include/line_lbd/*.hpp
${CMAKE_CURRENT_SOURCE_DIR}/semantic_slam/include/line_lbd/*.h
${CMAKE_CURRENT_SOURCE_DIR}/semantic_slam/include/line_lbd/line_descriptor/*.hpp
${CMAKE_CURRENT_SOURCE_DIR}/semantic_slam/include/detect_3d_cuboid/*.h
)
file(GLOB SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/semantic_slam/src/*.cc
${CMAKE_CURRENT_SOURCE_DIR}/semantic_slam/src/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/semantic_slam/src/CameraModels/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/semantic_slam/src/cuda/*.cu
${CMAKE_CURRENT_SOURCE_DIR}/semantic_slam/src/line_detect/libs/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/semantic_slam/src/line_detect/libs/*.hpp
${CMAKE_CURRENT_SOURCE_DIR}/semantic_slam/src/line_detect/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/semantic_slam/src/detect_3d_cuboid/*.cpp
)
source_group("Header Files" FILES ${HEADERS})
source_group("Source Files" FILES ${SOURCES})
cuda_add_library(${PROJECT_NAME} SHARED
${HEADERS}
${SOURCES}
)
set(TRT_LIBS nvinfer)
target_link_libraries(${PROJECT_NAME}
${OpenCV_LIBS}
${EIGEN3_LIBS}
${Pangolin_LIBRARIES}
${PCL_LIBRARIES}
${OCTOMAP_LIBRARIES}
${TRT_LIBS}
${CUDA_CUDA_LIBRARY}
${CUDA_CUDART_LIBRARY}
${PROJECT_SOURCE_DIR}/semantic_slam/Thirdparty/DBoW2/lib/libDBoW2.so
${PROJECT_SOURCE_DIR}/semantic_slam/Thirdparty/g2o/lib/libg2o.so
${PROJECT_SOURCE_DIR}/semantic_slam/Thirdparty/yolov5/lib/libyolov5-detector.so
-lboost_serialization
-lcrypto
nvToolsExt
)
## ROS node
add_executable(simple_rgbd_node
src/simple_rgbd_node.cpp)
target_link_libraries(simple_rgbd_node
${PROJECT_NAME}
${catkin_LIBRARIES}
)
## ZED ROS node
add_executable(zed_rgbd_node
src/zed_node_rgbd.cpp
src/common.cc)
target_link_libraries(zed_rgbd_node
${PROJECT_NAME}
${catkin_LIBRARIES}
)
## ZED ROS node
add_executable(zed_stereo_node
src/zed_stereo_imu_node.cpp
src/common.cc)
target_link_libraries(zed_stereo_node
${PROJECT_NAME}
${catkin_LIBRARIES}
)
## D435i ROS node
add_executable(d435i_rgbd_node
src/d435i_rgbd.cpp
src/common.cc)
target_link_libraries(d435i_rgbd_node
${PROJECT_NAME}
${catkin_LIBRARIES}
)
## D455 ROS node
add_executable(D455_rgbd_node
src/D455_rgbd.cpp
src/common.cc)
target_link_libraries(D455_rgbd_node
${PROJECT_NAME}
${catkin_LIBRARIES}
)
## zed_pipeline ROS node
add_executable(zed_pipeline
src/zed_pipeline.cpp)
target_link_libraries(zed_pipeline
${PROJECT_NAME}
${catkin_LIBRARIES}
)
## detector_test ROS node
add_executable(detector_test
src/detector_test.cpp)
target_link_libraries(detector_test
${PROJECT_NAME}
${catkin_LIBRARIES}
)