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
feat: use exported targets #69
Merged
clalancette
merged 8 commits into
ros-perception:rolling
from
wep21:use-exported-targets
Aug 15, 2022
Merged
Changes from 6 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
b5d290a
Revert "Cleanup CMakeLists.txt with ament_cmake_auto (#57)"
1ff7b11
feat: use exported targets
d4ea31c
fix include install directory
wep21 1abe866
export targets
wep21 93c2517
fix runtime destination
wep21 be9226b
add missing ament export dependencies
f4e8781
add tf2 sensor msgs include dir for workaround
55f181b
Fixes for the latest.
clalancette File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,106 @@ | ||
cmake_minimum_required(VERSION 3.5) | ||
project(pointcloud_to_laserscan) | ||
|
||
find_package(ament_cmake_auto REQUIRED) | ||
ament_auto_find_build_dependencies() | ||
find_package(ament_cmake REQUIRED) | ||
|
||
ament_auto_add_library(laserscan_to_pointcloud SHARED | ||
src/laserscan_to_pointcloud_node.cpp) | ||
find_package(laser_geometry REQUIRED) | ||
find_package(message_filters REQUIRED) | ||
find_package(rclcpp REQUIRED) | ||
find_package(rclcpp_components REQUIRED) | ||
find_package(sensor_msgs REQUIRED) | ||
find_package(tf2 REQUIRED) | ||
find_package(tf2_ros REQUIRED) | ||
find_package(tf2_sensor_msgs REQUIRED) | ||
|
||
add_library(laserscan_to_pointcloud SHARED | ||
src/laserscan_to_pointcloud_node.cpp) | ||
target_compile_definitions(laserscan_to_pointcloud | ||
PRIVATE "POINTCLOUD_TO_LASERSCAN_BUILDING_DLL") | ||
target_include_directories(laserscan_to_pointcloud PUBLIC | ||
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>" | ||
"$<INSTALL_INTERFACE:include/${PROJECT_NAME}>" | ||
) | ||
target_link_libraries(laserscan_to_pointcloud | ||
laser_geometry::laser_geometry | ||
message_filters::message_filters | ||
rclcpp::rclcpp | ||
rclcpp_components::component | ||
tf2::tf2 | ||
tf2_ros::tf2_ros | ||
# use exported target after https://github.com/ros2/geometry2/pull/536 is merged | ||
# tf2_sensor_msgs::tf2_sensor_msgs | ||
"${sensor_msgs_TARGETS}" | ||
) | ||
rclcpp_components_register_node(laserscan_to_pointcloud | ||
PLUGIN "pointcloud_to_laserscan::LaserScanToPointCloudNode" | ||
EXECUTABLE laserscan_to_pointcloud_node) | ||
|
||
ament_auto_add_library(pointcloud_to_laserscan SHARED | ||
add_library(pointcloud_to_laserscan SHARED | ||
src/pointcloud_to_laserscan_node.cpp) | ||
|
||
target_compile_definitions(pointcloud_to_laserscan | ||
PRIVATE "POINTCLOUD_TO_LASERSCAN_BUILDING_DLL") | ||
target_include_directories(pointcloud_to_laserscan PUBLIC | ||
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>" | ||
"$<INSTALL_INTERFACE:include/${PROJECT_NAME}>" | ||
) | ||
target_link_libraries(pointcloud_to_laserscan | ||
laser_geometry::laser_geometry | ||
message_filters::message_filters | ||
rclcpp::rclcpp | ||
rclcpp_components::component | ||
tf2::tf2 | ||
tf2_ros::tf2_ros | ||
# use exported target after https://github.com/ros2/geometry2/pull/536 is merged | ||
# tf2_sensor_msgs::tf2_sensor_msgs | ||
"${sensor_msgs_TARGETS}" | ||
) | ||
rclcpp_components_register_node(pointcloud_to_laserscan | ||
PLUGIN "pointcloud_to_laserscan::PointCloudToLaserScanNode" | ||
EXECUTABLE pointcloud_to_laserscan_node) | ||
|
||
ament_auto_add_executable(dummy_pointcloud_publisher | ||
add_executable(dummy_pointcloud_publisher | ||
src/dummy_pointcloud_publisher.cpp | ||
) | ||
target_link_libraries(dummy_pointcloud_publisher | ||
rclcpp::rclcpp | ||
"${sensor_msgs_TARGETS}" | ||
) | ||
|
||
install(TARGETS | ||
laserscan_to_pointcloud | ||
pointcloud_to_laserscan | ||
wep21 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
EXPORT export_${PROJECT_NAME} | ||
RUNTIME DESTINATION bin | ||
LIBRARY DESTINATION lib | ||
ARCHIVE DESTINATION lib) | ||
|
||
install(TARGETS | ||
dummy_pointcloud_publisher | ||
DESTINATION lib/${PROJECT_NAME} | ||
) | ||
|
||
install(DIRECTORY include | ||
DESTINATION include/${PROJECT_NAME} | ||
) | ||
|
||
install(DIRECTORY launch | ||
DESTINATION share/${PROJECT_NAME} | ||
) | ||
|
||
if(BUILD_TESTING) | ||
find_package(ament_lint_auto REQUIRED) | ||
ament_lint_auto_find_test_dependencies() | ||
endif() | ||
|
||
ament_auto_package( | ||
INSTALL_TO_SHARE | ||
launch | ||
ament_export_dependencies( | ||
laser_geometry | ||
message_filters | ||
rclcpp | ||
rclcpp_components | ||
sensor_msgs | ||
tf2 | ||
tf2_ros | ||
tf2_sensor_msgs | ||
) | ||
|
||
ament_package() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We are missing the export of the dependencies. This should be something like:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @clalancette I added missing ament_export_dependencies in be9226b. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So when I tried to build this, it failed with:
A workaround would be to add
${tf2_sensor_msgs_INCLUDE_DIRS}
to thetarget_include_directories
. We can either do that, or we can wait for ros2/geometry2#536 to be merged. I leave the decision to you, either is fine with me.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@clalancette I decided to add workaround until ros2/geometry2#536 is merged. f4e8781
Thank you for letting me know.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@clalancette friendly ping