Rather than start a new topic, I thought I’d revive this old thread to propose an alternative strategy for library development in case anyone else happens to be searching through the forum for a solution to this problem. The challenge I struggled with was building an example project within a local PlatformIO library without any special platformio.ini settings.
While developing a library, I formed a working project in a fashion similar to that described in @ivankravets response. However, when I changed the structure of my library to make it compatible with the Library Manager, it became incompatible with the
lib_extra_dirs approach because the directory structures are different; my source was now in a
src subdirectory, not in the root of a directory named for the library as required by
I found the simplest solution to be the following. Unfortunately, this will only work on a Linux OS:
- In the pio global storage directory, create a symlink to the library directory named for the library. In my case, something like this:
ln -s "/home/user/repository/library_directory/" /home/user/.platformio/lib/CustomLibraryName
- Add the library dependency to the project environment:
lib_deps = CustomLibraryName
Changes to the library source code will immediately be available during PlatformIO build and allow rapid library development. The example can be easily modified and kept up to date during development. Be careful not to accidentally install or update an older version of your library from the Library Manager server; this will happen if you run a library update and don’t have
version set in
I apologize if this is an obvious solution, but I didn’t encounter any such strategy in the documentation or in this forum and thought it might benefit any others trying to develop publicly available libraries. If there is a better solution for development of a library using its example sketches, I’d love to hear it!