- Notifications
You must be signed in to change notification settings - Fork1k
Implementing an alternative build framework with CMake#1776
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
2f8ea81
to290b330
CompareThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Please use passive form as far as possible
Uh oh!
There was an error while loading.Please reload this page.
c0babcf
tof5960ab
Compareed57b42
tofe5794c
Compare2da70fa
toc4b84c4
CompareUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
3009c71
to8c7c567
CompareThe script uses its location and arduino-cli to write a templateof the sketch's CMakeLists.txt.* Defines: - CORE_PATH - USER_LIBS -> for use with `external_library()`* Includes all user libraries* Usable on a given sketch or generically (use placeholders)* Optionally: run CMake (config+build)
I.e. changed some variables from "CACHE" to "regular in the parent scope"CACHE variables can exhibit some counterintuitive behavior;switching back to regular variables is thus saferand does not significantly impact build time.
Using:- platform.txt to get the version of the core- the dev version of the JSON describing all the tools+versions+deps- stand-alone: Python, wrt. version and modules.Changes:- The download folder is no longer inside Arduino_Core_STM32, but alongside.- The options to control the download (clearance + folder) are removed.- CMake: harmonize the `cmake_minimum_required()`sCMSIS and xpack are no longer downloaded _in_ the root folder, but alongside.All this parsing is costly (e.g., on rebuild), so shortcuts have been implemented ifit looks like the dependencies are satisfied already.
- Added a new kind of insight: logic structure- Added the CORE_CALLBACK overall setting
Important: the changed implemented here _require_ the userto call `project()` in "step 1", before calling any custom function,but after defining the toolchain file.The whole of Arduino_Core_STM32 (variant + core) is now addedautomatically when the user calls build_sketch() ; they don't have todo it themselves anymore.Also the standard libraries have moved from stm32_runtime to base_config.Indeed, even the files from the core depend on them.Also, _all_ the Arduino libraries depend on base_config only (even SrcWrapper).Additional dependencies were actually not needed.***Moved the CMake-related files to /cmake***-- for clarity with the remainder of the project (when using Arduino IDE)-- Also, this prevents IDEs from building the core "standalone" when seeing a CMakeLists.txt at the root,-- since that would be meaningless anyway.Also improve portability by replacing backslashes with forward slashes in paths on Windows.=======================Change: moved the download folder awayHaving the download folder along the core seemed tocause malfunctions with some external tools (Arduino plugin on VScode).Moving it in the user's home folder fixes this issue.Each core installation nonetheless has its own download subfolder,to allow different versions with different requirements to coexist.
Using a fuzzy find after parsing boards.txt.This has required refactoring the board parser code in a dedicated modules,with minor impacts in the files that depended on it.=============Doc changes:expand on the syntax in easy_setup:Added a comment block to explain the use of the DEPENDS clause.Added "usual" values for board settings.Add a link to the wiki in easy_setup.Also update link in the README_CMAKE- update link to point to the new location for the examples;- unify the displayed text for the links;- add a link to the wiki.
This adds a new keyword, BOOTLOADER, in set_board().Cmake-wise, the bootloader targets replace the board targets, they are not feature targets to plug in.
Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
Signed-off-by: Frederic Pillon <frederic.pillon@st.com>Signed-off-by: Alexis Masson <alexis.masson@st.com>
Mostly to benefit from the built-in "--help",as the script takes no actual argument.
ASM not being enabled when `external_library()` is calledtriggered an error where CMAKE_ASM_COMPILE_OBJECT was undefined.This commit fixes that by adding the calls to enable_language()earlier in the config process.
Now detects and warns when arduino-cli is misconfigured,and falls back to a sensible default value for userlibs.
To mirror as closely as possible the behavior of Arduino tools.
Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
f17548f
to74d524e
CompareSigned-off-by: Frederic Pillon <frederic.pillon@st.com>
fpistm left a comment• edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Thanks@massonal for this PR.
As a first implementation it is a good job.
Ready to merge and deploy.
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 athttps://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 readthe wiki I started writing on my fork for more details.
How to maintain