Arduino_Core_STM32
Arduino_Core_STM32 copied to clipboard
Implementing an alternative build framework with CMake
Implementing an alternative build framework with CMake
This PR implements an alternative build engine to Arduino IDE or arduino-cli. Although widely compatible with these tools, a CMake implementation is much faster (especially on Windows, especially behind a proxy/firewall): in the order of 10sec, instead of up to a minute with the IDE on my machine. Other benefits include more flexibility in describing the build, and enhanced support of incremental compilation, including when making changes to the core.
Most features of Arduino IDE are reimplemented here; the most obvious missing feature is the lack of automatic dependency management (libraries). Indeed, the way Arduino implements can not be mirrored cleanly with CMake.
How to use:
Examples can be found at https://github.com/massonal/STM32CMake_workspace.
Briefly, there needs to be a CMakeLists.txt present in the sketch, along the sources. The recommended template makes heavy use of wrapper functions designed to mirror the Arduino automation; these are implemented in the /cmake
folder here.
Please read the wiki I started writing on my fork for more details.
How to maintain
- Arduino doesn't "see" CMake files, so this PR overall should have no effect on the Arduino tools.
- Most CMake files are autogenerated from a template; this script updates them all. I advise running it automatically as a git hook after this PR gets merged.