This is a two-piece question, however both parts are somewhat related.
COPY_PLUGIN_AFTER_BUILD with CLion
I’m using CLion as IDE and found out that when specifying
COPY_PLUGIN_AFTER_BUILD TRUE with
juce_add_plugin I need to run the Install step after the build in order to run the copy step, so I added it to the run config like this as step before launch
This works, but from the command line output generated I see that beneath the plugin executables tons of stuff gets installed to
/usr/local/include/JUCE-6.0.0/modules/ (basically the whole JUCE source files). This does not really harm but it makes builds a bit longer and it seems like a totally unnecessary thing. So first of all I’m wondering if I’m doing anything wrong here?
2. Using CPack to create plugin installers
I just discovered CPack which seems to be a quite simple way to create platform specific installers from within CMake.
With those few lines of CMake code I nearly get a basic working VST3 & AU capable installer ready
# CPack takes these paths as the locations where the plugins should be installed in the end install (TARGETS MYPLUGIN_VST3 LIBRARY DESTINATION /Library/Audio/Plug-Ins/VST3 COMPONENT VST3) install (TARGETS MYPLUGIN_AU LIBRARY DESTINATION /Library/Audio/Plug-Ins/Components COMPONENT AU) # This makes sure that only the two components and nothing else is part of our installer SET (CPACK_COMPONENTS_ALL VST3 AU) # We want to use the native Apple GUI installer SET (CPACK_GENERATOR productbuild)
cpack now from the command line I get the following error:
CMake Error at Deployment/MacOS/cmake_install.cmake:62 (file): file INSTALL cannot make directory "/Library/Audio/Plug-Ins/Components/MYPLUGIN.component": Permission denied.
Which shows me that invoking
cpack installs the plugin to the system folder before creating the installer. Running
sudo fixes this issue and creates a working installer. I could also tolerate that, BUT with the modifications above added to the CMakeLists.txt the Install step triggered from CLion now attempts to install my plugin to the system folder rather than the user folder which seems somewhat logical but fails now due to permission issues.
Three questions arising from that:
- Am I doing everything right with adding the Install step in CLion or is there any better way to do it (e.g. manually add some script that is called to copy the plugins from the
MYPLUGIN_artefactsto the user folder)?
- Is there any clever way of chosing a different INSTALL configuration only applied to CPack
- Can CPack run without installing everything to the location where the generated installer would install the binaries to so that running
cpackis possible without root permissions?