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: use modern cmake #70

Merged
merged 6 commits into from
Feb 24, 2024
Merged

feat: use modern cmake #70

merged 6 commits into from
Feb 24, 2024

Conversation

wep21
Copy link

@wep21 wep21 commented Feb 13, 2024

  • update CMakeLists.txt to use modern cmake

Signed-off-by: wep21 <daisuke.nishimatsu1021@gmail.com>
@wep21
Copy link
Author

wep21 commented Feb 13, 2024

@jonbinney Could you review this PR?

@jonbinney
Copy link
Contributor

Is this needed yet? Looking at this page, humble hawksbill only needs cmake 3.14 on macos, and 3.18.4 on debian bullseye, so this would presumably break things for those platforms.

What advantages does this change provide?

@Ryanf55
Copy link

Ryanf55 commented Feb 17, 2024

Hello,

This is a great improvement. Currently, to consume filters, you have to rely on the old-style CMake variable to get the include directories:

  • filters_INCLUDE_DIRS

This is because the filters library does not use ament_export_targets.

It is much preferable for consumers to just have to use find_package and then target_link_libraries to an exported namespace target.

The ROS tutorials now share that ament_export_include_directories is not necessary when using ament_export_targets.
Reference: https://docs.ros.org/en/humble/How-To-Guides/Ament-CMake-Documentation.html#installing

We both have made similar changes improvements across a suite of ROS 2 packages with no reports of bugs.

CMakeLists.txt Outdated Show resolved Hide resolved
CMakeLists.txt Outdated
INTERFACE
Boost::boost
)
target_include_directories(realtime_circular_buffer
Copy link

Choose a reason for hiding this comment

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

Instead of repeating this call, consider using a for loop and giving a list of targets to set up the includes for.
This would reduce code duplication.

Copy link
Author

Choose a reason for hiding this comment

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

address here

CMakeLists.txt Outdated
ament_target_dependencies(mean
"pluginlib"
"rclcpp"
realtime_circular_buffer
Copy link

Choose a reason for hiding this comment

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

Can you specify PUBLIC or PRIVATE for the linkage type?

Copy link
Author

Choose a reason for hiding this comment

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

address here

Co-authored-by: Ryan <ryanfriedman5410+github@gmail.com>
Signed-off-by: wep21 <daisuke.nishimatsu1021@gmail.com>
Signed-off-by: wep21 <daisuke.nishimatsu1021@gmail.com>
Signed-off-by: wep21 <daisuke.nishimatsu1021@gmail.com>
Signed-off-by: wep21 <daisuke.nishimatsu1021@gmail.com>
@wep21
Copy link
Author

wep21 commented Feb 22, 2024

@jonbinney I appreciate it if you could decide whether to merge this PR based on the advantages described by @Ryanf55.

@jonbinney
Copy link
Contributor

@Ryanf55 thank you for reviewing this, and @wep21 thanks for making the changes. This looks good now, merging!

@jonbinney jonbinney merged commit f0ab9fc into ros:ros2 Feb 24, 2024
4 checks passed
@wep21 wep21 deleted the modern-cmake branch February 25, 2024 09:03
@Ryanf55
Copy link

Ryanf55 commented Feb 25, 2024

I'm not sure how this works, but I just added the debian testing sources to my machine.
https://docs.ros.org/en/rolling/Installation/Testing.html#debian-testing-repository

After and apt update and apt upgrade, I still have the following version:

ros-rolling-filters/jammy,now 2.1.0-4jammy.20240216.171214 amd64 [installed]
  This library provides a standardized interface for processing data as a sequence of filters.

To use these changes as binaries in grid_map, does there need to be a new release of filters? Or, do we just need to wait more time?

https://index.ros.org/p/filters/github-ros-filters/#rolling

@wep21
Copy link
Author

wep21 commented Feb 26, 2024

@Ryanf55 I think we have to wait bloom release to use new change.
@jonbinney Could you create a new tag and do bloom-release?

@jonbinney
Copy link
Contributor

Yeaaaaah it needs to be released for other released packages to use it. I'll do that now for rolling. Any pressing need to do it for the other distros right now? If not, i'd like to wait and just make sure it doesn't break anything (it shouldn't, but I am constantly surprised by how minor changes can break things unexpectedly)

@Ryanf55
Copy link

Ryanf55 commented Feb 26, 2024 via email

@jonbinney
Copy link
Contributor

When building filters and laser_filters together in a rolling-desktop docker container, I'm getting a warning:

Starting >>> laser_filters                         
--- stderr: laser_filters                                                                             
CMake Warning at /ws/install/filters/share/filters/cmake/ament_cmake_export_libraries-extras.cmake:116 (message):
  Package 'filters' exports library 'filters' which couldn't be found                                 
Call Stack (most recent call first):                                                                  
  /ws/install/filters/share/filters/cmake/filtersConfig.cmake:41 (include)                            
  /opt/ros/rolling/share/ament_cmake_auto/cmake/ament_auto_find_build_dependencies.cmake:67 (find_package)
  CMakeLists.txt:9 (ament_auto_find_build_dependencies)
                                                   
                                                                                                      
---                                                                                                   
Finished <<< laser_filters [16.4s]          

Digging deeper now to see if this is some odd quirk of ament_camke_auto, or some leftover cached cmake issue, or something else.

@jonbinney
Copy link
Contributor

(not saying that error is related to this PR, but i want to debug it before releasing)

@jonbinney
Copy link
Contributor

Ah, it looks like this PR adds ament_export_libraries(${PROJECT_NAME}) but there isn't an actual library by that name. Thoughts?

@Ryanf55
Copy link

Ryanf55 commented Feb 26, 2024

Ah, it looks like this PR adds ament_export_libraries(${PROJECT_NAME}) but there isn't an actual library by that name. Thoughts?

Remove it. The targets are necessary for export are already exported by ament_export_targerts. I can review the PR, or do the work and have you review it.
Sorry for the oversight.

@jonbinney
Copy link
Contributor

No worries - @Ryanf55 could you make the PR? I'll review and merge.

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