Skip to content

Feature/generic cmake #5

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

Merged
merged 16 commits into from
Jun 11, 2025
Merged

Feature/generic cmake #5

merged 16 commits into from
Jun 11, 2025

Conversation

nubertj
Copy link
Member

@nubertj nubertj commented May 26, 2025

I think with the new requirements of being buildsystem independent we have to move away from gtsam_catkin.

Instead I propose:

  1. System install (potentially local installation) of gtsam
  2. graph_msf as pure cmake package
  3. slim graph_msf_catkin to make graph_msf available directly to catkin packages and to still comfortably develop / debug
  4. Downstream packages such as graph_msf_ros or smb_estimator_graph then simply use graph_msf_catkin.

For ros2/colcon, which is much closer to cmake, we can see what is the best solution and whether we can avoid having a graph_msf_ament. I think it should also work without.

First running prototype attached to this PR. Happy about any testers on existing data.

@nubertj
Copy link
Member Author

nubertj commented May 26, 2025

#4 should be merged before

@willat343
Copy link

So I don't think I have time to go through the 151 files but through many hours spent on this problem i came to the conclusion that catkin wrappers only provide value for external libraries that don't provide package.xml files (e.g. Open3D) and even then probably one is better off installing the library system-wide or locally as preferred.

As an example, I now have a workflow that is somewhat similar in build complexity containing base dependencies (Eigen3, manif, ceres) which i have installed locally (although i'm considering ExternalProject), and several of my own dependencies (mathbox, sensorbox, convert) which I usually build directly to the workspace with a simple catkin build (convenient while developing) or can be installed locally/system-wide. There is no need for a mathbox_catkin, sensorbox_catkin or convert_catkin as I used to have, and I have no issues with using catkin when the CMake code contains no catkin commands.

Similarly, there is no issue with gtsam or in my case ceres being installed to a workspace if it is there because they provide package.xml files - just include in the workspace and catkin build.

Not only are the catkin Cmake functions unnecessary, I have found then to be limited and the source of many build problems. The insight is that they pass on include directories, link libraries, and with a bit a wrangling, some additional CMake variables. However modern CMake has embraced a much more abstracted target system, such that using find_package(pkg) the normal way (rather than find_package(catkin COMPONENTS pkg)) gives you a target that can have any of the Target Properties set, including include directories, link libraries, compile flags, linker flags, compile-time definitions (and more) in accordance with the requirement of that base library. This is an issue we've discussed before, so I won't go into more detail.

Regarding ament and the colcon build system, I have no idea if the same logic applies.

@nubertj
Copy link
Member Author

nubertj commented May 27, 2025

Yes but then you should like this PR, no?

For me works super seamlessly, and is nice to develop with this setup as well. The only downside is one can not actively change gtsam anymore, but this is quite realistic in 99% of the use cases I think.

@nubertj
Copy link
Member Author

nubertj commented May 27, 2025

So I don't think I have time to go through the 151 files but through many hours spent on this problem i came to the conclusion that catkin wrappers only provide value for external libraries that don't provide package.xml files (e.g. Open3D) and even then probably one is better off installing the library system-wide or locally as preferred.

As an example, I now have a workflow that is somewhat similar in build complexity containing base dependencies (Eigen3, manif, ceres) which i have installed locally (although i'm considering ExternalProject), and several of my own dependencies (mathbox, sensorbox, convert) which I usually build directly to the workspace with a simple catkin build (convenient while developing) or can be installed locally/system-wide. There is no need for a mathbox_catkin, sensorbox_catkin or convert_catkin as I used to have, and I have no issues with using catkin when the CMake code contains no catkin commands.

Similarly, there is no issue with gtsam or in my case ceres being installed to a workspace if it is there because they provide package.xml files - just include in the workspace and catkin build.

Not only are the catkin Cmake functions unnecessary, I have found then to be limited and the source of many build problems. The insight is that they pass on include directories, link libraries, and with a bit a wrangling, some additional CMake variables. However modern CMake has embraced a much more abstracted target system, such that using find_package(pkg) the normal way (rather than find_package(catkin COMPONENTS pkg)) gives you a target that can have any of the Target Properties set, including include directories, link libraries, compile flags, linker flags, compile-time definitions (and more) in accordance with the requirement of that base library. This is an issue we've discussed before, so I won't go into more detail.

Regarding ament and the colcon build system, I have no idea if the same logic applies.

btw if you check the PR you would see that it is a very small PR with small changes. Most of the 157 files are just there as I moved the location of the examples (but the examples itself remain unchanged).

@nubertj nubertj removed the request for review from willat343 May 27, 2025 14:10
@willat343
Copy link

You could consider ditching graph_msf_catkin so long as you keep a package.xml in graph_msf

@nubertj
Copy link
Member Author

nubertj commented May 28, 2025

You could consider ditching graph_msf_catkin so long as you keep a package.xml in graph_msf

This is what I tried in the beginning.
But this created all kind of downstream issues, including linking errors and non standard locations for the include paths.

It worked seamlessly for colcon, which is much closer to cmake, so there is NO graph_msf_ament. See this PR for details: #7

@nubertj nubertj merged commit 0d17500 into main Jun 11, 2025
@nubertj nubertj deleted the feature/generic_cmake branch June 11, 2025 12:48
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