Is there a method to produce a plugin which compiles correctly in an empty project but can also contain additional logic which is compiled and activated when built in a project with another plugin enabled?
My plugin should have behaviour that only applies if it’s being used in a project built for the SteamVR plugin, and have different behaviour that applies if it’s being used in a project built for the “Oculus VR” plugin. My plugin’s C++ code must be able to call functions that are declared/defined in the SteamVR/Oculus VR plugins.
A few ideas:
Plugin Descriptor File - I’m aware that you can flag an entire plugin as having a required dependency on another plugin, but what we’re looking for is more an ability to flag a specific module inside that plugin as depending on another plugin, and if that dependency isn’t found, skip that module.
Precompile Defines - This is likely a required part of the solution to enable some plugin-specific code to become inactive when its dependency isn’t found. Not sure where to start with manipulating these though.
Reflection - Should work for this type of thing but not sure of the intricacies with Unreal’s build process. Also a bummer due to the lack of compile-time safety and potential performance hit(?).
Let me know if you’ve run into this problem before and how you went about solving it.