arduino-cli
arduino-cli copied to clipboard
Support of CMake
Describe the request
There are many use cases for which the custom-made Arduino compilation process does not fit well or easily.
Some issues related to these needs are #1473 and #1407.
I also need more complex builds for my needs at work.
Actually, the truth is that complex scenarios require something less automatic, but well known and supported, which, for C and C++, it is CMake. CMake is great since allows to implement complex scenarios for the ones who need it, but it also allows to compile easily for non experts.
There have been many unofficial projects, the most up-to-date being:
https://github.com/technyon/Arduino-CMake-Toolchain,
but all of them are unofficial, meaning that they could support partial cases, be not up-to-date with the latest specification, and so on.
Supporting CMake also allow developers to use their preferred IDE without pain, since many of them are able to interact with CMake to get include paths, compile, etc..
So what I am suggesting is one of the following:
- Switch from the custom build system, to the more standard CMake
- Maybe, leveraging CMake to provide the automation currently provided for those who do not have more complex requirements
- Provide a flag to generate CMake files, starting from the specification files of boards, platforms, libraries, etc.
So, in conclusion, I believe that supporting CMake would provide great value for many programmers.
Regards
Describe the current behavior
No CMake is supported, making integration in complex builds hard.
Arduino CLI version
0.28.0
Operating system
Linux
Operating system version
Debian testing
Additional context
Additional requests
- https://github.com/arduino/arduino-cli/issues/1973#issuecomment-1923740075
- https://github.com/arduino/Arduino/issues/7528
Related
- Discussion starting from https://github.com/arduino/arduino-builder/issues/17#issuecomment-231568403
Issue checklist
- [X] I searched for previous requests in the issue tracker
- [X] I verified the feature was still missing when using the nightly build
- [X] My request contains all necessary details
This would be incredibly useful. Giving Arduino a mature and flexible tool chain would enable larger projects that otherwise might migrate to an alternative platform. It’s also not a hard piece of work.
Yes, it would be so great to use an industry standard build tool such as CMake under the hood!
Then we could just deal with platform specifics (e.g. AVR, ESP32 etc.) in toolchain files and just use plain simple CMakeLists.txt files in project folders. I think for switching between toolchain files and/or even adapting them, arduino-cli would be still the tool of choice, but also limited to only that, not trying to replace a whole build tool.
This would help software developers so much in order to make code platform agnostic and also testing on developer machines a lot easier. I'm really not happy how writing unit tests for libraries has this strong coupling to the Arduino platform bloat, although this should run on normal PCs and laptops, using simple abstractions.
Using a proper cross-platform build tool would be one key aspect to enable those use-cases.