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

Normalize header install path #467

Merged
merged 3 commits into from
Feb 7, 2025

Conversation

scpeters
Copy link
Member

@scpeters scpeters commented Feb 7, 2025

🦟 Bug fix

Fixes #461

Summary

The "meta" header file that contains includes of all other core / component header files is installed to a relative path, one folder above the other include files. This was causing a cmake warning that the path wasn't normalized. This PR normalizes that path variable to fix the warning. It also renames some variables from master_* to meta_* (6bd2d3d) for consistency and improved language and defines distinct variables for the config_header_install_dir and meta_header_install_dir (part of d32068d) to clarify what each variable represents, since the "meta" header previously wasn't actually installed to meta_header_install_dir.

This should be tested with downstream packages, including gz-plugin (to confirm the cmake warning is fixed) and sdformat (which uses the REPLACE_INCLUDE_PATH option).

Checklist

  • Signed all commits for DCO
  • Added tests
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • Consider updating Python bindings (if the library has them)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers

Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining Signed-off-by messages.

Signed-off-by: Steve Peters <scpeters@openrobotics.org>
The "meta" header containing a list of all includes in
the package is currently installed one folder above the
other includes. This cleans up the definition of that
install path by normalizing it to fix a cmake warning
and also renaming some variables for clarity.

Signed-off-by: Steve Peters <scpeters@openrobotics.org>
@scpeters
Copy link
Member Author

scpeters commented Feb 7, 2025

@azeey
Copy link
Contributor

azeey commented Feb 7, 2025

We also need to make sure that we don't break packaging on the ROS side for the vendor packages. Namely, we need to ensure that no absolute install paths are used. We can check if the following fails on a downstream library

cmake  -DCMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION=ON -P cmake_install.cmake

set(meta_header_install_dir ${GZ_INCLUDE_INSTALL_DIR_FULL}/${PROJECT_INCLUDE_DIR}/${component_name})
# Define the install directory for the "config" header
# The "meta" header will be installed one folder above this
set(config_header_install_dir ${GZ_INCLUDE_INSTALL_DIR_FULL}/${PROJECT_INCLUDE_DIR})
Copy link
Member Author

Choose a reason for hiding this comment

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

I messed up on this line, will fix

Copy link
Member Author

Choose a reason for hiding this comment

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

Signed-off-by: Steve Peters <scpeters@openrobotics.org>
@scpeters
Copy link
Member Author

scpeters commented Feb 7, 2025

@scpeters
Copy link
Member Author

scpeters commented Feb 7, 2025

We also need to make sure that we don't break packaging on the ROS side for the vendor packages. Namely, we need to ensure that no absolute install paths are used. We can check if the following fails on a downstream library

cmake  -DCMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION=ON -P cmake_install.cmake

I built this branch with gz-math8 in a colcon workspace and ran your suggested command in the build/gz-math8 folder and it worked in that specific case

Copy link
Contributor

@azeey azeey left a comment

Choose a reason for hiding this comment

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

LGTM!

@scpeters
Copy link
Member Author

scpeters commented Feb 7, 2025

I'll merge this now so it can be included in the next ubuntu nightly build of gz-cmake4, and we can watch the -ci-main- jobs for any failures. If that looks ok, we can proceed with a prerelease to get extra testing with homebrew, or just make a stable release directly

@scpeters scpeters merged commit 5b556fb into gz-cmake4 Feb 7, 2025
9 of 10 checks passed
@scpeters scpeters deleted the scpeters/normalize_header_install_path branch February 7, 2025 23:12
@Crola1702
Copy link

I think this change requires some porting to other branches. The warnings are appearing on all gz-plugin-homebrew jobs:

Also, do you know why this change didn't solve the warning in gz-plugin3?

Cc: @scpeters

@scpeters
Copy link
Member Author

I think this change requires some porting to other branches. The warnings are appearing on all gz-plugin-homebrew jobs:

the change may need to be slightly different since the cmake_path command I used may not be available in older versions of cmake

@scpeters
Copy link
Member Author

Also, do you know why this change didn't solve the warning in gz-plugin3?

a new release is needed of this package for CI jobs that use released binaries (Ubuntu and macOS homebrew)

I'll merge this now so it can be included in the next ubuntu nightly build of gz-cmake4, and we can watch the -ci-main- jobs for any failures. If that looks ok, we can proceed with a prerelease to get extra testing with homebrew, or just make a stable release directly

If we don't see any breakages on the main branches, which use nightly builds, then I'll make a prerelease, so we can see the results on macOS homebrew

@scpeters
Copy link
Member Author

Also, do you know why this change didn't solve the warning in gz-plugin3?

a new release is needed of this package for CI jobs that use released binaries (Ubuntu and macOS homebrew)

I'll merge this now so it can be included in the next ubuntu nightly build of gz-cmake4, and we can watch the -ci-main- jobs for any failures. If that looks ok, we can proceed with a prerelease to get extra testing with homebrew, or just make a stable release directly

If we don't see any breakages on the main branches, which use nightly builds, then I'll make a prerelease, so we can see the results on macOS homebrew

#469

@scpeters
Copy link
Member Author

https://github.com/Mergifyio backport gz-cmake3

Copy link

mergify bot commented Feb 13, 2025

backport gz-cmake3

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request Feb 13, 2025
The "meta" header containing a list of all includes in
the package is currently installed one folder above the
other includes. This cleans up the definition of that
install path by normalizing it to fix a cmake warning
and also renaming some variables for clarity.

Signed-off-by: Steve Peters <scpeters@openrobotics.org>
(cherry picked from commit 5b556fb)
scpeters added a commit that referenced this pull request Feb 14, 2025
The "meta" header containing a list of all includes in
the package is currently installed one folder above the
other includes. This cleans up the definition of that
install path by normalizing it to fix a cmake warning
and also renaming some variables for clarity.

Signed-off-by: Steve Peters <scpeters@openrobotics.org>
(cherry picked from commit 5b556fb)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏛️ ionic Gazebo Ionic 🪵 jetty Gazebo Jetty
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

cmake warnings related to CMP0177 with cmake 3.31.0
3 participants