diff --git a/nav2_dwb_controller/dwb_critics/CMakeLists.txt b/nav2_dwb_controller/dwb_critics/CMakeLists.txt index 32b95518e2..17833b7569 100644 --- a/nav2_dwb_controller/dwb_critics/CMakeLists.txt +++ b/nav2_dwb_controller/dwb_critics/CMakeLists.txt @@ -2,68 +2,66 @@ cmake_minimum_required(VERSION 3.5) project(dwb_critics) find_package(ament_cmake REQUIRED) -find_package(nav2_common REQUIRED) find_package(angles REQUIRED) -find_package(nav2_costmap_2d REQUIRED) find_package(costmap_queue REQUIRED) find_package(dwb_core REQUIRED) +find_package(dwb_msgs REQUIRED) find_package(geometry_msgs REQUIRED) +find_package(nav2_common REQUIRED) +find_package(nav2_costmap_2d REQUIRED) +find_package(nav2_util REQUIRED) find_package(nav_2d_msgs REQUIRED) find_package(nav_2d_utils REQUIRED) find_package(pluginlib REQUIRED) find_package(rclcpp REQUIRED) -find_package(sensor_msgs REQUIRED) -find_package(nav2_util REQUIRED) nav2_package() -include_directories( - include -) - add_library(${PROJECT_NAME} SHARED - src/alignment_util.cpp - src/map_grid.cpp - src/goal_dist.cpp - src/path_dist.cpp - src/goal_align.cpp - src/path_align.cpp - src/base_obstacle.cpp - src/obstacle_footprint.cpp - src/oscillation.cpp - src/prefer_forward.cpp - src/rotate_to_goal.cpp - src/twirling.cpp + src/alignment_util.cpp + src/map_grid.cpp + src/goal_dist.cpp + src/path_dist.cpp + src/goal_align.cpp + src/path_align.cpp + src/base_obstacle.cpp + src/obstacle_footprint.cpp + src/oscillation.cpp + src/prefer_forward.cpp + src/rotate_to_goal.cpp + src/twirling.cpp ) - -set(dependencies - angles - nav2_costmap_2d - costmap_queue - dwb_core - geometry_msgs - nav_2d_msgs - nav_2d_utils - pluginlib - rclcpp - sensor_msgs - nav2_util +target_include_directories(${PROJECT_NAME} PUBLIC + "$" + "$" ) - -ament_target_dependencies(${PROJECT_NAME} - ${dependencies} +target_link_libraries(${PROJECT_NAME} PUBLIC + costmap_queue::costmap_queue + dwb_core::dwb_core + ${dwb_msgs_TARGETS} + ${geometry_msgs_TARGETS} + nav2_costmap_2d::nav2_costmap_2d_core + ${nav_2d_msgs_TARGETS} + rclcpp::rclcpp +) +target_link_libraries(${PROJECT_NAME} PRIVATE + angles::angles + nav2_util::nav2_util_core + nav_2d_utils::path_ops + pluginlib::pluginlib ) install(TARGETS ${PROJECT_NAME} - ARCHIVE DESTINATION lib - LIBRARY DESTINATION lib - RUNTIME DESTINATION bin + EXPORT ${PROJECT_NAME} + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib + RUNTIME DESTINATION bin ) install(DIRECTORY include/ - DESTINATION include/ + DESTINATION include/${PROJECT_NAME} ) install(FILES default_critics.xml - DESTINATION share/${PROJECT_NAME} + DESTINATION share/${PROJECT_NAME} ) if(BUILD_TESTING) @@ -72,15 +70,23 @@ if(BUILD_TESTING) set(ament_cmake_copyright_FOUND TRUE) ament_lint_auto_find_test_dependencies() find_package(ament_cmake_gtest REQUIRED) + ament_find_gtest() add_subdirectory(test) endif() -ament_export_include_directories(include) +ament_export_include_directories(include/${PROJECT_NAME}) ament_export_libraries(${PROJECT_NAME}) ament_export_dependencies( - ${dependencies} + costmap_queue + dwb_core + dwb_msgs + geometry_msgs + nav2_costmap_2d + nav_2d_msgs + rclcpp ) +ament_export_targets(${PROJECT_NAME}) pluginlib_export_plugin_description_file(dwb_core default_critics.xml) diff --git a/nav2_dwb_controller/dwb_critics/package.xml b/nav2_dwb_controller/dwb_critics/package.xml index 43e104b547..92d1f2df16 100644 --- a/nav2_dwb_controller/dwb_critics/package.xml +++ b/nav2_dwb_controller/dwb_critics/package.xml @@ -10,20 +10,20 @@ nav2_common angles - nav2_costmap_2d - nav2_util costmap_queue dwb_core + dwb_msgs geometry_msgs + nav2_costmap_2d + nav2_util nav_2d_msgs nav_2d_utils pluginlib rclcpp - sensor_msgs + ament_cmake_gtest ament_lint_common ament_lint_auto - ament_cmake_gtest ament_cmake diff --git a/nav2_dwb_controller/dwb_critics/test/CMakeLists.txt b/nav2_dwb_controller/dwb_critics/test/CMakeLists.txt index 07672ca698..67fc8cb6a3 100644 --- a/nav2_dwb_controller/dwb_critics/test/CMakeLists.txt +++ b/nav2_dwb_controller/dwb_critics/test/CMakeLists.txt @@ -1,14 +1,35 @@ ament_add_gtest(prefer_forward_tests prefer_forward_test.cpp) -target_link_libraries(prefer_forward_tests dwb_critics) +target_link_libraries(prefer_forward_tests + dwb_critics + nav2_costmap_2d::nav2_costmap_2d_core + nav2_util::nav2_util_core + rclcpp::rclcpp +) ament_add_gtest(base_obstacle_tests base_obstacle_test.cpp) -target_link_libraries(base_obstacle_tests dwb_critics) +target_link_libraries(base_obstacle_tests + dwb_critics + dwb_core::dwb_core + rclcpp::rclcpp +) ament_add_gtest(obstacle_footprint_tests obstacle_footprint_test.cpp) -target_link_libraries(obstacle_footprint_tests dwb_critics) +target_link_libraries(obstacle_footprint_tests + dwb_critics + dwb_core::dwb_core + rclcpp::rclcpp +) ament_add_gtest(alignment_util_tests alignment_util_test.cpp) -target_link_libraries(alignment_util_tests dwb_critics) +target_link_libraries(alignment_util_tests + dwb_critics + dwb_core::dwb_core + rclcpp::rclcpp +) ament_add_gtest(twirling_tests twirling_test.cpp) -target_link_libraries(twirling_tests dwb_critics) +target_link_libraries(twirling_tests + dwb_critics + dwb_core::dwb_core + rclcpp::rclcpp +)