Interdependent external libraries with source files not inside /src

I have 2 external libraries, library1 and library2. Library2 depends on some source files from library1.
However, library1 has its source code files located inside a /lib folder, and /src holds javascript code that generates the .h and .cpp files that are inside of /lib. Compiling the whole project will result in “No such file or directory error”.
If I move all of the source code from /lib into /src inside of library1, library2 will see these files and compiling will be OK. My question is how can I include the /lib folder inside of library1 as part of its source so that library2 can see it? (I’ve also tried using “srcFilter” param but doesn’t seem to work)

Project tree

|----<.piolibdeps>
|     |----<library1/>
|     |     |----<lib/>
|     |     |     |----<subfolder>
|     |     |     |     |----file.h
|     |     |     |     |----file.cpp
|     |     |----<src/>
|     |     |     |----javascript.js
|     |----<library2/>
|     |      |----<src>
|     |           |----file2.h   // <--- includes <file.h> in library1/lib/subfolder
|     |           |----file2.cpp
|----<src/>
|	  |----main.cpp

library1’s library.json

...
	"build": {
		"srcFilter": [
            "+<../lib/subfolder/*.c>",
			 "+<../lib/subfolder/*.cpp>",
			 "+<../lib/subfolder/*.h>"
		]
	},
...

lib_deps

lib_deps = 
	git@github.com:placesss/library1.git
	git@github.com:placesss/library2.git

Ok, so it looks like the external library’s source code folder is fixed to src/. It would be nice to have a new option like “srcDir” for “library.json” where the user can specify the source code folder(s) in an array for the LDF to scan?

Implemented in

Please re-test with $ pio upgrade --dev.

P.S: You can actually override this folder with extraScript and some Python code. However, this option could be useful for other library maintainers. So, we added to our docs.

2 Likes