Hello,
I’m generating a bunch of files, and they need some dependencies to compile.
In the python script in my library, I add the generated files in the env and currently I manually add the includes of other libraries needed to compile this one using env.Append(CCFLAGS=[“-I<path to include libA”])
I didn’t find a way to specify this outside of the library.json dynamically (because the libA dependency is only needed for some platforms)
Maybe using LibBuilderFactory?
Thanks!
This appears to be a classical xy-problem.
If I have understood you correctly:
- You are writing a library
- This library has dependencies but only for certain platforms.
Your actual question would therefore be:
How can this be solved with PlatformIO?
If that’s correct the solution is very simple and does not require any custom scripts.
You can specify the platform for dependencies. See dependencies — PlatformIO latest documentation
Thank you for the answer, I didn’t knew that we could specify the platform in the dependency list! This may be a solution I will explore.
Meanwhile, I was searching how to do it in a script, and almost found how, but this required getting all the libBuilders using DefaultEnvironment().GetLibBuilders()… however this list does not include the libBuilders from the platform builder (In my case I’m using platform-apollo3blue/builder/frameworks/ambiqsuitesdk-sfe.py at master · nigelb/platform-apollo3blue · GitHub, that adds libBuilders but they do no appear in the list from DefaultEnvironment)