Confusion with designating library folders

See my example library in this post: Platformio.ini for local building - #2 by sivar2311

This probably meet your requirements.

It is a library which is able to build the examples when you clone the repository.