cmake_minimum_required(VERSION 3.5.1) project(grid_map_rviz_plugin) set(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}") add_compile_options(-Wall -Wextra -Wpedantic) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) find_package(catkin REQUIRED COMPONENTS rviz grid_map_ros grid_map_msgs ) catkin_package( INCLUDE_DIRS include LIBRARIES ${PROJECT_NAME} CATKIN_DEPENDS rviz grid_map_ros grid_map_msgs ) include_directories( include SYSTEM ${catkin_INCLUDE_DIRS} ) link_directories(${catkin_LIBRARY_DIRS}) ## This setting causes Qt's "MOC" generation to happen automatically. set(CMAKE_AUTOMOC ON) set(INCLUDE_FILES_QT include/grid_map_rviz_plugin/GridMapDisplay.hpp include/grid_map_rviz_plugin/modified/message_filter_display.h include/grid_map_rviz_plugin/modified/frame_manager.h ) ## This plugin includes Qt widgets, so we must include Qt. ## We'll use the version that rviz used so they are compatible. if(rviz_QT_VERSION VERSION_LESS "5") message(STATUS "Using Qt4 based on the rviz_QT_VERSION: ${rviz_QT_VERSION}") find_package(Qt4 ${rviz_QT_VERSION} EXACT REQUIRED QtCore QtGui) ## pull in all required include dirs, define QT_LIBRARIES, etc. include(${QT_USE_FILE}) qt4_wrap_cpp(MOC_FILES ${INCLUDE_FILES_QT} ) else() message(STATUS "Using Qt5 based on the rviz_QT_VERSION: ${rviz_QT_VERSION}") find_package(Qt5 ${rviz_QT_VERSION} EXACT REQUIRED Core Widgets) ## make target_link_libraries(${QT_LIBRARIES}) pull in all required dependencies set(QT_LIBRARIES Qt5::Widgets) QT5_WRAP_CPP(MOC_FILES ${INCLUDE_FILES_QT} ) endif() ## Avoid Qt signals and slots defining "emit", "slots", etc. add_definitions(-DQT_NO_KEYWORDS) ## The list of source files. ## The generated MOC files are included automatically as headers. set(SOURCE_FILES src/GridMapDisplay.cpp src/GridMapVisual.cpp ) ## An rviz plugin is just a shared library, so here we declare the ## library to be called ${PROJECT_NAME} and specify the list of ## source files we collected above in ${SOURCE_FILES}. add_library(${PROJECT_NAME} ${SOURCE_FILES} ${MOC_FILES} ) ## Link the executable with whatever Qt libraries have been defined by ## the find_package(Qt4 ...) line above, or by the ## set(QT_LIBRARIES Qt5::Widgets), and with whatever libraries ## catkin has included. target_link_libraries(${PROJECT_NAME} ${QT_LIBRARIES} ${catkin_LIBRARIES} ) ## Install rules install( DIRECTORY include/${PROJECT_NAME}/ DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} ) install( TARGETS ${PROJECT_NAME} ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} ) install( FILES plugin_description.xml DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} ) install( DIRECTORY icons DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/icons ) install( DIRECTORY doc DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} ) ############# ## Testing ## ############# if (CATKIN_ENABLE_TESTING) catkin_add_gtest(${PROJECT_NAME}-test test/test_grid_map_rviz_plugin.cpp test/empty_test.cpp ) target_include_directories(${PROJECT_NAME}-test PRIVATE include ) target_include_directories(${PROJECT_NAME}-test SYSTEM PUBLIC ${catkin_INCLUDE_DIRS} ${EIGEN3_INCLUDE_DIRS} ) target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME} ${catkin_LIBRARIES} ) ################### ## Code_coverage ## ################### find_package(cmake_code_coverage QUIET) if(cmake_code_coverage_FOUND) add_gtest_coverage( TEST_BUILD_TARGETS ${PROJECT_NAME}-test ) endif() endif() ################# ## Clang_tools ## ################# find_package(cmake_clang_tools QUIET) if(cmake_clang_tools_FOUND) add_default_clang_tooling( DISABLE_CLANG_FORMAT ) endif(cmake_clang_tools_FOUND)