-
Notifications
You must be signed in to change notification settings - Fork 19
/
CMakeLists.txt.ros1
188 lines (164 loc) · 7.44 KB
/
CMakeLists.txt.ros1
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
cmake_minimum_required(VERSION 2.8.3)
project(common_robotics_utilities)
## 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 geometry_msgs visualization_msgs)
find_package(Eigen3 REQUIRED)
set(Eigen3_INCLUDE_DIRS ${EIGEN3_INCLUDE_DIR})
find_package(OpenMP)
## We don't depend on Drake, but we do use different build flags if present.
find_package(drake QUIET)
###################################
## catkin specific configuration ##
###################################
## The catkin_package macro generates cmake config files for your package
## Declare things to be passed to dependent projects
## LIBRARIES: libraries you create in this project
## CATKIN_DEPENDS: catkin_packages dependent projects also need
## DEPENDS: system dependencies of this project
catkin_package(INCLUDE_DIRS
include
LIBRARIES
${PROJECT_NAME}
CATKIN_DEPENDS
roscpp
geometry_msgs
visualization_msgs
DEPENDS
Eigen3
CFG_EXTRAS ${PROJECT_NAME}-extras.cmake)
###########
## Build ##
###########
## Specify additional locations of header files
## Your package locations should be listed before other locations
include_directories(include SYSTEM ${catkin_INCLUDE_DIRS}
${Eigen3_INCLUDE_DIRS})
## Build options
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON)
cmake_policy(SET CMP0069 NEW)
add_compile_options(-std=c++11)
add_compile_options(-Wall)
add_compile_options(-Wextra)
add_compile_options(-Werror)
add_compile_options(-Wconversion)
add_compile_options(-Wshadow)
add_compile_options(-O3)
add_compile_options(-g)
add_compile_options(-Werror=non-virtual-dtor)
add_compile_options(-Wold-style-cast)
add_compile_options(-Wpessimizing-move)
add_compile_options(-Wuninitialized)
add_compile_options(-Wmissing-declarations)
if(drake_FOUND)
message(STATUS "Drake found, disabling -march=native")
else()
message(STATUS "Drake NOT found, enabling -march=native")
add_compile_options(-march=native)
endif()
add_definitions(-DCOMMON_ROBOTICS_UTILITIES__SUPPORTED_ROS_VERSION=1)
## It's not clear if add_compile_options does the right things for flags that
## may differ between languages and target type.
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS
"${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
set(CMAKE_SHARED_LINKER_FLAGS
"${CMAKE_SHARED_LINKER_FLAGS} ${OpenMP_SHARED_LINKER_FLAGS}")
# Utility library
add_library(${PROJECT_NAME}
include/${PROJECT_NAME}/base64_helpers.hpp
include/${PROJECT_NAME}/color_builder.hpp
include/${PROJECT_NAME}/conversions.hpp
include/${PROJECT_NAME}/cru_namespace.hpp
include/${PROJECT_NAME}/dynamic_spatial_hashed_voxel_grid.hpp
include/${PROJECT_NAME}/gaussian_distributions.hpp
include/${PROJECT_NAME}/math.hpp
include/${PROJECT_NAME}/maybe.hpp
include/${PROJECT_NAME}/openmp_helpers.hpp
include/${PROJECT_NAME}/parallelism.hpp
include/${PROJECT_NAME}/path_processing.hpp
include/${PROJECT_NAME}/print.hpp
include/${PROJECT_NAME}/random_rotation_generator.hpp
include/${PROJECT_NAME}/ros_conversions.hpp
include/${PROJECT_NAME}/ros_helpers.hpp
include/${PROJECT_NAME}/serialization.hpp
include/${PROJECT_NAME}/simple_astar_search.hpp
include/${PROJECT_NAME}/simple_dtw.hpp
include/${PROJECT_NAME}/simple_graph.hpp
include/${PROJECT_NAME}/simple_graph_search.hpp
include/${PROJECT_NAME}/simple_hausdorff_distance.hpp
include/${PROJECT_NAME}/simple_hierarchical_clustering.hpp
include/${PROJECT_NAME}/simple_kmeans_clustering.hpp
include/${PROJECT_NAME}/simple_knearest_neighbors.hpp
include/${PROJECT_NAME}/simple_prm_planner.hpp
include/${PROJECT_NAME}/simple_prngs.hpp
include/${PROJECT_NAME}/simple_robot_model_interface.hpp
include/${PROJECT_NAME}/simple_rrt_planner.hpp
include/${PROJECT_NAME}/simple_task_planner.hpp
include/${PROJECT_NAME}/time_optimal_trajectory_parametrization.hpp
include/${PROJECT_NAME}/utility.hpp
include/${PROJECT_NAME}/voxel_grid.hpp
include/${PROJECT_NAME}/zlib_helpers.hpp
src/${PROJECT_NAME}/base64_helpers.cpp
src/${PROJECT_NAME}/conversions.cpp
src/${PROJECT_NAME}/math.cpp
src/${PROJECT_NAME}/ros_conversions.cpp
src/${PROJECT_NAME}/serialization.cpp
src/${PROJECT_NAME}/time_optimal_trajectory_parametrization.cpp
src/${PROJECT_NAME}/zlib_helpers.cpp)
add_dependencies(${PROJECT_NAME} ${catkin_EXPORTED_TARGETS})
target_link_libraries(${PROJECT_NAME} ${catkin_LIBRARIES} z)
# Examples
add_executable(clustering_example example/clustering_example.cpp)
add_dependencies(clustering_example ${PROJECT_NAME})
target_link_libraries(clustering_example ${PROJECT_NAME})
add_executable(dtw_example example/dtw_example.cpp)
add_dependencies(dtw_example ${PROJECT_NAME})
target_link_libraries(dtw_example ${PROJECT_NAME})
if(CATKIN_ENABLE_TESTING)
# Tests
catkin_add_gtest(hausdorff_distance_test test/hausdorff_distance_test.cpp)
add_dependencies(hausdorff_distance_test ${PROJECT_NAME})
target_link_libraries(hausdorff_distance_test ${PROJECT_NAME})
catkin_add_gtest(maybe_test test/maybe_test.cpp)
add_dependencies(maybe_test ${PROJECT_NAME})
target_link_libraries(maybe_test ${PROJECT_NAME})
catkin_add_gtest(parallelism_test test/parallelism_test.cpp)
add_dependencies(parallelism_test ${PROJECT_NAME})
target_link_libraries(parallelism_test ${PROJECT_NAME})
catkin_add_gtest(planning_test test/planning_test.cpp)
add_dependencies(planning_test ${PROJECT_NAME})
target_link_libraries(planning_test ${PROJECT_NAME})
catkin_add_gtest(task_planning_test test/task_planning_test.cpp)
add_dependencies(task_planning_test ${PROJECT_NAME})
target_link_libraries(task_planning_test ${PROJECT_NAME})
catkin_add_gtest(ros_helpers_test test/ros_helpers_test.cpp)
add_dependencies(ros_helpers_test ${PROJECT_NAME})
target_link_libraries(ros_helpers_test ${PROJECT_NAME})
catkin_add_gtest(utility_test test/utility_test.cpp)
add_dependencies(utility_test ${PROJECT_NAME})
target_link_libraries(utility_test ${PROJECT_NAME})
catkin_add_gtest(voxel_grid_test test/voxel_grid_test.cpp)
add_dependencies(voxel_grid_test ${PROJECT_NAME})
target_link_libraries(voxel_grid_test ${PROJECT_NAME})
catkin_add_gtest(print_test test/print_test.cpp)
add_dependencies(print_test ${PROJECT_NAME})
target_link_libraries(print_test ${PROJECT_NAME})
endif()
#############
## Install ##
#############
## Mark library for installation
install(TARGETS ${PROJECT_NAME}
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
## Mark cpp header files for installation
install(DIRECTORY include/${PROJECT_NAME}/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
FILES_MATCHING PATTERN "*.hpp"
PATTERN ".svn" EXCLUDE
)