Skip to content

Add USE_SCOPED_HEADER_INSTALL_DIR option to ament_auto_package#577

Merged
sloretz merged 4 commits intoament:humblefrom
HansRobo:humble_backport_540_fixed
Apr 18, 2025
Merged

Add USE_SCOPED_HEADER_INSTALL_DIR option to ament_auto_package#577
sloretz merged 4 commits intoament:humblefrom
HansRobo:humble_backport_540_fixed

Conversation

@HansRobo
Copy link
Copy Markdown
Contributor

@HansRobo HansRobo commented Apr 9, 2025

This is a backport of #540 with backward-compatible workaround discussed with @sloretz in #574.

This pull-request adds USE_SCOPED_HEADER_INSTALL_DIR option to ament_auto_package function.
If you set the option, header install destination will switch to include/${PROJECT_NAME} from include.
If you do not set the option and your package has include directory, ament_auto_package will install headers to lagacy destination, include directory and show warning message like below.

Starting >>> timer_experiments
--- stderr: timer_experiments
CMake Warning at /__w/ros2_sandbox/ros2_sandbox/install/share/ament_cmake_auto/cmake/ament_auto_package.cmake:80 (message):
  In this package, headers install destination is set to `include` by
  ament_auto_package.  It is recommended to install
  `include/timer_experiments` instead and will be the default behavior of
  ament_auto_package from ROS 2 Kilted Kaiju.  On distributions before
  Kilted, ament_auto_package behaves the same way when you use
  USE_SCOPED_HEADER_INSTALL_DIR option.
Call Stack (most recent call first):
  CMakeLists.txt:33 (ament_auto_package)

With this option, users can switch the behavior of ament_auto_package and transition to the new behavior smoothly.

If this pull-request is merged, I'll submit the PRs with same content to iron and jazzy branch.

Tests

build testing and install directory checking are performed on GitHub Actions in my repository.
HansRobo/ros2_sandbox#2

There are 2 packages that have include directory.

  • parent_package : use ament_auto_package with USE_SCOPED_HEADER_INSTALL_DIR option
  • timer_experiments : use ament_auto_package without USE_SCOPED_HEADER_INSTALL_DIR option

build log

expected behavior

  • parent_package: no warning
  • timer_experiments: shows implemented warning

actual behavior

The build logs have expected behavior.

https://github.com/HansRobo/ros2_sandbox/actions/runs/14345897198/job/40215478181?pr=2#step:8:53

Starting >>> parent_package
Starting >>> clock_publisher
Starting >>> timer_experiments
--- stderr: timer_experiments
CMake Warning at /__w/ros2_sandbox/ros2_sandbox/install/share/ament_cmake_auto/cmake/ament_auto_package.cmake:80 (message):
  In this package, headers install destination is set to `include` by
  ament_auto_package.  It is recommended to install
  `include/timer_experiments` instead and will be the default behavior of
  ament_auto_package from ROS 2 Kilted Kaiju.  On distributions before
  Kilted, ament_auto_package behaves the same way when you use
  USE_SCOPED_HEADER_INSTALL_DIR option.
Call Stack (most recent call first):
  CMakeLists.txt:33 (ament_auto_package)


---
Finished <<< timer_experiments [5.47s]
Finished <<< parent_package [6.04s]

install directory

expected behavior

  • parent_package: headers are installed to include/parent_package/parent_package
  • timer_experiments: headers are installed to include/timer_experiments

actual behavior

The installed location is as expected.

https://github.com/HansRobo/ros2_sandbox/actions/runs/14345897198/job/40215478181?pr=2#step:9:7

tree ./install/include
./install/include
├── parent_package
│   └── parent_package
│       └── test_node.hpp
└── timer_experiments
    └── timer_statistics.hpp

HansRobo added 3 commits April 9, 2025 09:39
Signed-off-by: Kotaro Yoshimoto <pythagora.yoshimoto@gmail.com>
…R_INSTALL_DIR option

Signed-off-by: Kotaro Yoshimoto <pythagora.yoshimoto@gmail.com>
Signed-off-by: Kotaro Yoshimoto <pythagora.yoshimoto@gmail.com>
@HansRobo
Copy link
Copy Markdown
Contributor Author

@sloretz Could you review this?
This is the solution we discussed in #574

Copy link
Copy Markdown
Contributor

@sloretz sloretz left a comment

Choose a reason for hiding this comment

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

Thank you for the PR!

If this pull-request is merged, I'll submit the PRs with same content to iron and jazzy branch.

Since Iron is EOL, please only submit a PR for the Jazzy branch.

Signed-off-by: Kotaro Yoshimoto <pythagora.yoshimoto@gmail.com>
Copy link
Copy Markdown
Contributor

@sloretz sloretz left a comment

Choose a reason for hiding this comment

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

Thank you for the PR!

@sloretz
Copy link
Copy Markdown
Contributor

sloretz commented Apr 17, 2025

Pulls: #577
Gist: https://gist.githubusercontent.com/sloretz/4113c80369c66218cd1e3e6168d12e06/raw/9f966586419c96dfc9bb1daa42ac8400f5b1c90c/ros2.repos
BUILD args: --packages-above-and-dependencies ament_cmake_auto
TEST args: --packages-above ament_cmake_auto
ROS Distro: humble
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/15712

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

@sloretz sloretz merged commit 30989cd into ament:humble Apr 18, 2025
3 checks passed
@HansRobo
Copy link
Copy Markdown
Contributor Author

@audrow Could you release ament_cmake for Humble in ros/rosdistro to use this patch from apt-installed version?

@christophebedard
Copy link
Copy Markdown
Member

I've created a new release for Humble: ros/rosdistro#46674. It will be available from the apt repo after the next sync, which will probably happen around mid-July.

@HansRobo
Copy link
Copy Markdown
Contributor Author

Thank you very much!

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.

3 participants