This repository was archived by the owner on Apr 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 39
Applied library-centric refactoring #38
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Most of the changes occurred originally in the 'header-only-lib' branch, but are moved here since they don't belong there.
It also came with a cost of requiring the library's root directory in the `add_library` API.
It failed when there were no included headers found, so a matching guard-check has been added.
# Conflicts: # cmake/Platform/Targets/ArduinoCMakeLibraryTarget.cmake # cmake/Platform/Targets/ArduinoLibraryTarget.cmake # examples/3rd-party-library/CMakeLists.txt # examples/3rd-party-library/NeoPixelTest.cpp
Also modified `add_arduino_header_only_library` API to accept unlimited source files (headers) as unparsed arguments, as is done with the 'Executable' API.
Separated target architecture definition to a function under the 'TargetFlagsManager' module.
Updated code across all framework to use this function.
It allows functions to accept practically unlimited sources (or any other arbitrary value) as long as any reserved arguments/options aren't encountered. When at least one is encountered, processing stops and the already-parsed arguments are returned.
The `add_arduino_library` function has been updated to use this function in order to remove the inconvenient 'library_root_dir' argument it used to accept. As such, updated all other code using this API.
Everything related to the library properties file is now passed using the 'LIB_PROPS_FILE' optional argument. Also added utility function to get a library's properties file based on a given root directory - It simply appends the properties file name (which is now stored as a default cache variable) and checks for existence before returning.
… now 1st. Updated usages accordingly. Also updated the `link_library_flags` function to use the scope parsing function, it was somehow missed until now.
…parsing to utility macro.
…rsing "unlimited" arguments, such as sources.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a somewhat large PR, including many changes, mostly internal (Thus called refactoring).
However, it allows affects some public APIs:
add_arduino_libraryfunction - The new code infers it automatically from passed sources.add_arduino_libraryAPI, as well as the header-only API - Are no longer suffering from the Unable to use more than one source file in a program #26 bug that affected program/executable targets.Moreover, it's perfectly valid to pass options and single-value options to these functions, such as
LIB_PROPS_FILEthat hints the path to the library's properties file (This is not necessary).This is possible thanks to a new argument-parsing mechanism implemented to parse what's considered "unlimited" arguments, or in this case sources.
The framework has been further "modulerized", but it doesn't affect the public API.