Skip to content
This repository was archived by the owner on Apr 17, 2023. It is now read-only.

Conversation

@MrPointer
Copy link
Member

From #23, it appears that the Arduino-CMake-NG framework hadn't had the ability to correctly manage Arduino Libraries's sources since some of them were added when not required, some not added at all.

This PR gives the framework a consistent approach to Arduino Libraries, where the following rules apply:

  • All sources under the src sub-directory and all of its sub-directories are included in the library target's sources, if the src sub-directory exists
  • If it doesn't, only the sources located directly under the root directory are included in library target's sources
    This is taken from the Official Library Directory Structure/Layout Specifications, part of the Arduino documentation.

However, this won't suffice as users need to have an ability to manually add additional sources, and probably even entire source directories.
For that, a new feature and API has been introduced - the target_source_directories function which appends all sources under a given list of directories to a target, optionally recursively.
An example of the API's usage can be found in the 3rd-party-library example.
Nevertheless, full documentation will soon be added.

The PR also fixed a bug regarding platform libraries, where the same platform lib couldn't be used more than once.

Fixes #23.

…ions.

All sources under the 'src' sub-dir are recursively included, while all sources under library's root dir are included if 'src' sub-dir doesn't exist.
Added an example to leverage new algorithm as well as the use of Sketchbook path.
This led to some strange issues regarding linking the CoreLib to platform libraries - Still not sure what caused it and what exactly fixed it.
It appears that an existing platform lib target has been rebuilding on each subsequent cmake run even though it shouldn't. Now it's created and linked as a valid Arduino-CMake library once, then linked as an existing target.
It mostly allows users to append additional directories of a library to their library target, since now libraries only search in the 'src' sub-directory or root directory by default, and this behavior can't be changed.
Also separated source-finding function related to libraries to a separate module.
Updated '3rd-party-library' example to use new API.
@MrPointer
Copy link
Member Author

Something really bad is happening in AppVeyor right now - It can't even git-clone the PR!
This only happens to one of the jobs, so let's assume it's passing and I'll just merge this.

@MrPointer MrPointer merged commit 40245d1 into develop Sep 21, 2018
@MrPointer MrPointer deleted the feature/library-directory-layout branch September 21, 2018 13:27
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants