Module with optional dependency to GUI modules - possible?


I’m starting a project where interaction with our own custom IO-Hardware will be a core element. I’d like to bundle all functionality for the hardware access into a juce module for better reusability.

Part of the functionality will be hardware configuration. As the code should target embedded platforms without any GUI as well as PC-platforms I’d like to implement options for hardware configuration either through loading config files or through interactive GUI components.

To support the GUI-less targets I don’t like to declare the juce GUI related modules as a dependency, however, if a project has these modules it would be nice if GUI-config functionality would become available by automatically setting some macros that enable the relevant code passages. I didn’t read anything regarding this in the module documentation.

I know that I could split this into two separate modules, one only relying on juce_core and the other on all additional GUI modules, but this would probably make things a lot more complicated. I also know that I could include my own macros allowing to enable these features by hand if it’s a project where GUI modules are included but that would break the nice dependency-check functionality of the modules.

How would you do this?