mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-09 23:34:20 +00:00
CMake: Add juce_enable_copy_plugin_step function
This commit is contained in:
parent
65bdf50d93
commit
3f17cc7b2e
2 changed files with 57 additions and 17 deletions
|
|
@ -589,6 +589,24 @@ disabled by setting the compile definitions `DONT_SET_USING_JUCE_NAMESPACE` and
|
|||
JuceHeader.h is optional. Instead, module headers can be included directly in source files that
|
||||
require them.
|
||||
|
||||
#### `juce_enable_copy_plugin_step`
|
||||
|
||||
juce_enable_copy_plugin_step(<target>)
|
||||
|
||||
As an alternative to the JUCE_COPY_PLUGIN_AFTER_BUILD property, you may call this function to
|
||||
manually enable post-build copy on a plugin. The argument to this function should be a target
|
||||
previously created with `juce_add_plugin`.
|
||||
|
||||
JUCE_COPY_PLUGIN_AFTER_BUILD will cause plugins to be installed immediately after building. This is
|
||||
not always appropriate, if extra build steps (such as signing or modifying the plugin bundle) must
|
||||
be executed before the install. In such cases, you should leave JUCE_COPY_PLUGIN_AFTER_BUILD
|
||||
disabled, use `add_custom_command(TARGET POST_BUILD)` to add your own post-build steps, and then
|
||||
finally call `juce_enable_copy_plugin_step`.
|
||||
|
||||
If your custom build steps need to use the location of the plugin artefact, you can extract this
|
||||
by querying the property `JUCE_PLUGIN_ARTEFACT_FILE` on a plugin target (*not* the shared code
|
||||
target!).
|
||||
|
||||
#### `juce_set_<kind>_sdk_path`
|
||||
|
||||
juce_set_aax_sdk_path(<absolute path>)
|
||||
|
|
|
|||
|
|
@ -1291,20 +1291,36 @@ function(_juce_copy_dir target from to)
|
|||
VERBATIM)
|
||||
endfunction()
|
||||
|
||||
function(_juce_copy_after_build shared_code target from to)
|
||||
get_target_property(wants_copy ${shared_code} JUCE_COPY_PLUGIN_AFTER_BUILD)
|
||||
function(_juce_set_copy_properties shared_code target from to_property)
|
||||
get_target_property(destination "${shared_code}" "${to_property}")
|
||||
|
||||
if(wants_copy)
|
||||
get_target_property(dest ${shared_code} ${to})
|
||||
|
||||
if(NOT dest)
|
||||
message(FATAL_ERROR "Target '${target}' wants to be copied, but its property '${to}' is not set")
|
||||
endif()
|
||||
|
||||
_juce_copy_dir(${target} "${from}" "$<GENEX_EVAL:$<TARGET_PROPERTY:${shared_code},${to}>>")
|
||||
if(destination)
|
||||
set_target_properties("${target}" PROPERTIES JUCE_PLUGIN_COPY_DIR "${destination}")
|
||||
endif()
|
||||
|
||||
set_target_properties("${target}" PROPERTIES JUCE_PLUGIN_ARTEFACT_FILE "${from}")
|
||||
endfunction()
|
||||
|
||||
function(juce_enable_copy_plugin_step shared_code_target)
|
||||
get_target_property(active_targets "${shared_code_target}" JUCE_ACTIVE_PLUGIN_TARGETS)
|
||||
|
||||
foreach(target IN LISTS active_targets)
|
||||
get_target_property(source "${target}" JUCE_PLUGIN_ARTEFACT_FILE)
|
||||
|
||||
if(source)
|
||||
get_target_property(dest "${target}" JUCE_PLUGIN_COPY_DIR)
|
||||
|
||||
if(dest)
|
||||
_juce_copy_dir("${target}" "${source}" "$<GENEX_EVAL:${dest}>")
|
||||
else()
|
||||
message(WARNING "Target '${target}' requested copy but no destination is set")
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
# ==================================================================================================
|
||||
|
||||
function(_juce_set_plugin_target_properties shared_code_target kind)
|
||||
set(target_name ${shared_code_target}_${kind})
|
||||
|
||||
|
|
@ -1336,7 +1352,7 @@ function(_juce_set_plugin_target_properties shared_code_target kind)
|
|||
LIBRARY_OUTPUT_DIRECTORY "${output_path}/Contents/${JUCE_LINUX_TARGET_ARCHITECTURE}-linux")
|
||||
endif()
|
||||
|
||||
_juce_copy_after_build(${shared_code_target} ${target_name} "${output_path}" JUCE_VST3_COPY_DIR)
|
||||
_juce_set_copy_properties(${shared_code_target} ${target_name} "${output_path}" JUCE_VST3_COPY_DIR)
|
||||
elseif(kind STREQUAL "VST")
|
||||
set_target_properties(${target_name} PROPERTIES
|
||||
BUNDLE_EXTENSION vst
|
||||
|
|
@ -1351,7 +1367,7 @@ function(_juce_set_plugin_target_properties shared_code_target kind)
|
|||
set(output_path "$<TARGET_BUNDLE_DIR:${target_name}>")
|
||||
endif()
|
||||
|
||||
_juce_copy_after_build(${shared_code_target} ${target_name} "${output_path}" JUCE_VST_COPY_DIR)
|
||||
_juce_set_copy_properties(${shared_code_target} ${target_name} "${output_path}" JUCE_VST_COPY_DIR)
|
||||
elseif(kind STREQUAL "AU")
|
||||
set_target_properties(${target_name} PROPERTIES
|
||||
BUNDLE_EXTENSION component
|
||||
|
|
@ -1361,7 +1377,7 @@ function(_juce_set_plugin_target_properties shared_code_target kind)
|
|||
XCODE_ATTRIBUTE_GENERATE_PKGINFO_FILE YES)
|
||||
|
||||
set(output_path "$<TARGET_BUNDLE_DIR:${target_name}>")
|
||||
_juce_copy_after_build(${shared_code_target} ${target_name} "${output_path}" JUCE_AU_COPY_DIR)
|
||||
_juce_set_copy_properties(${shared_code_target} ${target_name} "${output_path}" JUCE_AU_COPY_DIR)
|
||||
elseif(kind STREQUAL "AUv3")
|
||||
set_target_properties(${target_name} PROPERTIES
|
||||
XCODE_PRODUCT_TYPE "com.apple.product-type.app-extension"
|
||||
|
|
@ -1382,7 +1398,7 @@ function(_juce_set_plugin_target_properties shared_code_target kind)
|
|||
_juce_create_windows_package(${shared_code_target} ${target_name} aaxplugin "${default_icon}" Win32 x64)
|
||||
|
||||
set(output_path "${products_folder}/${product_name}.aaxplugin")
|
||||
_juce_copy_after_build(${shared_code_target} ${target_name} "${output_path}" JUCE_AAX_COPY_DIR)
|
||||
_juce_set_copy_properties(${shared_code_target} ${target_name} "${output_path}" JUCE_AAX_COPY_DIR)
|
||||
elseif(kind STREQUAL "Unity")
|
||||
set_target_properties(${target_name} PROPERTIES
|
||||
BUNDLE_EXTENSION bundle
|
||||
|
|
@ -1399,7 +1415,7 @@ function(_juce_set_plugin_target_properties shared_code_target kind)
|
|||
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||
set(output_path "$<TARGET_BUNDLE_DIR:${target_name}>")
|
||||
_juce_copy_after_build(${shared_code_target} ${target_name} "${output_path}" JUCE_UNITY_COPY_DIR)
|
||||
_juce_set_copy_properties(${shared_code_target} ${target_name} "${output_path}" JUCE_UNITY_COPY_DIR)
|
||||
else()
|
||||
# On windows and linux, the gui script needs to be copied next to the unity output
|
||||
add_custom_command(TARGET ${target_name} POST_BUILD
|
||||
|
|
@ -1407,11 +1423,11 @@ function(_juce_set_plugin_target_properties shared_code_target kind)
|
|||
DEPENDS "${script_file}"
|
||||
VERBATIM)
|
||||
|
||||
_juce_copy_after_build(${shared_code_target}
|
||||
_juce_set_copy_properties(${shared_code_target}
|
||||
${target_name}
|
||||
"$<TARGET_FILE:${target_name}>"
|
||||
JUCE_UNITY_COPY_DIR)
|
||||
_juce_copy_after_build(${shared_code_target}
|
||||
_juce_set_copy_properties(${shared_code_target}
|
||||
${target_name}
|
||||
"${script_file}"
|
||||
JUCE_UNITY_COPY_DIR)
|
||||
|
|
@ -1658,6 +1674,12 @@ function(_juce_configure_plugin_targets target)
|
|||
"$<TARGET_BUNDLE_DIR:${target}_AUv3>"
|
||||
"$<TARGET_BUNDLE_CONTENT_DIR:${target}_Standalone>/PlugIns")
|
||||
endif()
|
||||
|
||||
get_target_property(wants_copy "${target}" JUCE_COPY_PLUGIN_AFTER_BUILD)
|
||||
|
||||
if(wants_copy)
|
||||
juce_enable_copy_plugin_step("${target}")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# ==================================================================================================
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue