-
Notifications
You must be signed in to change notification settings - Fork 72
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
74 lines (59 loc) · 2.17 KB
/
CMakeLists.txt
File metadata and controls
74 lines (59 loc) · 2.17 KB
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
cmake_minimum_required(VERSION 3.5z)
project(octomap_rviz_plugins)
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()
find_package(ament_cmake_auto REQUIRED)
ament_auto_find_build_dependencies()
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets)
if(${QT_VERSION} VERSION_LESS 5.15.0)
function(qt_wrap_cpp out)
qt5_wrap_cpp(_sources ${ARGN})
set("${out}" ${_sources} PARENT_SCOPE)
endfunction()
endif()
set(CMAKE_AUTOMOC ON)
# liboctomap-dev is listed in the package.xml, but the CMake package name is octomap,
# so we need to find it explicitly as ament_auto_find_build_dependencies just tries to find
# it as liboctomap-dev (without finding anything)
find_package(octomap REQUIRED)
set(octomap_rviz_plugins_headers_to_moc
include/octomap_rviz_plugins/occupancy_grid_display.hpp
include/octomap_rviz_plugins/occupancy_map_display.hpp
)
foreach(header "${octomap_rviz_plugins_headers_to_moc}")
qt_wrap_cpp(octomap_rviz_plugins_moc_files "${header}")
endforeach()
ament_auto_add_library(${PROJECT_NAME} SHARED
${octomap_rviz_plugins_moc_files}
src/occupancy_grid_display.cpp
src/occupancy_map_display.cpp
)
target_link_libraries(${PROJECT_NAME}
Qt${QT_VERSION_MAJOR}::Widgets
octomap
)
target_compile_definitions(${PROJECT_NAME} PUBLIC "PLUGINLIB__DISABLE_BOOST_FUNCTIONS")
target_compile_definitions(${PROJECT_NAME} PRIVATE "OCTOMAP_RVIZ_PLUGINS_BUILDING_LIBRARY")
# Check version of rclcpp to switch between features (message_lost_callback):
# - Foxy is on rclcpp 2.x
# - Galactic is on rclcpp 9.x
# - Rolling (currently) is on rclcpp 14.x
if(${rclcpp_VERSION_MAJOR} VERSION_LESS "3.0.0")
target_compile_definitions(${PROJECT_NAME} PRIVATE "FOXY")
endif()
pluginlib_export_plugin_description_file(rviz_common plugins_description.xml)
if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
ament_lint_auto_find_test_dependencies()
endif()
ament_auto_package(
INSTALL_TO_SHARE
icons
)