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

feat: add option to export libraries as cmake targets #455

Open
wants to merge 1 commit into
base: rolling
Choose a base branch
from

Conversation

VRichardJP
Copy link
Contributor

@VRichardJP VRichardJP commented May 29, 2023

Add EXPORT_LIBRARY_TARGETS flag to ament_auto_package() macro.
When the flag is provided, libraries are exported using their cmake target instead of going through ament home-made library export logic.

Although exporting libraries this way is stricter, it makes cmake invocations faster on downstream packages.

Example on Autoware's behavior path planner:

Before: 112s
232429374-d093cf9e-eb10-4aa0-837b-bbc562aba9cd

After: 26s
image

Note: In my original experimentation, cmake time on this package went down to 17s. I have not checked exactly what is slowing things down yet. ament_ex macros are still way faster (8s on this package).

This feature has been experimented on this autoware branch: autowarefoundation/autoware.universe@f3b6226

Note that this experimental branch also leverages extra macros that are not included in this PR, found here: 450b6de

See #453 for more details

Signed-off-by: Vincent Richard <richard-v@macnica.co.jp>
@VRichardJP VRichardJP requested a review from mjeronimo as a code owner May 29, 2023 08:14
@clalancette
Copy link
Contributor

clalancette commented Jun 8, 2023

We are a bit concerned that making things stricter is going to break quite a lot of downstream packages. To get at least some idea of what would happen, here is a full CI run of the ROS 2 core with this in place:

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Windows Build Status

@VRichardJP
Copy link
Contributor Author

Thank you for investigating this.

To be precise, I don't think this PR should break anything dowstream itself. There are only 2 changes here:

  • the EXPORT_LIBRARY_TARGETS flag is not enabled by default. Without the flag the code behavior should remain unchanged.
  • ament_auto_add_library now use the installed headers instead of the ones in the source directory. Since ament_auto macros have always installed headers I don't think it changes anything.

If this PR was to break anything, I think it would show at build time, no during tests.

@clalancette
Copy link
Contributor

Belated I realized that this will have almost no effect on the ROS 2 core, since we don't use ament_auto there. We would need to do a more comprehensive test of downstream packages that do use ament_auto to see if there is fallout from this.

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.

2 participants