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

Update bond_core to modern cmake. #94

Merged
merged 1 commit into from
May 22, 2024
Merged

Conversation

clalancette
Copy link

In particular, make sure it exports targets so downstream users can use those.

While we are here, migrate away from ament_target_dependencies, update to C++17, and move the includes down one directory level (for better workspace overlay support).

In particular, make sure it exports targets so downstream
users can use those.

While we are here, migrate away from ament_target_dependencies,
update to C++17, and move the includes down one directory
level (for better workspace overlay support).

Signed-off-by: Chris Lalancette <clalancette@gmail.com>
@clalancette clalancette requested a review from gbiggs as a code owner May 18, 2024 13:43
@@ -36,8 +37,8 @@ endif()

ament_python_install_package(${PROJECT_NAME})

ament_export_dependencies(ament_cmake)
ament_export_include_directories(include)
ament_export_include_directories(include/${PROJECT_NAME})
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you export targets, what purpose is this line?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's to support downstream packages that haven't yet switched over to targets. It's a nice way to make sure we can gradually enable targets without forcing all downstream packages to switch at the same time.

@clalancette
Copy link
Author

This seems to work in my testing locally, both with Humble and with Rolling. So going ahead and merging this one, thanks for the reviews.

@clalancette clalancette merged commit e41aa43 into ros2 May 22, 2024
5 checks passed
@clalancette clalancette deleted the clalancette/modern-cmake branch May 22, 2024 19:26
@felixf4xu
Copy link

as a general rule, should any project with ament_target_dependencies be updated?

@clalancette
Copy link
Author

as a general rule, should any project with ament_target_dependencies be updated?

It's a good question.

The ROS 2 core, as of Jazzy, has been (almost) completely converted to use target_link_libraries. But we haven't made any communication about this, sort of on purpose. There is one major problem, in that you can't currently use a single target for message packages (e.g. target_link_libraries(lib PRIVATE sensor_msgs::sensor_msgs) doesn't work). Instead, you have to do target_link_libraries(lib PRIVATE ${sensor_msgs_TARGETS}), which ensures you pull in all of targets necessary. We need to fix that before we make a general announcement about, and probably write some documentation on how to convert away from ament_target_dependencies.

That said, if you are OK with that workaround, it is not a bad idea to get started on the conversion, since we eventually do want to deprecate ament_target_dependencies.

@wep21
Copy link

wep21 commented Jun 19, 2024

@clalancette Will you also backport this change into jazzy?

@clalancette
Copy link
Author

As it stands, Rolling and Jazzy use the same development branch, so I just did a release today of bond_core into Jazzy as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants