Skip to content

Use O3DE's 3rdParty convention for ROS 2 package dependencies to survive in Prebuilt Gems - #1066

Merged
jhanca-robotecai merged 3 commits into
o3de:developmentfrom
RobotecAI:mzak/ros2_packages_as_3rdparty_targets
Aug 28, 2026
Merged

jhanca-robotecai merged 3 commits into
o3de:developmentfrom
RobotecAI:mzak/ros2_packages_as_3rdparty_targets

Conversation

@zakmat

@zakmat zakmat commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

This PR makes the ROS 2 package dependencies survive the gem export

ROS 2 dependency macros used to link resolved packaged directly with target_link_libraries. That works well for source builds, where the macros run again at every configure but brings some issue when we want Gem to be packaged for distribution.

In the latter case we would like to reuse O3DE existing mechanisms instead of handcrafting cmake files for all possible distribution variants. But using O3DE as is, it drops the deps that were not registered using its own functions.

To make it work I have replaced the target_link_libraries with ly_ equivalent and reused 3rdParty:: system to make the deps discoverable (each dependency is declared under 3rdParty::ROS2::<pkg> and can be resolved independently by producer and consumers machines. 3rdParty is engine's magic that invokes FindROS2.cmake for unresolved names on consumer's side). I have crafted the code so the existing macro signatures are unchanged, therefore no edits in existing Gems are needed.

Additionally I moved the FindROS2.cmake to 3rdParty directory where it belongs by convention.

Also noticed that the above removed the need for custom registration - hence the third commit - but please advise against if you feel we should keep those lines. Some out-of-tree consumers might rely on it.

How was this PR tested?

Linux, ROS 2 Jazzy.
Source builds of the ROS 2 Gem and some of its dependent Gems - unaffected.
Prebuilt Gems flow tested on projects with 25.05 source engine with back-ported extras and SDK 26.05 engine.

zakmat added 3 commits July 27, 2026 14:18
Signed-off-by: Mateusz Żak <mateusz.zak@robotec.ai>
Model-declared dependencies survive the engine's install emission;
consumers re-resolve them via FindROS2.cmake component resolution.

Signed-off-by: Mateusz Żak <mateusz.zak@robotec.ai>
Signed-off-by: Mateusz Żak <mateusz.zak@robotec.ai>
@zakmat
zakmat requested review from a team as code owners July 27, 2026 13:08
@zakmat
zakmat marked this pull request as draft July 27, 2026 13:37
@byrcolin byrcolin added the sig/simulation Categorizes an issue or PR as relevant to SIG Simulation label Jul 28, 2026
@zakmat
zakmat marked this pull request as ready for review August 2, 2026 10:50

@jhanca-robotecai jhanca-robotecai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The code looks correct.

I tested the build with the following set-ups:

  • engine (source, 2605) + simulation Gems + binary proprietary Gem using ROS 2 as dependency
  • engine (SDK, 2605) + simulation Gems + binary proprietary Gem using ROS 2 as dependency

In both setups I built the projects and exported them with mono+release and nonmono+profile configs.

@jhanca-robotecai
jhanca-robotecai merged commit 82c4610 into o3de:development Aug 28, 2026
1 check passed
@jhanca-robotecai
jhanca-robotecai deleted the mzak/ros2_packages_as_3rdparty_targets branch August 28, 2026 07:40
jhanca-robotecai added a commit that referenced this pull request Sep 8, 2026
* Introduce compression publication to ROS 2 camera (#1067)
* Use O3DE's 3rdParty convention for ROS 2 package dependencies to survive in Prebuilt Gems (#1066)
* Upgrade Tracy profiler to 1.14.1, also mark the tracy frame end to RHI OnFrameEnd. (#1090)
* Add workflow to test simulation Gems for PR (#1089)

---------

Signed-off-by: Michał Pełka <michal.pelka@robotec.ai>
Signed-off-by: Mateusz Żak <mateusz.zak@robotec.ai>
Signed-off-by: Ross Charles C. <10781734+rossbridger@users.noreply.github.com>
Signed-off-by: Jan Hanca <jan.hanca@robotec.ai>
Co-authored-by: Michał Pełka <michal.pelka@robotec.ai>
Co-authored-by: Mateusz Żak <mateusz.zak@robotec.ai>
Co-authored-by: Ross Charles C. <10781734+rossbridger@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

sig/simulation Categorizes an issue or PR as relevant to SIG Simulation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants