arduino / arduino-cli

Arduino command line tool
https://arduino.github.io/arduino-cli/latest/
GNU General Public License v3.0
4.38k stars 384 forks source link

Support of CMake #1973

Open FStefanni opened 2 years ago

FStefanni commented 2 years ago

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:

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

Related

Issue checklist

schnoberts1 commented 9 months ago

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.

da-phil commented 5 months ago

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.