colcon / colcon-cargo

An extension for colcon-core to support Rust projects built with Cargo
http://colcon.readthedocs.io
Apache License 2.0
30 stars 20 forks source link

ignore cmake projects #32

Closed stelzo closed 1 week ago

stelzo commented 4 months ago

The r2r project still uses CMake for building the nodes in the minimal node example. This PR ignores packages containing CMakeLists.txt to allow both libraries to be used for writing ROS nodes.

The plugin still can compile the r2r node but it leads to problems as described here. I don't really understand the need for colcon-cargo and colcon-ros-cargo at the same time as described in the ros2_rust Readme so I did the PR at both repositories. It seems like the relevant plugin for my system is colcon-ros-cargo though.

cottsay commented 4 months ago

I don't believe this is the right way to resolve the identification issues in r2r. Taking this change would prohibit others from using colcon-cargo to build if they also have the ability to build with CMake. It's fine if the r2r project prefers CMake, but that preference may not be universally shared.

If your package contains files for building with multiple build tools, you should use a colcon.pkg file in that project to specify which package type it should have in colcon, and therefore which build tool should be used.

colcon.pkg:

type: cmake
luca-della-vedova commented 1 week ago

The PR addressing this on the colcon-ros-cargo side that should fix your use case as well has been merged (packages that specify a build type in their package.xml that is not ament_cargo will be skipped) https://github.com/colcon/colcon-ros-cargo/pull/10. That doesn't quite address colcon-cargo packages though, for which the solution proposed by @cottsay sounds like the most scalable one (we don't want to silently force a package type when multiple options are available for all users). Closing this