I’m trying to write a wrapper around two separate libraries which target their own platforms,
teensy. The project works fine if I use a
platformio.ini which species different
lib_deps for each
[env:<platform], but when I try writing a
library.json to export these dependencies, this is where it does not go well.
I think my biggest hangup is with the project structure. It seems to me that the project structure is recommended to be different for end user projects and for libraries. For end user projects, it seems that sources/headers should be split into “private” libraries which go in the
lib directory, while for libraries everything gets shoved in
src. I like the separation of files into the
lib directory because it enables me to use the LDF to compile/link the platform dependent sources, rather than filtering for them using
However, when I put them in the
lib directory, they are not seen by the LDF when exported (in my end user project). I tried making
srcDir equal to
lib, but then the headers are not found. I could specify
lib, but that would couple my include paths in the source code with my directory structure in a way that is not desirable.
I could add
-I flags for each directory, but at this point we’re straying very far from where I want to be.
So what’s the recommendation? Where do source files go in an exported library?