PlatformIO Community

Library with multiple src/include folders

I’m using ESP IDF directly to create an esp32 HomeKit project using this library:

I’d like to add a library.json to the project to use it from PIO. The issue is the project has many components meaning many nested src and include files. I’m not in a position to change the directory structure of another companies project like this.

The docs don’t seem to specify how to create a library with multiple srcDir and includeDir provisions. I’ve experimented with multiple but when I load the library, PIO doesn’t see the headers.

Any recommendations on how to go forward? Perhaps make many “libraries” out of the components?

No, the linked repo is already a project containing a components folder – PlatformIO can natively handle this components folder because it calls into the ESP-IDF build system. You can also see that official examples like espidf-aws-iot just use a component folder with the original content, no library.json needed. Supper per documentation.

So if I understand correctly, I should be able to simply include lib_deps = in my platformio.ini and it will understand how to include the library properly?

When I try that, the build target can’t find the header files. Reading through the docs you linked I wasn’t clear on how to resolve my issue.

No, that will put it in as ‘library’, in .pio\libdeps, but it needs to be a component. Create the folder components and in there clone the SDK. (or add it as a git submodule)