Looking for various envs for a library

My library project contains a hardware abstraction layer that needs to compile a specific lib for several HW platforms.

As far as I see, with library.json I can not control from outside which HW platform is build.

It is not just a few compile time switches, it is about selecting sourcecode and include files based on the HW platform.

What I would need is a platformio.ini inside the library tree … is this the intended way?

In the documentation I saw that a similiar example was solved with “extra_script” that directly modified the scons environment … this is what I want to avoid.

Any help is appreciated.

Best Regards, Axel.

This is the only solution for your use case. It does not modify global SCons build environment, only internal for your library.

Example => Redirecting...

Thanks for the quick response, I had the hope of not getting in touch with Scons.