-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
335 lines (281 loc) · 10.8 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
cmake_minimum_required(VERSION 3.4)
project(map_sense)
# This line is required for specifying the "modules" directory in the project containing .cmake files
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/modules/" ${CMAKE_MODULE_PATH})
set(CMAKE_PREFIX_PATH "${PROJECT_SOURCE_DIR}/../../devel;/opt/ros/noetic")
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TORCH_CXX_FLAGS}")
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
#MATH(EXPR stack_size "2048000 * 1024 * 1024") # 16 Mb
#set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-z,stack-size=${stack_size}")
enable_testing()
find_package(GTest REQUIRED) # Find the google testing framework on your system
#find_package(Torch REQUIRED PATHS "${PROJECT_SOURCE_DIR}/Vendor/libtorch")
find_package(VTK 7 REQUIRED)
find_package(gflags REQUIRED)
find_package(OpenCV REQUIRED)
find_package(OpenCL REQUIRED)
find_package(Eigen3 3.4 REQUIRED NO_MODULE)
#find_package(GTSAM REQUIRED)
find_package(xtl REQUIRED)
find_package(BLAS REQUIRED)
add_subdirectory(Vendor/Geometry/)
add_subdirectory(Vendor/HighFive/)
#include_directories(${GTSAM_INCLUDE_DIR})
#find_package(Corrade REQUIRED Main)
#find_package(Magnum REQUIRED
# MeshTools
# GL
# Primitives
# Shaders
# Sdl2Application
# SceneGraph)
#
#find_package(MagnumIntegration REQUIRED ImGui)
#find_package(ImGui REQUIRED)
## 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
roscpp
rospy
std_msgs
geometry_msgs
message_generation
image_transport
cv_bridge
# pcl_ros
# pcl_conversions
)
add_message_files(
FILES
RawGPUPlanarRegionList.msg
RawGPUPlanarRegion.msg
MapsenseConfiguration.msg
)
generate_messages(
DEPENDENCIES
std_msgs
geometry_msgs
)
catkin_package(
CATKIN_DEPENDS roscpp rospy std_msgs geometry_msgs message_runtime
)
###########
## Build ##
###########
## Specify additional locations of header files
## Your package locations should be listed before other locations
set(PLANAR_REGION_LIB
src/FeatureDetection/PlanarRegionCalculator.cpp
src/FeatureDetection/MapFrame.cpp
src/FeatureDetection/MapFrameProcessor.cpp
src/FeatureDetection/PlanarRegionProcessor.cpp
src/OpenCL/OpenCLManager.cpp
src/Application/AppUtils.cpp
src/headers/AppUtils.h
src/headers/OpenCLManager.h
src/headers/PlanarRegionCalculator.h
src/headers/MapFrameProcessor.h
src/headers/MapFrame.h
src/FeatureDetection/PlanarRegionProcessor.h)
set(SLAM_LIB
src/SLAM/MapHandler.cpp
src/SLAM/SLAMModule.cpp
src/headers/SLAMModule.h
src/headers/FactorGraphHandler.h
# src/SLAM/FactorGraphHandler.cpp
# src/headers/MapHandler.h
)
set(VISUAL_ODOMETRY_LIB
src/SLAM/VisualOdometry.cpp
src/headers/VisualOdometry.h
# src/SLAM/BundleAdjustment.cpp
# src/headers/BundleAdjustment.h
)
set(ICP_LIB
src/OpenCL/OpenCLManager.cpp
src/headers/OpenCLManager.h
src/SLAM/IterativeClosestPoint.cpp
src/headers/IterativeClosestPoint.h)
set(SOURCE
src/Application/ApplicationState.cpp
src/Network/NetworkManager.cpp
src/Application/AppUtils.cpp
src/ImageProcessing/ImageTools.cpp
src/Network/ROS1TopicReceiver.cpp
src/Network/ImageReceiver.cpp
src/DataManager.cpp
src/OpenCL/OpenCLManager.cpp
src/UI/ImGuiLayout.cpp
src/UI/ImGuiTools.cpp
src/Rendering/MeshGenerator.cpp
src/Rendering/ClayTools.cpp)
set(HEADERS
src/headers/NetworkManager.h
src/headers/ApplicationState.h
src/headers/AppUtils.h
src/headers/ImageTools.h
src/headers/ImageReceiver.h
src/headers/ROS1TopicReceiver.h
src/headers/PointCloudReceiver.h
src/Network/PointCloudReceiver.cpp
src/headers/DataManager.h
src/headers/OpenCLManager.h
src/headers/Log.h
src/headers/Instrumentor.h
src/headers/Timer.h
src/headers/Core.h
src/headers/ImGuiLayout.h
src/headers/ImGuiTools.h
src/headers/ClayTools.h
# src/headers/MapsenseHeaders.h
src/headers/ApplicationLayer.h
src/Launcher/ApplicationLayer.cpp
src/headers/MeshGenerator.h
)
set(MAPSENSE_CLAY_HEADERS
src/headers/ClayApp.h
src/headers/MapsenseLayer.h)
set(MAPSENSE_CLAY_SOURCES
src/Launcher/ClayApp.cpp
src/Launcher/MapsenseLayer.cpp test/PlanarRegionTester.cpp)
set(TERRAIN_SLAM_SOURCES
src/headers/VisualTerrainSLAMApp.h
src/headers/NetworkedTerrainSLAMLayer.h
src/Launcher/VisualTerrainSLAMApp.cpp
src/Launcher/NetworkedTerrainSLAMLayer.cpp
)
set(MAPSENSE_INCLUDE_DIRS
"Vendor/HighFive/include/"
"/usr/local/include/ClayEngine/"
"/usr/local/include/ClayEngine/Vendor/"
"/usr/local/include/ClayEngine/Vendor/GLAD/include/"
"/usr/local/include/ClayEngine/Vendor/glfw/include/"
"/usr/local/include/ClayEngine/Vendor/glm/"
"/usr/local/include/ClayEngine/Vendor/ImGui/"
"/usr/local/include/ClayEngine/Vendor/ImGui/imgui/"
"/usr/local/include/ClayEngine/Vendor/spdlog/include/"
"/usr/local/include/ClayEngine/Vendor/stb_image/")
message(STATUS "Geometry:${Geometry_INCLUDE_DIR}")
include_directories(
include
src/headers
${catkin_INCLUDE_DIRS}
/usr/include/CL/
Vendor/spdlog/include
/usr/include/hdf5/serial/
Vendor/HighFive/include/
/usr/local/include/ClayEngine/Vendor/
Vendor/implot/
${Geometry_INCLUDE_DIR}
${MAPSENSE_INCLUDE_DIRS}
)
#set_target_properties(Mapsense_Launcher_UI PROPERTIES LINK_FLAGS -Wl,-z, stack-size, 1000000000000)
#[[
Develop all libraries here.
]]
add_library(planar-regions STATIC ${PLANAR_REGION_LIB})
target_link_libraries(planar-regions
Eigen3::Eigen
${OpenCV_LIBS}
geom-tools)
add_library(slam STATIC ${SLAM_LIB})
target_link_libraries(slam
# gtsam
Eigen3::Eigen
${OpenCV_LIBS}
geom-tools)
#add_library(visual_odometry STATIC ${VISUAL_ODOMETRY_LIB})
#target_link_libraries(visual_odometry
# Eigen3::Eigen
# ${OpenCV_LIBS})
#target_include_directories(visual_odometry PUBLIC ${MAPSENSE_INCLUDE_DIRS})
add_library(mapsense STATIC ${SOURCE} ${HEADERS})
target_link_libraries(mapsense
${OpenCV_LIBS} ${catkin_LIBRARIES}
/usr/lib/x86_64-linux-gnu/libOpenCL.so
Eigen3::Eigen tbb geom-tools ClayEngine imgui)
target_include_directories(mapsense PUBLIC ${MAPSENSE_INCLUDE_DIRS})
#add_library(icp STATIC ${ICP_LIB})
#target_link_libraries(icp Eigen3::Eigen)
add_library(implot STATIC Vendor/implot/implot.h Vendor/implot/implot_internal.h Vendor/implot/implot.cpp Vendor/implot/implot_items.cpp Vendor/implot/implot_demo.cpp)
#[[
Develop all executables here.
]]
if (MAPSENSE)
add_executable(Mapsense_Clay ${MAPSENSE_CLAY_SOURCES} ${MAPSENSE_CLAY_HEADERS})
target_include_directories(Mapsense_Clay PUBLIC ${MAPSENSE_INCLUDE_DIRS})
target_link_libraries(Mapsense_Clay
${OpenCV_LIBS} ${catkin_LIBRARIES}
/usr/lib/x86_64-linux-gnu/libOpenCL.so
Eigen3::Eigen tbb
geom-tools planar-regions slam icp
ClayEngine visual_odometry mapsense
glad imgui glfw3 ${CMAKE_DL_LIBS} ${BLAS_LIBRARIES})
add_dependencies(Mapsense_Clay map_sense_generate_messages_cpp)
target_precompile_headers(Mapsense_Clay PUBLIC src/headers/MapsenseHeaders.h)
target_compile_definitions(Mapsense_Clay PUBLIC -DASSETS_PATH="/usr/local/include/ClayEngine/Assets/")
endif ()
## ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
set(VISUAL_TERRAIN_SLAM 1)
if (VISUAL_TERRAIN_SLAM)
add_executable(VisualTerrainSLAM ${TERRAIN_SLAM_SOURCES} src/headers/Log.h)
target_link_libraries(VisualTerrainSLAM
${OpenCV_LIBS} ${catkin_LIBRARIES}
/usr/lib/x86_64-linux-gnu/libOpenCL.so
Eigen3::Eigen tbb
geom-tools planar-regions slam
ClayEngine mapsense
glad imgui implot glfw3 ${CMAKE_DL_LIBS} ${BLAS_LIBRARIES} HighFive hdf5_serial)
target_include_directories(VisualTerrainSLAM PUBLIC ${MAPSENSE_INCLUDE_DIRS})
add_dependencies(VisualTerrainSLAM map_sense_generate_messages_cpp)
# target_precompile_headers(VisualTerrainSLAM PUBLIC src/headers/MapsenseHeaders.h)
target_compile_definitions(VisualTerrainSLAM PUBLIC -DASSETS_PATH="/usr/local/include/ClayEngine/Assets/")
endif ()
## //////////////////////////////////////////////////////////////////////////////////////////////////////////////
set(VIS_ODOM 0)
if (VIS_ODOM)
add_executable(Vis_Odom src/Launcher/VisualOdometryLauncher.cpp)
target_link_libraries(Vis_Odom
${OpenCV_LIBS} ${catkin_LIBRARIES}
/usr/lib/x86_64-linux-gnu/libOpenCL.so
Eigen3::Eigen tbb
geom-tools slam
mapsense visual_odometry
${CMAKE_DL_LIBS} ${BLAS_LIBRARIES})
target_include_directories(Vis_Odom PUBLIC ${MAPSENSE_INCLUDE_DIRS})
add_dependencies(Vis_Odom map_sense_generate_messages_cpp)
target_precompile_headers(Vis_Odom PUBLIC src/headers/MapsenseHeaders.h)
endif ()
## //////////////////////////////////////////////////////////////////////////////////////////////////////////////
if (BUILD_HEADLESS)
add_executable(mapsense_headless
${SOURCE} ${HEADERS}
src/Launcher/MapsenseHeadlessLauncher.cpp
src/headers/MapsenseHeadlessLauncher.h)
target_include_directories(mapsense_headless PUBLIC
"/usr/local/include/ClayEngine/Vendor/"
"/usr/local/include/ClayEngine"
"/usr/local/include/ClayEngine/Vendor/GLAD/include"
"/usr/local/include/ClayEngine/Vendor/glfw/include"
"/usr/local/include/ClayEngine/Vendor/glm"
"/usr/local/include/ClayEngine/Vendor/ImGui"
"/usr/local/include/ClayEngine/Vendor/ImGui/imgui"
"/usr/local/include/ClayEngine/Vendor/spdlog/include"
"/usr/local/include/ClayEngine/Vendor/stb_image/")
target_link_libraries(mapsense_headless
${OpenCV_LIBS}
${catkin_LIBRARIES}
/usr/lib/x86_64-linux-gnu/libOpenCL.so
Eigen3::Eigen
tbb
geom-tools
)
add_dependencies(mapsense_headless map_sense_generate_messages_cpp)
endif ()
# glad imgui glfw3 ${CMAKE_DL_LIBS} )
if (BUILD_EXAMPLES)
add_subdirectory(src/examples/)
endif ()