We (the OSS project OpenKNX) have a bunch of firmware modules encapsulating specific functionallity. They are contained in own repos and a VSC/Plattform I/O project.
They can be built standalone but can also be integrated into another firmware (we use git subtree for that in the /lib dir).
Our modules rely on quite a big set of #defines defining the memory layout and some hardware properties. These lets call them hardware.h and knxmem.h logically belong to the root project.
After some trial&and&error with a fixed path to store that .h files so that every module uses the same one in a build, we came to use the -include build flag so that the #defines are set for the whole build process for all modules (-include hardware.h -include knxmem.h).
That works for the build process if you do a complete build.
But the dependecy walker in PIO struggles with that because it does not know of the defines introduced with -include. And so some changed files are not built because they have somethine like a #ifdef FEATUREA … #endif in them and FEATUREA is defined in the knxmem.h and the build process seems not to know of them.
That puzzles me a little bit because PIO seems to know of defines introduced with -D flag in the plattformio.ini but not the one introduced with -include.
So, that is the description of the problem. We are searching for a solution that allows us to:
- store the relevant defines in the repository of the root project
- have a working code highlighting
- working partial build