Skip to content

Conversation

TonyWelte
Copy link

Description

This PR addresses one of the build speedup mentioned in #859.

When add_custom_command is used to generate files that are then used by a target, the add_custom_command becomes implicitly dependent on the target dependencies. In rosidl add_custom_command is used to generate files from the IDL files, the generator does not depend on anything else (except rosidl_generator_c[pp] whose generators depend on rosidl_generator_type_description).

This PR (and the equivalent for rosidl_typesupport, rosidl_typesupport_fastrtps and rosidl_python) adds the DEPENDS_EXPLICIT_ONLY option of add_custom_command to most generators (except for C/CPP).

Note

This option is only useful when using Ninja. When testing use --cmake-args -GNinja

Since the generators are no longer constrained by unnecessary dependencies, they can start immediately. This speeds up the build significantly (2x for px4_msgs on my machine).

Now rolling
ninja_px4_pr ninja_px4_rolling
ninja_test_pr ninja_test_rolling

Warning

DEPENDS_EXPLICIT_ONLY requires cmake 3.27. The version that ships with Ubuntu 24.04 is 3.28, not sure about other supported distributions.
Right now I've bumped the required version to 3.27 but I could instead only add the option when the cmake version is sufficient (if that's preferable ?).

Note

I wanted to also add the option to rosidl_generator_c[pp] and explicitly specify the dependency to rosidl_generator_type_description. I couldn't figure out how to make it work.

Is this user-facing behavior change?

Did you use Generative AI?

no

Additional Information

I've already created PRs for the other packages. I've set then to Draft until this PR is reviewed.

@TonyWelte TonyWelte force-pushed the bugfix/remove-implicit-dependencies branch from 11f6223 to 1c25da9 Compare October 1, 2025 19:55
@InvincibleRMC
Copy link
Contributor

Looking at rhel9 it only supports 3.26.5. The upcoming rhel10 is on 3.30.5. So you would probably have to make it conditional or wait for the switch to rhel10.

Refs:
rhel9
rhel10

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