[ros-users] [Discourse.ros.org] [Next Generation ROS] Make Ament work with another build system (for cross-compilation)

Loïc Dauphin ros.discourse at gmail.com
Mon Aug 7 10:20:54 UTC 2017



Thank you for your answer !

I will still have problems to make work CMake and RIOT's Makefiles together (I already tried in an other project), but it seems more doable.

For the last questions, let me explain a little : 
RIOT cannot be compiled as-is. It needs to handle the whole application's build. To do so, it provides a template Makefile [(example)](https://github.com/astralien3000/riot-ros2/blob/58c65cab3bf9fe741fefaced8233cfc0dbd2f783/examples/listener_c/Makefile) that will compile the application and all the modules needed, and then link them. To transform any source into a RIOT modules, you may just add a [simple Makefile](https://github.com/astralien3000/riot-ros2/blob/58c65cab3bf9fe741fefaced8233cfc0dbd2f783/src/rcl/Makefile) in the same directory (and add a reference to this directory in the user application's Makefile). Once this is done, you can compile your application for any microcontroller that is supported by RIOT.

That being said, you can do some workaround. A dummy user application that require the needed RIOT modules can be compiled, and the object/archive files can be extracted to be integrated in an other build system (CMake). But this raise a lot of question on how "information" (compilation/linking flags, target microcontroller, needed modules) is passed between the two build systems. I already tried this approach, and ended with an application compiling and linking well, but not working for obscure reasons (one RIOT modules could not communicate with one of mine).

But there is an other workaround. Let's say that if RIOT needs to compile everything to work well, you can transform everything in a RIOT module. Since you only need to add small Makefiles to a project to make it a module, it may be worth exploring this solution. But this raise questions on how to tell RIOT where are the modules. This approach also solved my "obscure reasons" in the former project.

I'm not sure if I'm really clear, tell me if it's not the case. It's a bit complicated because it is not designed to work like that. My questions explored the two possibilities, to determine which one is the best or even possible. I was more confident with the second approach because it's the one I currently use, but considering what you said, it seems not possible to use it in a clean and compatible way with Ament/CMake.





---
[Visit Topic](https://discourse.ros.org/t/make-ament-work-with-another-build-system-for-cross-compilation/2382/3) or reply to this email to respond.




More information about the ros-users mailing list