CMakeLists.txt¶
The CMakeLists.txt file configures the cartographer_rviz package for the ament_cmake build system. It requires CMake 3.5 or newer and defaults the C++ standard to C++17, turning on -Wall -Wextra for GCC and Clang. CMAKE_AUTOMOC is enabled so that the Qt meta-object compiler processes the plugin classes.
Dependencies¶
The build imports several packages:
ament_cmake,cartographer(which provides$CARTOGRAPHER_CMAKE_DIR/functions.cmake),absl,cartographer_ros,cartographer_ros_msgs,Eigen3,pluginlib,rclcpp,rviz_common,rviz_ogre_vendor,rviz_rendering, andThreads.BUILD_SHARED_LIBSis set toOFFand an optionBUILD_GRPC(defaultfalse) is declared, both forwarded to the Cartographer project initialization helpergoogle_initialize_cartographer_project().
Plugin library¶
The rviz_plugins_headers_to_moc list names the three public headers that must be run through the Qt MOC (drawable_submap.h, ogre_slice.h, submaps_display.h).
A shared library cartographer_rviz is built from:
src/drawable_submap.cppsrc/ogre_slice.cppsrc/submaps_display.cppplus the MOC’d headers
Public include directories are the source and build-time include/ tree, and the library links publicly against absl::synchronization, cartographer, cartographer_ros::cartographer_ros, Eigen3::Eigen, rclcpp, rviz_common, rviz_rendering, and tf2_ros; pluginlib is a private dependency.
Plugin and resource registration¶
pluginlib_export_plugin_description_file(rviz_common rviz_plugin_description.xml)exports the plugin manifest so RViz can loadSubmapsDisplay.register_rviz_ogre_media_exports(...)registers theogre_media/materials/glsl120andogre_media/materials/scriptsdirectories as OGRE media resources.
Install and export¶
The library target and the include/ tree are installed under include/${PROJECT_NAME}. The package exports its include directories, library, build targets, and ament dependencies (absl, cartographer, cartographer_ros, eigen, rclcpp, rviz_common, rviz_rendering, tf2_ros) via ament_export_*(), then calls ament_package().