I don’t seem to have an option to install a library to global storage from the GUI. The only option I get is ‘Add to project’.
CLI “pio lib -g install xxxx” will install the library to global storage correctly.
Am I missing something? This was never an issue before.
I’m using VSCode 1.49.2 on Win7, PIO extension 2.1.0, PIO core 5.0.1. (As far as I know all the latest versions.)
It was a nice feature browsing through the registry, Installing some stuff, applying my patches ONCE (there is almost no lib I did not customize ) and use it for all projects.
That’s a lot more “copy from here to there” now and change the dependencies after moved.
No, the code itself was not copied but the resulting object-code kept in Project-Cache. So every change on the library was automatically applied when recompiling one of the projects.
That’s quite useful when working more on the libraries than on a project. I do like this when porting to other platforms or frameworks.
maybe this is not up-to-date-straight-forward-development but hey, I am an old man and quite used doing things like I ever did.
And it always is sad when upgrades made life more difficult for me.
Aha! Thanks. So your source code stayed where it was, in the global folder, and was not copied into the project. Any changes you made to the library source code, were propagated to the binary version linked into the project when the project itself was recompiled?
If this is the case, then my setup for my pseudo-global libraries does the same thing – I just tested it to be 100% certain. I did the following:
Edited a function in my AVRusart library which lives in platformio_libraries/AVRusart which is my own “Serial” interface look-alike library;
Compiled a project which uses AVRusart by defining the following in platformio.ini: lib_extra_dirs = /path/to/platformio_libraries
Changes appeared in the uploaded code;
No source code for the library was copied to the project directories, only object files *.o and a static library libAVRusart.a.
So, in summary:
Keep your downloaded and modified libraries in separate folders beneath a top-level globals folder;
Add the path (relative or full) to the top-level folder to any project that needs a library you have written or downloaded;
Do not mention any of those libraries in lib_deps;
Add the appropriate header files to #include "whatever.h" statements when libraries are required;
Compile, upload and have fun!
It seems to work the way you would want it to work by doing this.
Me too - but sometimes the world moves out from underneath you! It seems that global libraries caused too many problems with same named libraries being written for different platforms/frameworks and the wrong libraries being linked by the linker.
Yes, your setup does the same. This will work of course.
It just was nice browsing and scrolling through all that libraries and install this and that. That’s a little more complicated now (find the exact name first and copy to CLI) - The folder in old “lib” were parsed for compatibility with platform and framework. Do not know yet if this also works for external lib paths.
Maybe they bring back the old feature?
That “Add to project” does not work at all when working with different project-trees or more than one compiler installation on different machines because projects not created with that installation are not listed in that “add to project” list. I manually had to edit that “homestate.json” file to add all the projects for the mounted drive. So that’s not exactly “cool”
As I do not want to open a new post for this:
+1 for bringning back the button
Sadly, since 2.0 update, for me PIO is less intuitive and user-friendly. Now I have to add a .txt to the desktop with the command to add a library to all projects for the case I need a new one in a few months. Makes no sense for me. What will 3.0 bring - remove UI and back to terminal-usage at all?^^