CMake, COPY_PLUGIN_AFTER_BUILD and custom POST_BUILD

Hi guys,

I was wondering what would be the best practice to have custom POST_BUILD,
in my case some private framework copy in the bundle or PACE protection
to be made before COPY_PLUGIN_AFTER_BUILD ?

Thanks !

Maybe the best would be to have a manual command which can be setup after my own command ?

_juce_copy_after_build_all with no argument that uses all the predefine stuff
that I can call at the end of my cmake so it’s executed last.

bump :slight_smile:

2021 bump

Thanks !

Dear Reuk, lord of CMake, is this possible to add that kind of customisation ?

Thanks !

At the moment I’m struggling to think of a suitable way to implement this feature which would maintain the existing behaviour and avoid adding potentially confusing options. I don’t particularly like the idea of a new _copy_after_build function, as this would require some additional JUCE_USE_SEPARATE_COPY_AFTER_BUILD flag to be passed to juce_add_plugin in order to suppress the existing copy step.

An alternative approach might be to use a custom JUCE_AAX_COPY_DIR to copy the plugin to an intermediate location in your build tree. Then, you could use add_custom_command(TARGET ... POST_BUILD) as usual to modify the plugin, and then copy it manually to its install location after that. Might something like that work in your case?

Well the issue is not limited to AAX.
As long as you copy private framework into the bundle for a dylib for example, you are annoyed.

If you have a dedicated _copy_after_build function you won’t need any JUCE_USE_SEPARATE_COPY_AFTER_BUILD as you can call manually _copy_after_build in your cmake

People that don’t need custom behavior will use COPY_PLUGIN_AFTER_BUILD and other will manually add as a post build command _copy_after_build after their own post build command.

the goal here is to avoid duplicating juce own code that does the right thing

I’ve merged a feature which is pretty close to what you suggested:

In testing, this allows additional custom POST_BUILD commands to run before the plugin copy step. Note that the JUCE_COPY_PLUGIN_AFTER_BUILD property must be disabled if you wish to use the new function.

Please let me know if there are any issues with this solution.

2 Likes

I just ran into the same issue (with AAX) and this solution was a life saver, thank you!

1 Like