I wonder how UE manages it. It compiles for consoles but you can download and modify the engine source. The license isn’t open but you can still get the source.
The implementations get compiled in based on whatever platform you’re compiling for using a bunch of #ifdef statements
In that case it’s just a matter of not including certain .h/.cpp files