-
Notifications
You must be signed in to change notification settings - Fork 12
Integrated various fixes and improvements to comply with refactored version #23
Conversation
…lusion. Solution was to remove duplicates if those exist. Also set recurse libraries to have a custom-defined default value - Up till now is has been always 'False', but this change allows users to set the 'ARDUINO_CMAKE_RECURSION_DEFAULT' variable to 'True'. It's possible since this variable is stored in CMake's cache.
…on search. Those libraries are constantly removed in the 'find_arudino_libraries' function.
Solution was to change the return variable of the '_remove_blacklisted_libraries' function, as it was incorrect and always returned an empty string.
Added feature to detect SDK's revision (Currently represented as a date) by reading the 'revisions.txt' file and parsing the revision that matches the current version from it. Stored revision in cache.
…mpty. Solution was to set their cached variables the variables holding the split artifacts instead of themselves. For example: ARDUINO_SDK_VERSION_MAJOR has been assigned itself before existing, thus resulting in an empty string. Instead, set it to SPLIT_VERSION_MAJOR, which currently resolves to "1".
…ables. Up to this commit every call to the 'set_flags' function would result in validating the SDK's version, then extracting it's artifacts to form a normalized version - This is no longer needed due to the bug fix in the last commit, where the artifacts are properly stored in cache.
It's more a bug-fix combined with a feature, since the function to register a platform simply been inlined, defaulting 'Arduino' and 'avr' as platform and architecture. This commit allows developers to specify their own platform and architecture by setting the `PLATFORM_PATH` and `PLATFORM_ARCHITECTURE` variables BEFORE including the Arduino-CMake toolchain.
This commit complements the last one, allowing even further customization to the platform-registration process.
…e/refactoring-extra # Conflicts: # cmake/Platform/Core/BoardFlags/CompilerFlagsSetter.cmake
…-existent variable.
Nice to see a lot of improvements, but i have some questions and observations regarding these changes.
Although this blacklisting thing solves the problem, I really hate solution like these, because it is not a feature but rather a workaround for real problem. I think it would be wise to remove this magic of auto-discovering arduino libraries by scanning files, or improve its implementation. I think this auto-discovery feature only useful for arduino examples, that doesn't have local includes, only libraries. |
I do hate workaround solutions like blacklisting libraries, too. On the other hand, I am working on aproject that is supposed to build with arduino-builder and Arduino-CMake. That's why I find the dependency autodetection very useful. I will report back as soon as I find time to test the redesign. Thank's for the great work so far. One more thing: Wouldn't it be usefull to inform all those github users that have forked quezy's Arduino-CMake about the redesign? GitHub provides information about the fork history. It be great to catch as many forks as possible to join their work? |
@fraillt Thanks for your feedback and code contribution, I will make this change before completing this PR. @noseglasses I agree with both of you about the complexity of the current solution, and that automatic library detection should be at least covered with a flag to disable it. |
…c versions. The '_get_normalized_sdk_version' function of the `FlagsSetter` has been improved to return different results, depending on the current SDK version, as the '-DARDUINO' flag intended to use it has different accepted formats over the versions. Also renamed '_get_board_property_if_exists' function to '_try_get_board_property' as a convention.
Bug Fixes
Most of the bugs fixed in this PR are @noseglasses's fixes introduced in #17 and #19.
To integrate his changes, which were made directly on the master branch, a few things changed:
Library Blacklist
The cached variable holding the list of blacklisted libraries is created during the initialization.
6-digit SDK version
Aimed to solve a scenario where the arduino compiler's
ARDUINO
flag must be assigned a 6-digit version (major.minor.patch
), redundant code has been discovered.Instead of validating SDK's version and returning it in a normalized form in every call to the
set_board_flags
function, the version could be simply normalized by concatenating the version's artifacts, which are major, minor and patch. One little thing though: Those weren't properly set at the initialization level, when the SDK's version was set. Solving this bug allowed to simply read those cached variable to create a normalized version. This change doesn't affect others, for your concern @noseglasses .Register Custom Hardware Platform
As pointed by @noseglasses in #19, the only platform that could be registered was the Arduino platform having the avr architecture.
Since the refactored version supports the script-driven model, a function that supports custom platform parameters couldn't be implemented, yet it could be integrated into its' own script.
A separate script named
RegisterSpecificHardwarePlatform.cmake
was created, and it does the same as the proposedregister_hardware_platform_bva
function should've done.To resolve the custom parameters, users should declare variables BEFORE including the Arduino-CMake toolchain file in their script. The possible variables are:
Features
Added SDK Version Revision
@noseglasses suggested to treat SDK version as a 6-digit number, while using the word revision in his description. In an effort to integrate his changes, I misunderstood his true meaning of the word revision, as he simply meant patch, yet added a feature to actually parse the version revision.
This is done in the initialization stage, in the version-detecting script.
The
revisions.txt
file is read to parse the revision that matches the current version (detected earlier), which currently is just a release date. This revision is later stored in cache.Added Ability to Use Custom Platform Registration Scripts
To make the platform registration process completely extensive, a variable named
CUSTOM_PLATFORM_REGISTRATION_SCRIPT
can be set BEFORE including the Arduino-CMake toolchain file. This variable should hold a path to a script used to register a hardware platform somehow.