-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
224 lines (171 loc) · 5.75 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
cmake_minimum_required(VERSION 3.0.2)
project(tsdf_localization
VERSION 1.0.0)
# RELEASE PER DEFAULT
if (NOT EXISTS ${CMAKE_BINARY_DIR}/CMakeCache.txt)
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE)
endif()
endif()
## Compile as C++11, supported in ROS Kinetic and newer
add_compile_options(-std=c++17)
set(CMAKE_CXX_STANDARD 17)
## 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
diagnostic_updater
dynamic_reconfigure
geometry_msgs
roscpp
sensor_msgs
visualization_msgs
nav_msgs
tf2
tf2_sensor_msgs
message_runtime
message_generation
)
find_package(CUDA)
# let cmake find OpenMP and set some variables
find_package(OpenMP REQUIRED)
if(OPENMP_FOUND)
message(STATUS "OPENMP FOUND")
set(OpenMP_FLAGS ${OpenMP_CXX_FLAGS}) # or if you use C: ${OpenMP_C_FLAGS}
set(OpenMP_LIBS gomp)
endif()
find_package (Eigen3 3.3 REQUIRED NO_MODULE)
find_package(Boost REQUIRED COMPONENTS filesystem)
find_package(FLANN)
# dynamic reconfigure
generate_dynamic_reconfigure_options(
cfg/MCL.cfg
cfg/RING.cfg
)
catkin_package(
CATKIN_DEPENDS
diagnostic_updater
dynamic_reconfigure
geometry_msgs
roscpp
sensor_msgs
visualization_msgs
nav_msgs
tf2
tf2_sensor_msgs
message_runtime
message_generation
INCLUDE_DIRS include
DEPENDS OpenMP
)
###########
## Build ##
###########
## Specify additional locations of header files
## Your package locations should be listed before other locations
include_directories(
include
${catkin_INCLUDE_DIRS}
)
set(TSDF_LOC_SRC
src/particle_cloud.cpp
src/util/util.cpp
src/evaluation/model/naiv_evaluation.cpp
src/evaluation/model/likelihood_evaluation.cpp
src/evaluation/model/omp_likelihood_evaluation.cpp
src/resampling/wheel_resampler.cpp
src/evaluation/tsdf_evaluator.cpp
src/util/runtime_evaluator.cpp
src/util/imu_accumulator.cpp
)
# External interface for HDF5 (libhdf5) HighFive (https://github.com/BlueBrain/HighFive).
set(HIGHFIVE_EXAMPLES FALSE CACHE INTERNAL "")
set(HIGHFIVE_UNIT_TESTS FALSE CACHE INTERNAL "")
add_subdirectory(ext/HighFive)
include_directories("ext/HighFive/include")
find_package(HDF5 REQUIRED COMPONENTS CXX C HL)
include_directories(${HDF5_INCLUDE_DIRS})
function(MAKE_NODE NAME CPP)
add_executable(${NAME} ${CPP} src/util/runtime_evaluator.cpp)
add_dependencies(${NAME} ${PROJECT_NAME}_gencfg ${catkin_EXPORTED_TARGETS})
target_compile_options(${NAME} PRIVATE ${OpenMP_FLAGS})
target_link_libraries(${NAME}
${catkin_LIBRARIES}
${OpenMP_LIBS}
${HDF5_LIBRARIES}
${HDF5_HL_LIBRARIES}
Eigen3::Eigen
)
endfunction()
### CUDA libraries
if (CUDA_FOUND)
set(CUDA_NVCC_FLAGS "--std=c++14" CACHE STRING "nvcc flags" FORCE)
set(LIB_TYPE STATIC)
cuda_add_library(CUDAEvaluator ${LIB_TYPE} src/cuda/cuda_evaluator.cu src/cuda/cuda_sum.cu src/cuda/cuda_util.cu src/util/runtime_evaluator.cpp)
target_link_libraries(CUDAEvaluator ${HDF5_LIBRARIES} ${HDF5_HL_LIBRARIES} ${Boost_LIBRARIES})
cuda_add_executable(cuda_test_eval src/cuda/cuda_test_eval.cu src/cuda/cuda_evaluator.cu src/cuda/cuda_sum.cu src/cuda/cuda_util.cu src/util/mcl_file.cpp src/util/runtime_evaluator.cpp)
target_link_libraries(cuda_test_eval ${HDF5_LIBRARIES} ${HDF5_HL_LIBRARIES} ${Boost_LIBRARIES})
endif(CUDA_FOUND)
### ROS nodes
add_executable(mcl_3d src/mcl_3d.cpp ${TSDF_LOC_SRC})
if (CUDA_FOUND)
add_dependencies(mcl_3d ${PROJECT_NAME}_gencfg CUDAEvaluator)
target_link_libraries(mcl_3d ${catkin_LIBRARIES} ${Boost_LIBRARIES} CUDAEvaluator)
else (CUDA_FOUND)
add_dependencies(mcl_3d ${PROJECT_NAME}_gencfg)
target_link_libraries(mcl_3d ${catkin_LIBRARIES} ${Boost_LIBRARIES})
endif (CUDA_FOUND)
target_compile_options(mcl_3d PRIVATE ${OpenMP_FLAGS})
target_link_libraries(mcl_3d
${catkin_LIBRARIES}
${OpenMP_LIBS}
${HDF5_LIBRARIES}
${HDF5_HL_LIBRARIES}
Eigen3::Eigen
)
add_executable(num_particles_eval src/num_particles_eval.cpp src/util/mcl_file.cpp ${TSDF_LOC_SRC})
if (CUDA_FOUND)
add_dependencies(num_particles_eval ${PROJECT_NAME}_gencfg CUDAEvaluator)
target_link_libraries(num_particles_eval ${catkin_LIBRARIES} ${Boost_LIBRARIES} CUDAEvaluator)
else (CUDA_FOUND)
add_dependencies(num_particles_eval ${PROJECT_NAME}_gencfg)
target_link_libraries(num_particles_eval ${catkin_LIBRARIES} ${Boost_LIBRARIES})
endif (CUDA_FOUND)
target_compile_options(num_particles_eval PRIVATE ${OpenMP_FLAGS})
target_link_libraries(num_particles_eval
${catkin_LIBRARIES}
${OpenMP_LIBS}
${HDF5_LIBRARIES}
${HDF5_HL_LIBRARIES}
Eigen3::Eigen
)
if (CUDA_FOUND)
find_package(PkgConfig REQUIRED)
pkg_check_modules(LZ4 REQUIRED liblz4)
endif (CUDA_FOUND)
MAKE_NODE(tsdf_vis src/tsdf_vis.cpp)
if (CUDA_FOUND)
add_executable(snap_shot_node src/snap_shot_node.cpp src/util/mcl_file.cpp ${TSDF_LOC_SRC})
add_dependencies(snap_shot_node ${PROJECT_NAME}_gencfg CUDAEvaluator)
target_link_libraries(snap_shot_node ${catkin_LIBRARIES} ${Boost_LIBRARIES} CUDAEvaluator)
target_compile_options(snap_shot_node PRIVATE ${OpenMP_FLAGS})
target_link_libraries(snap_shot_node
${catkin_LIBRARIES}
${OpenMP_LIBS}
${HDF5_LIBRARIES}
${HDF5_HL_LIBRARIES}
Eigen3::Eigen
)
add_executable(snap_vis_node src/snap_vis_node.cpp src/util/mcl_file.cpp ${TSDF_LOC_SRC})
add_dependencies(snap_vis_node ${PROJECT_NAME}_gencfg CUDAEvaluator)
target_link_libraries(snap_vis_node ${catkin_LIBRARIES} ${Boost_LIBRARIES} CUDAEvaluator)
target_compile_options(snap_vis_node PRIVATE ${OpenMP_FLAGS})
target_link_libraries(snap_vis_node
${catkin_LIBRARIES}
${OpenMP_LIBS}
${HDF5_LIBRARIES}
${HDF5_HL_LIBRARIES}
Eigen3::Eigen
)
endif (CUDA_FOUND)