PlatformIO Community

How can I create a repository with multiple libraries in it on GitHub and use them in a project?

I am developing a collection of libraries for a school and want to publish them in a single GitHub repository (https://github.com/DennisMoschina/Libraries-Modellbahn). I assume, that I can simply add lib_deps = https://github.com/DennisMoschina/Libraries-Modellbahn.git to my platformio.ini file in the project I want to use the libraries in, to install them. I currently have two libraries in this repository, each in an own folder with a library.json file in it. However, only the first library is found and even when I use the pio pack command, only one library is in the created archive.
It is my first time working with the package manager, so I might have missed some things.
Thanks in advance.

To the best of my knowledge and the existing threads How to install libraries from a Github repo's subfolders and Multiple Libraries in a single Git repository that’s not possible (points to non-existing documentation and notes of it that it’s not working in newer versions). One library per repo.

Unless @ivankravets can correct me on that one.

2 Likes

At the time I posted this thread, the github repo in question had all the libraries in a subfolder… and Ivan gave me hints on doing a pre_script that would pull them in and point the LDF at them…

But to do multi-libraires in the one repo, unless something has changed or broken, the magic sauce is the include statement in the library.json … if you look at one of the libraries from jrowberg/i2cdevlib… i.e. the BMP085 library … it is in the Arduino/BMP085 subfolder… BUT only the files in the folder referenced in the include statement in the libraries.json (relative to the root of the github repo) are actually included in the library, thus making it self-contained - you can check the source code at the bottom of the library installation page to see how platformIO interpreted the library configuration settings.

1 Like

We don’t recommend doing this. Arduino does not support this.