1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

CMake: Link necessary libraries for hosting plugins

The CoreAudioKit (and on macOS, AudioUnit) frameworks are required to
host AudioUnit plugins. Hosts (especially those which don't use the
`juce_audio_utils` module) should use the new `PLUGINHOST_AU` parameter
to `juce_add_*` in order to add the correct preprocessor definition and
link the necessary frameworks.
This commit is contained in:
reuk 2020-05-14 16:44:48 +01:00
parent 36a37c36bb
commit 5e5ac203b9
No known key found for this signature in database
GPG key ID: 9ADCD339CFC98A11
3 changed files with 27 additions and 2 deletions

View file

@ -399,6 +399,12 @@ attributes directly to these creation functions, rather than adding them later.
`AAX_ePlugInCategory_SWGenerators`, `AAX_ePlugInCategory_WrappedPlugin`,
`AAX_ePlugInCategory_Effect`
- `PLUGINHOST_AU`
- May be either TRUE or FALSE (defaults to FALSE). If TRUE, will add the preprocessor definition
`JUCE_PLUGINHOST_AU=1` to the new target, and will link the macOS frameworks necessary for
hosting plugins. Using this parameter should be preferred over using
`target_compile_definitions` to manually set the `JUCE_PLUGINHOST_AU` preprocessor definition.
- `COPY_PLUGIN_AFTER_BUILD`
- Whether or not to install the plugin to the current system after building. False by default.
If you want all of the plugins in a subdirectory to be installed automatically after building,

View file

@ -17,7 +17,8 @@
juce_add_gui_app(AudioPluginHost
BUNDLE_ID com.juce.pluginhost
ICON_BIG "${CMAKE_CURRENT_SOURCE_DIR}/Source/JUCEAppIcon.png"
MICROPHONE_PERMISSION_ENABLED TRUE)
MICROPHONE_PERMISSION_ENABLED TRUE
PLUGINHOST_AU TRUE)
juce_generate_juce_header(AudioPluginHost)
@ -33,7 +34,6 @@ target_compile_definitions(AudioPluginHost PRIVATE
PIP_JUCE_EXAMPLES_DIRECTORY_STRING="${JUCE_SOURCE_DIR}/examples"
JUCE_ALSA=1
JUCE_DIRECTSOUND=1
JUCE_PLUGINHOST_AU=1
JUCE_PLUGINHOST_LADSPA=1
JUCE_PLUGINHOST_VST=0
JUCE_PLUGINHOST_VST3=1

View file

@ -1634,6 +1634,8 @@ function(_juce_set_fallback_properties target)
_juce_set_property_if_not_set(${target} DISABLE_AAX_BYPASS FALSE)
_juce_set_property_if_not_set(${target} DISABLE_AAX_MULTI_MONO FALSE)
_juce_set_property_if_not_set(${target} PLUGINHOST_AU FALSE)
get_target_property(bundle_id ${target} JUCE_BUNDLE_ID)
_juce_set_property_if_not_set(${target} AAX_IDENTIFIER ${bundle_id})
@ -1824,6 +1826,7 @@ function(_juce_initialise_target target)
AU_EXPORT_PREFIX
AU_SANDBOX_SAFE
AAX_CATEGORY
PLUGINHOST_AU # Set this true if you want to host AU plugins
VST_COPY_DIR
VST3_COPY_DIR
@ -1894,6 +1897,22 @@ function(_juce_initialise_target target)
$<TARGET_PROPERTY:${target},JUCE_GENERATED_SOURCES_DIRECTORY>)
target_link_libraries(${target} PUBLIC $<$<TARGET_EXISTS:juce_vst2_sdk>:juce_vst2_sdk>)
get_target_property(is_pluginhost_au ${target} JUCE_PLUGINHOST_AU)
if(is_pluginhost_au)
target_compile_definitions(${target} PUBLIC JUCE_PLUGINHOST_AU=1)
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" OR CMAKE_SYSTEM_NAME STREQUAL "iOS")
find_library(AU_CoreAudioKit CoreAudioKit REQUIRED)
target_link_libraries(${target} PRIVATE ${AU_CoreAudioKit})
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
find_library(AU_AudioUnit AudioUnit REQUIRED)
target_link_libraries(${target} PRIVATE ${AU_AudioUnit})
endif()
endif()
_juce_write_generate_time_info(${target})
_juce_link_optional_libraries(${target})
endfunction()