Add specific AAX code (at compile time)

Hi :slight_smile:

If I have a plugin project with AAX, AU, and VST3 targets, is there a way to include code that is only compiled with one of the targets?

I know of PluginHostType, which is great but it does this at runtime and not compile time.

I’m suprised there is not a single define, for example, #ifdef BUILD_AAX would be perfect. As I understood this is because the project files are part of the “Shared” target so they are all built and added to the final plugins, no matter the target.

I’ve been searching for a solution and I found an old post which said you can name your files xxx_AAX.cpp and that file will only be included in the AAX build. Is that still correct?

Thanks!
Simon

#if JucePlugin_Build_AAX

Rail

1 Like

Ha ok fair enough, that’s a decent solution. But it also means I have to edit the Projucer project or the JucePluginDefines.h every time I compile.

I guess that’s a good compromise: during development using the PluginHostType, and on release day rebuild each plugin one by one making sure the other plugins are deactivated in Projucer.

I think you misunderstood. This is defined when the AAX is being compiled so is exactly what you asked for in the OP

Rail

Not exactly. JucePlugin_Build_AAX will be set to 1 in the shared code target if AAX is one of the formats being built.

The request being made is not possible, due to the way JUCE’s build system works. The plugin’s shared code is compiled only once, and that is used by each format wrapper – meaning, the shared code must be exactly the same for all formats!

Something like this is the only solution, but I highly advise you against it. Just use the runtime check.

Fair enough, it’s very clear - thank you all for the replies :slight_smile: