Hello,
I have a library I need to compile for two different platforms, so I want to remove all other platform-specific code from compilation. I found this page, which gives an example exactly for what I want to do.
My directory structure is this (located in .pio/libdeps/debug
):
avarange-cnc
├── pio_set_feather_platform.py
├── src
│ ├── bananapi
│ ├── feather
├── library.json
Contents of library.json
:
{
"name": "avarange-cnc",
"version": "0.0.0",
"build": {
"extraScript": "pio_set_feather_platform.py"
}
}
Contents of pio_set_feather_platform.py
:
Import("env")
from os.path import realpath
env.Append(CPPPATH=[realpath("src/feather")])
env.Replace(SRC_FILTER=["+<*>", "-<src*>", "+<src/feather>"])
But this does not work. PlatformIO still attempts to compile code from the wrong subdirectory:
.pio/libdeps/debug/avarange-cnc/src/bananapi/avarange_cnc.c:2:10: fatal error: avarange-platform/macros.h: No such file or directory
2 | #include <avarange-platform/macros.h>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
I checked that the script is executed, and it is, realpath works etc. so I don’t know what is wrong.
What am I missing?
Thanks.