How Sloeber deals with libraries; the library manager; import into project and install #1537
jantje
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
First off: Some vocubulary used in Sloeber
We use the word installing when Sloeber library manager downloads a file from the internet and installs it on your system to make the library available for compilations.
We use the word importing a library in a project when making a link in the projects libraries folder to the installed library.
Compile time is the action that is executed after you pressed the verify/build button.
Compile time
At compile time Sloeber uses the libraries that are linked in the libraries folder. You can add and remove libraries there via the menu "add a library to the selected project" or let Sloeber library library manager manage the content of the folder (default behaviour) or a mix of the 2 (adding manually the ones Sloeber library manager does not add automatically or delete the folder/library to let the library manager retry).
But what is important is that (in contrast with Arduino IDE) no libraries/platforms are searched at compile time. The libraries in the libraries folder are used as listed at the time the compile command is given.
What are the workspace configuration options in regards to libraries
You can allow Sloeber library manager to import libraries in your project in the workspace preferences.
You can allow Sloeber library manager to install libraries.
You can add library json files pointing to library locations on the internet in the "Third party index url's" page.
What triggers the library adding
Sloeber subscribes on indexer updates with CDT.
The indexer parses the code and provide all kinds of interesting information that is used to increase user experience.
The indexer is at the hart of why Sloeber is a good tool.
When CDT informs Sloeber of indexer updates Sloeber queries the CDT indexer for "unresolved includes".
How are libraries found
CDT reports unresolved includes as header files, let us assume one of the unresolved includes is "xx.h". Based on the CDT provided "xx.h" Sloeber will search for the library with the name"xx". Sloeber assumes the library name "xx" to be the folder name containing the library code. Therefore Sloeber will search for a folder named "xx" in any of the provided places containing libraries.
These places are
notes:
The Sloeber library way of selecting the library when importing libraries to a project.
Note that "the find the library" is different implementation then Arduino IDE.
Therefore a successful "install missing library" may not lead to a successfully "import the library" nor to resolving the unresolved include.
Manually importing libraries to a project
When Sloeber creates the list of libraries you can import to the project Sloeber first searches all possible libraries locations for libraries to be added to the list.
In case of naming conflicts (that is 2 libraries having the same (folder)name; the library that will be added to the list of libraries will be first one found in the list below
Beta Was this translation helpful? Give feedback.
All reactions