I have some include file name collisions between two third party libraries and a PlatformIO provided framework package
(NOTE: names are for illustration only)
Normal PlatformIO provided package
/home/user/.platformio/packages/framework-arduinopackage/core/nrf52/foo.h
My project:
myproject/platformio.ini
build_flags =
; does not add any "-I" flags
My projects lib directory contains:
myproject/lib/thirdparty1/util/dog/foo.h
myproject/lib/thirdparty1/util/library.json
myproject/lib/thirdparty1/util/extra_script
myproject/lib/thirdparty2/util/dog/foo.h
myproject/lib/thirdparty2/util/library.json
myproject/lib/thirdparty2/util/extra_script
The problem I have is with the PIO generated CPPPATH content. At a minimum it looks like PIO auto creates the include path as follows:
- gathering up all found directories from the project’s lib directory
- add directories defined within platformio.ini build_flags variable
- add in all .platformio/package/framework… directories
so the result in my case is
-I myproject/lib/thirdparty1/util/dog \
-I myproject/lib/thirdparty2/util/dog \
-I /home/user/.platformio/packages/framework-arduinopackage/core/nrf52
Again there is a foo.h in all three include search locations. I need the foo.h to be picked up from the appropriate directory of the library currently being built.
when building lib/thirdparty1 i need -I myproject/lib/thirdparty1/util/dog/foo.h
when building lib/thirdparty2 i need -I myproject/lib/thirdparty2/util/dog/foo.h
when building the frame-work i need -I /home/user/.platformio/packages/framework-arduinoadafruitnrf52/core/nrf52/foo.h
When building the thirdparty libs I can, via the library.json “extraScript” content, filter out the unwanted paths from CPPPATH and get those to pick up the desired foo.h files.
The problem comes when building the PIO package framework library files. I do not see a way to filter the CPPPATH that is passed when building the PIO included framework files.
I would like to remove the includes of thirdparty1 and thirdparty2 libraries or just tell PIO to not search those at all during it’s prebuild process.
Renaming/moving/modifying the thirdparty files really should be considered as only a temporary workaround.
Thanks for any pointers on how this might be accomplished.