I’m struggling to include files from a library using lib_deps. I have a library repo that looks something like this:
|--lib
| |
| |--Bar
| | |--src
| | |- Bar.cpp
| | |- Bar.h
| |
| |--Foo
| | |--src
| | |- Foo.cpp
| | |- Foo.h
|
|- platformio.ini
|
|--src
|- main.cpp
|- another_file.cpp
|
|--test
|- some_tests.cpp
Then, in another project, I want to use code from Foo and Bar, but not the files in src, so I include them with:
lib_deps =
https://github.com/Me/MyLibrary
As is, it does not compile, because the compiler is looking in src and not lib – if I move the four library files (Foo.h, etc.) into src, the main project will compile. But I don’t really want to do that (I want to have things organized as above for testing), so I’ve tried using a library.json file in the root of the library repo:
{
"name": "FooBar",
"version": "0.0.0",
"build":
{
"srcDir": ".",
"srcFilter": "+<*> -<src> -<test> +<lib>"
}
}
This still does not compile, and the compiler says it can’t find the header file, Foo.h.
I expected srcFilter to tell the compiler where to look for files and, according to the documentation, setting srcDir to . should tell it to recursively compile all directories (as filtered in the next line).
So, what am I missing? How can I include files in the build using the library structure above?