|
1 |
| -cmake_minimum_required(VERSION 3.0.2) |
| 1 | +cmake_minimum_required(VERSION 3.5z) |
2 | 2 | project(octomap_rviz_plugins)
|
3 | 3 |
|
4 |
| -find_package(catkin REQUIRED COMPONENTS octomap_msgs |
5 |
| - roscpp |
6 |
| - rviz |
7 |
| - |
8 |
| -) |
9 |
| - |
10 |
| -find_package(octomap REQUIRED) |
11 |
| -find_package(Boost REQUIRED COMPONENTS thread ) |
| 4 | +if(NOT CMAKE_CXX_STANDARD) |
| 5 | + set(CMAKE_CXX_STANDARD 14) |
| 6 | + set(CMAKE_CXX_STANDARD_REQUIRED ON) |
| 7 | + set(CMAKE_CXX_EXTENSIONS OFF) |
| 8 | +endif() |
| 9 | +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") |
| 10 | + add_compile_options(-Wall -Wextra -Wpedantic) |
| 11 | +endif() |
12 | 12 |
|
13 |
| -find_package(Qt5 COMPONENTS Core Widgets REQUIRED) |
14 |
| -set(QT_LIBRARIES Qt5::Widgets) |
| 13 | +find_package(ament_cmake_auto REQUIRED) |
| 14 | +ament_auto_find_build_dependencies() |
15 | 15 |
|
| 16 | +find_package(Qt5 REQUIRED COMPONENTS Widgets) |
16 | 17 | set(CMAKE_AUTOMOC ON)
|
17 | 18 |
|
18 |
| -add_definitions(-DQT_NO_KEYWORDS) |
19 |
| - |
20 |
| -catkin_package( |
21 |
| - INCLUDE_DIRS include |
22 |
| - LIBRARIES ${PROJECT_NAME} |
23 |
| - CATKIN_DEPENDS octomap_msgs |
24 |
| - roscpp |
25 |
| - rviz |
26 |
| - DEPENDS OCTOMAP |
| 19 | +set(octomap_rviz_plugins_headers_to_moc |
| 20 | + include/octomap_rviz_plugins/occupancy_grid_display.hpp |
| 21 | + include/octomap_rviz_plugins/occupancy_map_display.hpp |
27 | 22 | )
|
28 |
| - |
29 |
| - |
30 |
| -include_directories(include |
31 |
| - ${catkin_INCLUDE_DIRS} |
32 |
| - ${Boost_INCLUDE_DIRS} |
33 |
| - ${OCTOMAP_INCLUDE_DIRS}) |
34 |
| - |
35 |
| -link_directories(${catkin_LIBRARY_DIRS} |
36 |
| - ${Boost_LIBRARY_DIRS} |
37 |
| - ${OCTOMAP_LIBRARY_DIRS}) |
38 | 23 |
|
| 24 | +foreach(header "${octomap_rviz_plugins_headers_to_moc}") |
| 25 | + qt5_wrap_cpp(octomap_rviz_plugins_moc_files "${header}") |
| 26 | +endforeach() |
39 | 27 |
|
40 |
| -set(SOURCE_FILES |
| 28 | +ament_auto_add_library(${PROJECT_NAME} SHARED |
| 29 | + ${octomap_rviz_plugins_moc_files} |
41 | 30 | src/occupancy_grid_display.cpp
|
42 |
| - src/occupancy_map_display.cpp |
| 31 | + src/occupancy_map_display.cpp |
43 | 32 | )
|
44 | 33 |
|
45 |
| -set(HEADER_FILES |
46 |
| - include/octomap_rviz_plugins/occupancy_grid_display.h |
47 |
| - include/octomap_rviz_plugins/occupancy_map_display.h |
| 34 | +target_link_libraries(${PROJECT_NAME} |
| 35 | + Qt5::Widgets |
| 36 | + ${OCTOMAP_LIBRARIES} |
48 | 37 | )
|
49 | 38 |
|
50 |
| -add_library(${PROJECT_NAME} MODULE ${SOURCE_FILES} ${HEADER_FILES}) |
51 |
| -target_link_libraries(${PROJECT_NAME} ${QT_LIBRARIES} ${Boost_LIBRARIES} ${OCTOMAP_LIBRARIES} ${catkin_LIBRARIES}) |
52 |
| -target_compile_options(${PROJECT_NAME} PUBLIC "-Wno-register") # Avoid OGRE deprecaton warnings under C++17 |
53 |
| - |
54 |
| -install(DIRECTORY include/${PROJECT_NAME}/ |
55 |
| - DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} |
| 39 | +target_include_directories(${PROJECT_NAME} PUBLIC |
| 40 | + ${Qt5Widgets_INCLUDE_DIRS} |
56 | 41 | )
|
57 | 42 |
|
58 |
| -install(TARGETS ${PROJECT_NAME} |
59 |
| - ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} |
60 |
| - LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} |
61 |
| - RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} |
62 |
| -) |
| 43 | +target_compile_definitions(${PROJECT_NAME} PUBLIC "PLUGINLIB__DISABLE_BOOST_FUNCTIONS") |
| 44 | +target_compile_definitions(${PROJECT_NAME} PRIVATE "OCTOMAP_RVIZ_PLUGINS_BUILDING_LIBRARY") |
| 45 | + |
| 46 | +pluginlib_export_plugin_description_file(rviz_common plugins_description.xml) |
| 47 | + |
| 48 | +if(BUILD_TESTING) |
| 49 | + find_package(ament_lint_auto REQUIRED) |
| 50 | + ament_lint_auto_find_test_dependencies() |
| 51 | +endif() |
63 | 52 |
|
64 |
| -install(FILES plugin_description.xml |
65 |
| - DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} |
| 53 | +ament_auto_package( |
| 54 | + INSTALL_TO_SHARE |
| 55 | + icons |
66 | 56 | )
|
67 | 57 |
|
68 | 58 |
|
0 commit comments