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

VST3 Client: Generate moduleinfo.json into Resources directory of bundle

This commit is contained in:
reuk 2023-05-16 21:08:08 +01:00
parent 06a2089872
commit 77458fb4f9
No known key found for this signature in database
GPG key ID: FCB43929F012EE5C
10 changed files with 162 additions and 152 deletions

View file

@ -445,7 +445,8 @@ function(juce_add_module module_path)
if(${module_name} STREQUAL "juce_audio_plugin_client")
list(REMOVE_ITEM headers
"${module_path}/LV2/juce_LV2ManifestHelper.cpp")
"${module_path}/LV2/juce_LV2ManifestHelper.cpp"
"${module_path}/VST3/juce_VST3ManifestHelper.cpp")
_juce_get_platform_plugin_kinds(plugin_kinds)

View file

@ -947,57 +947,28 @@ function(_juce_add_vst3_manifest_helper_target)
get_target_property(module_path juce::juce_audio_processors INTERFACE_JUCE_MODULE_PATH)
set(vst3_dir "${module_path}/juce_audio_processors/format_types/VST3_SDK")
set(public_dir "${vst3_dir}/public.sdk")
set(public_source_dir "${public_dir}/source")
set(public_common_dir "${public_source_dir}/common")
set(public_vst_dir "${public_source_dir}/vst")
set(hosting_dir "${public_vst_dir}/hosting")
set(extension "cpp")
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set(extra_source "${hosting_dir}/module_mac.mm")
set_source_files_properties("${extra_source}" PROPERTIES COMPILE_FLAGS "-fobjc-arc")
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(extra_source "${hosting_dir}/module_linux.cpp")
elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
set(extra_source
"${vst3_dir}/helper.manifest"
"${hosting_dir}/module_win32.cpp")
set(extension "mm")
endif()
add_executable(juce_vst3_helper
"${extra_source}"
"${hosting_dir}/module.cpp"
"${public_common_dir}/memorystream.cpp"
"${public_common_dir}/readfile.cpp"
"${public_dir}/samples/vst-utilities/moduleinfotool/source/main.cpp"
"${public_vst_dir}/moduleinfo/moduleinfocreator.cpp"
"${public_vst_dir}/moduleinfo/moduleinfoparser.cpp"
"${public_vst_dir}/utility/stringconvert.cpp"
"${public_vst_dir}/vstinitiids.cpp"
"${vst3_dir}/pluginterfaces/base/coreiids.cpp"
"${vst3_dir}/pluginterfaces/base/funknown.cpp")
set(source "${module_path}/juce_audio_plugin_client/VST3/juce_VST3ManifestHelper.${extension}")
add_executable(juce_vst3_helper "${source}")
add_executable(juce::juce_vst3_helper ALIAS juce_vst3_helper)
target_include_directories(juce_vst3_helper PRIVATE "${vst3_dir}" "${module_path}")
add_library(juce_interface_definitions INTERFACE)
_juce_add_standard_defs(juce_interface_definitions)
target_link_libraries(juce_vst3_helper PRIVATE juce_interface_definitions)
target_compile_features(juce_vst3_helper PRIVATE cxx_std_17)
target_include_directories(juce_vst3_helper PRIVATE "${vst3_dir}")
if((CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
OR (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
OR (CMAKE_CXX_COMPILER_ID STREQUAL "GNU"))
target_compile_options(juce_vst3_helper PRIVATE
"-Wno-deprecated-declarations"
"-Wno-expansion-to-defined"
"-Wno-format"
"-Wno-pragma-pack")
endif()
if((CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") OR (CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC"))
target_compile_options(juce_vst3_helper PRIVATE /EHsc /wd6387 /wd6031)
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
_juce_link_frameworks(juce_vst3_helper PRIVATE Cocoa)
target_compile_options(juce_vst3_helper PRIVATE -fobjc-arc)
endif()
set_target_properties(juce_vst3_helper PROPERTIES BUILD_WITH_INSTALL_RPATH ON)
@ -1048,22 +1019,6 @@ function(_juce_set_plugin_target_properties shared_code_target kind)
LIBRARY_OUTPUT_DIRECTORY "${output_path}/Contents/${JUCE_TARGET_ARCHITECTURE}-linux")
endif()
set(remove_command remove)
if("${CMAKE_VERSION}" VERSION_GREATER_EQUAL "3.17")
set(remove_command rm)
endif()
# Delete moduleinfo.json if it exists, and repair signing so we can still load the bundle
add_custom_command(TARGET ${target_name} POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E ${remove_command} -f "${output_path}/Contents/moduleinfo.json"
COMMAND "${CMAKE_COMMAND}"
"-Dsrc=${output_path}"
"-P" "${JUCE_CMAKE_UTILS_DIR}/checkBundleSigning.cmake"
VERBATIM)
get_target_property(manifest_enabled ${shared_code_target} JUCE_VST3_MANIFEST_ENABLED)
if("${manifest_enabled}")
# Add a target for the helper tool
_juce_add_vst3_manifest_helper_target()
@ -1072,22 +1027,14 @@ function(_juce_set_plugin_target_properties shared_code_target kind)
# Use the helper tool to write out the moduleinfo.json
add_custom_command(TARGET ${target_name} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E remove -f "${output_path}/Contents/moduleinfo.json"
COMMAND ${CMAKE_COMMAND} -E make_directory "${output_path}/Contents/Resources"
COMMAND juce_vst3_helper
-create
-version "${target_version_string}"
-path "${output_path}"
-output "${output_path}/Contents/moduleinfo.json"
-output "${output_path}/Contents/Resources/moduleinfo.json"
VERBATIM)
# Sign the moduleinfo.json then the full bundle from the inside out
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
add_custom_command(TARGET ${target_name} POST_BUILD
COMMAND xcrun codesign -f -s "-" "${output_path}/Contents/moduleinfo.json"
COMMAND "${CMAKE_COMMAND}"
"-Dsrc=${output_path}"
"-P" "${JUCE_CMAKE_UTILS_DIR}/checkBundleSigning.cmake"
VERBATIM)
endif()
endif()
_juce_set_copy_properties(${shared_code_target} ${target_name} "${output_path}" JUCE_VST3_COPY_DIR)

View file

@ -21,4 +21,16 @@
#
# ==============================================================================
if(NOT EXISTS "${src}")
message(STATUS "Unable to copy ${src} as it does not exist")
return()
endif()
get_filename_component(name "${src}" NAME)
if(EXISTS "${dest}/${name}")
message(STATUS "Destination ${dest}/${name} exists, overwriting")
file(REMOVE_RECURSE "${dest}/${name}")
endif()
file(INSTALL ${src} DESTINATION ${dest} USE_SOURCE_PERMISSIONS)