diff --git a/examples/CMake/readme.md b/examples/CMake/readme.md index 364236c5c5..61bffe3664 100644 --- a/examples/CMake/readme.md +++ b/examples/CMake/readme.md @@ -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, diff --git a/extras/AudioPluginHost/CMakeLists.txt b/extras/AudioPluginHost/CMakeLists.txt index 88defdffc8..7db0196789 100644 --- a/extras/AudioPluginHost/CMakeLists.txt +++ b/extras/AudioPluginHost/CMakeLists.txt @@ -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 diff --git a/extras/Build/CMake/JUCEUtils.cmake b/extras/Build/CMake/JUCEUtils.cmake index 19530de4a8..804400c9cc 100644 --- a/extras/Build/CMake/JUCEUtils.cmake +++ b/extras/Build/CMake/JUCEUtils.cmake @@ -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_link_libraries(${target} PUBLIC $<$: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()