In my library I get the following dependency tree on running test:
Library Dependency Graph
|-- I2C
|-- CommonMasks
I2C actually depends on Wire. Wire.h is included in the I2C.cpp file and specified as dependency in the I2C/platformio.ini as lib_deps = Wire.
The only way to make my library compileable is by including Wire.h in I2C.h instead of in I2C.cpp.
Library Dependency Graph
|-- I2C
| |-- Wire v1.0
|-- CommonMasks
Does the dependency walker only walk through headers and not through cpp files? This would require me to specify the includes in the header although they are only required in the internals.
Thank your for the answer and the url to the docs. Somehow searching for the error did not give me the proper information. Both solutions work.
After fiddling around some more I discovered that the dependency finder finds the 2nd degree dependency libraries if the 1st degree dependency is included with a relative path. E.g. #include “…/…/TheLib/src/TheLib.h”. But not for libraries from the lib path. E.g. #include <TheLib.h>. SCons seems a little inconsistent here. See: GitHub - g3rb3n/TestPIODeps
Would it be an idea to include the lib_deps of the libraries in the dependency finder? This would not solve it for every lib, but at least for the libs written with a platformio.ini.
It could be. It’s not ideal. It would mean arbitrary includes of everything under lib.
I am creating a sort of broad starter template for a project with unit testing. Sort of like the unit testing examples, but with some additional things I’d like to have in bootstrapping a project. So, I was trying for a general solution.
If this is the recommended solution, then I suppose I will just put those includes in the main.cpp with a note as to why they are included. I guess this is better than getting those warnings.