Implementing Arduino library for Pico SDK "baremetal" platform

I am re-factoring a bunch of Adafruit Arduino libraries for the Raspberry Pico SDK “baremetal” platform, with the intention of submitting PRs once completed.

My goal is to submit a PR with minimal changes, so no re-writing their base classes or other extensive refactoring with funky static templates that place a heavy burden on the maintainers.

  1. The libraries only have a “” for each, which how I assume PIO decides it’s an Arduino only library? I ask because I need to use lib_compat_mode = off to test compile them. Is a library.json the way to go without breaking existing Arduino compatibility?

  2. Most of the .h files are fine and can be fixed with a few #ifdef #define, but they do need new .cpp implementations. Assuming no clever CRTP et al, I basically want “build time polymophism” for want of a better expression. I need to be able to change the srcFilter in the library.json based on the platform so I can select the implementation files via a simple +<pico.cpp> -<arduino.cpp>.

Are there any docs or existing libraries I can look at that will help me here?