Detect whether a header file is compiled with Rez?

Since AppConfig.h is pumped through Rez while include_juce_audio_plugin_client_AU.r is compiled, so will all the files included therein, e.g. in the user-defined code section. Because Rez has very limited parsing, I need to skip some code in the headers.

Until now, I inserted #define UseExtendedThingResource 1 into include_juce_audio_plugin_client_AU.r, which did the trick for me, but that happens to be eliminated each time Projucer saves the project.

Is there a preprocessor define, e.g. __REZ__ or the like, that would tell whether a file is compiled by Rez?

modules/juce_audio_plugin_client/juce_audio_plugin_client_AU.r (which is included by include_juce_audio_plugin_client_AU.r), has the line #define UseExtendedThingResource 1 at the top, and then it includes AppConfig.h (or JucePluginDefines.h in JUCE 6).

So I don’t think you have to modify include_juce_audio_plugin_client_AU.r yourself.

Thanks for your quick reply!

Unfortunately sequence matters. AppConfig.h is include before UseExtendedThingResource is set. I already need that setting (or an equivalent) known in AppConfig.h.

(Or more precisely, in the files included by AppConfig.h)

Right, unless you use JUCE 6 and set “Use Global AppConfig Header” to “Disabled”, but that’s maybe not a viable option for you.

Looking at how Xcode calls Rez, I can see that there are several preprocessor defines passed on the command line (with the flag -d): SystemSevenOrLater=1 and x86_64_YES seem to be the most promising ones.

1 Like

JUCE 6 is fine here. Thanks for the hint at “Use Global AppConfig Header”. I didn’t notice it yet.

SystemSevenOrLater=1 should be exotic enough to be unique in this context, but it’s certainly a hack. I’ll give it a try.

Maybe the best solution would be to separate simple defines that Rez can parse from more complex definitions (e.g. ProjectInfo). The main challenge however is that Rez does not like (relative) paths for #include statements.