|
1 | | -cmake_minimum_required(VERSION 2.8.3) |
| 1 | +cmake_minimum_required(VERSION 3.5) |
2 | 2 | project(nonpersistent_voxel_layer) |
3 | 3 |
|
4 | | -find_package(catkin REQUIRED |
5 | | - COMPONENTS |
6 | | - cmake_modules |
7 | | - dynamic_reconfigure |
8 | | - geometry_msgs |
9 | | - laser_geometry |
10 | | - map_msgs |
11 | | - message_filters |
12 | | - message_generation |
13 | | - nav_msgs |
14 | | - pcl_conversions |
15 | | - pcl_ros |
16 | | - pluginlib |
17 | | - roscpp |
18 | | - sensor_msgs |
19 | | - std_msgs |
20 | | - tf |
21 | | - visualization_msgs |
22 | | - voxel_grid |
23 | | - costmap_2d |
24 | | - ) |
25 | | - |
26 | | -find_package(PCL REQUIRED) |
27 | | -remove_definitions(-DDISABLE_LIBUSB-1.0) |
| 4 | +if(NOT WIN32) |
| 5 | + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14") |
| 6 | +endif() |
| 7 | + |
| 8 | +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") |
| 9 | + add_compile_options(-Wall -Wextra -Wpedantic) |
| 10 | +endif() |
| 11 | + |
| 12 | +find_package(ament_cmake REQUIRED) |
| 13 | +find_package(geometry_msgs REQUIRED) |
| 14 | +find_package(laser_geometry REQUIRED) |
| 15 | +find_package(map_msgs REQUIRED) |
| 16 | +find_package(message_filters REQUIRED) |
| 17 | +find_package(nav_msgs REQUIRED) |
| 18 | +find_package(nav2_msgs REQUIRED) |
| 19 | +find_package(pcl_conversions REQUIRED) |
| 20 | +find_package(pluginlib REQUIRED) |
| 21 | +find_package(sensor_msgs REQUIRED) |
| 22 | +find_package(rclcpp REQUIRED) |
| 23 | +find_package(std_msgs REQUIRED) |
| 24 | +find_package(tf2 REQUIRED) |
| 25 | +find_package(tf2_ros REQUIRED) |
| 26 | +find_package(visualization_msgs REQUIRED) |
| 27 | +find_package(nav2_voxel_grid REQUIRED) |
| 28 | +find_package(nav2_costmap_2d REQUIRED) |
28 | 29 | find_package(Eigen3 REQUIRED) |
29 | | -find_package(Boost REQUIRED COMPONENTS system thread) |
| 30 | + |
| 31 | +find_package(PCL REQUIRED COMPONENTS filters common) |
| 32 | +if(NOT "${PCL_LIBRARIES}" STREQUAL "") |
| 33 | + # This package fails to build on Debian Stretch with a linking error against |
| 34 | + # 'Qt5::Widgets'. This is a transitive dependency that comes in to PCL via |
| 35 | + # the PCL dependency on VTK. However, we don't actually care about the Qt |
| 36 | + # dependencies for this package, so just remove them. This is similar to the |
| 37 | + # workaround in https://github.com/ros-perception/perception_pcl/pull/151, |
| 38 | + # and can be removed when Stretch goes out of support. |
| 39 | + list(REMOVE_ITEM PCL_LIBRARIES |
| 40 | + "vtkGUISupportQt" |
| 41 | + "vtkGUISupportQtOpenGL" |
| 42 | + "vtkGUISupportQtSQL" |
| 43 | + "vtkGUISupportQtWebkit" |
| 44 | + "vtkViewsQt" |
| 45 | + "vtkRenderingQt") |
| 46 | +endif() |
| 47 | + |
| 48 | +set(dependencies |
| 49 | + geometry_msgs |
| 50 | + laser_geometry |
| 51 | + map_msgs |
| 52 | + message_filters |
| 53 | + nav_msgs |
| 54 | + pcl_conversions |
| 55 | + pluginlib |
| 56 | + sensor_msgs |
| 57 | + nav2_msgs |
| 58 | + rclcpp |
| 59 | + std_msgs |
| 60 | + tf2 |
| 61 | + tf2_ros |
| 62 | + visualization_msgs |
| 63 | + nav2_voxel_grid |
| 64 | + nav2_costmap_2d) |
| 65 | + |
| 66 | +set(library_name nonpersistent_voxel_layer_core) |
| 67 | + |
| 68 | +add_definitions(${EIGEN3_DEFINITIONS}) |
| 69 | + |
30 | 70 | include_directories( |
31 | 71 | include |
32 | | - ${catkin_INCLUDE_DIRS} |
33 | | - ${EIGEN3_INCLUDE_DIRS} |
34 | 72 | ${PCL_INCLUDE_DIRS} |
35 | | - ${Boost_INCLUDE_DIRS} |
| 73 | + ${EIGEN3_INCLUDE_DIRS} |
36 | 74 | ) |
37 | 75 |
|
38 | | -add_definitions(${EIGEN3_DEFINITIONS}) |
| 76 | +add_library(${library_name} SHARED |
| 77 | + plugins/nonpersistent_voxel_layer.cpp |
| 78 | +) |
39 | 79 |
|
40 | | -# dynamic reconfigure |
41 | | -generate_dynamic_reconfigure_options( |
42 | | - cfg/NonPersistentVoxelPlugin.cfg |
| 80 | +target_compile_definitions(${library_name} PUBLIC "PLUGINLIB__DISABLE_BOOST_FUNCTIONS") |
| 81 | + |
| 82 | +target_link_libraries(${library_name} |
| 83 | + ${PCL_LIBRARIES} |
| 84 | + ${EIGEN3_LIBRARIES} |
43 | 85 | ) |
44 | 86 |
|
45 | | -catkin_package( |
46 | | - INCLUDE_DIRS |
47 | | - include |
48 | | - LIBRARIES nonpersistent_voxel_layer |
49 | | - CATKIN_DEPENDS |
50 | | - dynamic_reconfigure |
51 | | - geometry_msgs |
52 | | - laser_geometry |
53 | | - map_msgs |
54 | | - costmap_2d |
55 | | - message_filters |
56 | | - message_runtime |
57 | | - nav_msgs |
58 | | - pcl_ros |
59 | | - pluginlib |
60 | | - roscpp |
61 | | - sensor_msgs |
62 | | - std_msgs |
63 | | - tf |
64 | | - visualization_msgs |
65 | | - voxel_grid |
66 | | - DEPENDS |
67 | | - PCL |
68 | | - EIGEN3 |
69 | | - Boost |
| 87 | +ament_target_dependencies(${library_name} |
| 88 | + ${dependencies} |
70 | 89 | ) |
71 | 90 |
|
72 | | -add_library(nonpersistent_voxel_layer |
73 | | - plugins/nonpersistent_voxel_layer.cpp |
| 91 | +if(BUILD_TESTING) |
| 92 | + find_package(ament_lint_auto REQUIRED) |
| 93 | + ament_lint_auto_find_test_dependencies() |
| 94 | +endif() |
| 95 | + |
| 96 | +install(TARGETS ${library_name} |
| 97 | + ARCHIVE DESTINATION lib |
| 98 | + LIBRARY DESTINATION lib |
| 99 | + RUNTIME DESTINATION lib |
74 | 100 | ) |
75 | | -add_dependencies(nonpersistent_voxel_layer ${PROJECT_NAME}_gencfg) |
76 | | -target_link_libraries(nonpersistent_voxel_layer ${catkin_LIBRARIES}) |
77 | 101 |
|
78 | | -install(TARGETS |
79 | | - nonpersistent_voxel_layer |
80 | | - ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} |
81 | | - LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} |
| 102 | +install(DIRECTORY example |
| 103 | + DESTINATION share |
82 | 104 | ) |
83 | 105 |
|
84 | 106 | install(FILES costmap_plugins.xml |
85 | | - DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} |
| 107 | + DESTINATION share |
86 | 108 | ) |
87 | 109 |
|
88 | | -install(DIRECTORY include/nonpersistent_voxel_layer/ |
89 | | - DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} |
90 | | - PATTERN ".svn" EXCLUDE |
91 | | -) |
| 110 | +ament_export_include_directories(include) |
| 111 | +ament_export_libraries(${library_name}) |
| 112 | +ament_export_dependencies(${dependencies}) |
| 113 | +pluginlib_export_plugin_description_file(nav2_costmap_2d costmap_plugins.xml) |
| 114 | +ament_package() |
0 commit comments