Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch dwb_plugins to modern CMake idioms. #4629

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 47 additions & 28 deletions nav2_dwb_controller/dwb_plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,41 @@ cmake_minimum_required(VERSION 3.5)
project(dwb_plugins)

find_package(ament_cmake REQUIRED)
find_package(nav2_common REQUIRED)
find_package(angles REQUIRED)
find_package(dwb_core REQUIRED)
find_package(dwb_msgs REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(nav2_common 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(nav2_util REQUIRED)
find_package(rcl_interfaces REQUIRED)

nav2_package()

set(dependencies
angles
dwb_core
nav_2d_msgs
nav_2d_utils
pluginlib
rclcpp
nav2_util
add_library(standard_traj_generator SHARED
src/standard_traj_generator.cpp
src/limited_accel_generator.cpp
src/kinematic_parameters.cpp
src/xy_theta_iterator.cpp)
target_include_directories(standard_traj_generator PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:include/${PROJECT_NAME}>"
)

include_directories(
include
target_link_libraries(standard_traj_generator PUBLIC
dwb_core::dwb_core
${dwb_msgs_TARGETS}
${geometry_msgs_TARGETS}
nav2_util::nav2_util_core
${nav_2d_msgs_TARGETS}
rclcpp::rclcpp
${rcl_interfaces_TARGETS}
)
target_link_libraries(standard_traj_generator PRIVATE
nav_2d_utils::conversions
pluginlib::pluginlib
)

add_library(standard_traj_generator SHARED
src/standard_traj_generator.cpp
src/limited_accel_generator.cpp
src/kinematic_parameters.cpp
src/xy_theta_iterator.cpp)
ament_target_dependencies(standard_traj_generator ${dependencies})


if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
Expand All @@ -42,23 +45,39 @@ if(BUILD_TESTING)
ament_lint_auto_find_test_dependencies()

find_package(ament_cmake_gtest REQUIRED)
ament_find_gtest()

find_package(nav2_costmap_2d REQUIRED)
find_package(rclcpp_lifecycle REQUIRED)
add_subdirectory(test)
endif()

install(TARGETS standard_traj_generator
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 plugins.xml
DESTINATION share/${PROJECT_NAME}
DESTINATION share/${PROJECT_NAME}
)

ament_export_include_directories(include)
ament_export_include_directories(include/${PROJECT_NAME})
ament_export_libraries(standard_traj_generator)
ament_export_dependencies(
dwb_core
dwb_msgs
geometry_msgs
nav2_util
nav_2d_msgs
rclcpp
rcl_interfaces
)
ament_export_targets(${PROJECT_NAME})

pluginlib_export_plugin_description_file(dwb_core plugins.xml)

ament_package()
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
#include <memory>
#include <string>

#include "rclcpp/rclcpp.hpp"
#include "nav_2d_msgs/msg/twist2_d.hpp"
#include "dwb_plugins/kinematic_parameters.hpp"
#include "nav2_util/lifecycle_node.hpp"
Expand Down
10 changes: 7 additions & 3 deletions nav2_dwb_controller/dwb_plugins/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,21 @@
<buildtool_depend>ament_cmake</buildtool_depend>
<build_depend>nav2_common</build_depend>

<depend>angles</depend>
<depend>dwb_core</depend>
<depend>dwb_msgs</depend>
<depend>geometry_msgs</depend>
<depend>nav2_util</depend>
<depend>nav_2d_msgs</depend>
<depend>nav_2d_utils</depend>
<depend>pluginlib</depend>
<depend>rclcpp</depend>
<depend>nav2_util</depend>
<depend>rcl_interfaces</depend>

<test_depend>ament_cmake_gtest</test_depend>
<test_depend>ament_lint_common</test_depend>
<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_cmake_gtest</test_depend>
<test_depend>nav2_costmap_2d</test_depend>
<test_depend>rclcpp_lifecycle</test_depend>

<export>
<build_type>ament_cmake</build_type>
Expand Down
25 changes: 22 additions & 3 deletions nav2_dwb_controller/dwb_plugins/test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,29 @@
ament_add_gtest(vtest velocity_iterator_test.cpp)
target_link_libraries(vtest standard_traj_generator)

ament_add_gtest(twist_gen_test twist_gen.cpp)
target_link_libraries(twist_gen_test standard_traj_generator)
target_link_libraries(twist_gen_test
standard_traj_generator
dwb_core::dwb_core
${dwb_msgs_TARGETS}
${geometry_msgs_TARGETS}
nav2_util::nav2_util_core
${nav_2d_msgs_TARGETS}
rclcpp::rclcpp
rclcpp_lifecycle::rclcpp_lifecycle
)

ament_add_gtest(kinematic_parameters_test kinematic_parameters_test.cpp)
target_link_libraries(kinematic_parameters_test standard_traj_generator)
target_link_libraries(kinematic_parameters_test
standard_traj_generator
rclcpp::rclcpp
${rcl_interfaces_TARGETS}
)

ament_add_gtest(speed_limit_test speed_limit_test.cpp)
target_link_libraries(speed_limit_test standard_traj_generator)
target_link_libraries(speed_limit_test
standard_traj_generator
nav2_costmap_2d::nav2_costmap_2d_core
nav2_util::nav2_util_core
rclcpp::rclcpp
)
Loading