Browse Source

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

v7.0.9
reuk 2 years ago
parent
commit
77458fb4f9
No known key found for this signature in database GPG Key ID: FCB43929F012EE5C
10 changed files with 165 additions and 155 deletions
  1. +2
    -1
      extras/Build/CMake/JUCEModuleSupport.cmake
  2. +16
    -69
      extras/Build/CMake/JUCEUtils.cmake
  3. +12
    -0
      extras/Build/CMake/copyDir.cmake
  4. +15
    -15
      extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_MSVC.h
  5. +8
    -9
      extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Make.h
  6. +11
    -19
      extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Xcode.h
  7. +5
    -42
      extras/Projucer/Source/ProjectSaving/jucer_ProjectExporter.h
  8. +68
    -0
      modules/juce_audio_plugin_client/VST3/juce_VST3ManifestHelper.cpp
  9. +26
    -0
      modules/juce_audio_plugin_client/VST3/juce_VST3ManifestHelper.mm
  10. +2
    -0
      modules/juce_audio_plugin_client/juce_audio_plugin_client_VST3.cpp

+ 2
- 1
extras/Build/CMake/JUCEModuleSupport.cmake 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)



+ 16
- 69
extras/Build/CMake/JUCEUtils.cmake 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")
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(extension "mm")
endif()

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_compile_features(juce_vst3_helper PRIVATE cxx_std_17)
target_include_directories(juce_vst3_helper PRIVATE "${vst3_dir}")
target_include_directories(juce_vst3_helper PRIVATE "${vst3_dir}" "${module_path}")

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()
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)

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)


+ 12
- 0
extras/Build/CMake/copyDir.cmake 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)

+ 15
- 15
extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_MSVC.h View File

@@ -798,12 +798,9 @@ public:
}
else if (type == VST3Helper)
{
for (const auto& source : owner.getVST3HelperProgramSources (owner))
{
const auto location = owner.rebaseFromProjectFolderToBuildTarget (source)
.toWindowsStyle();
cppFiles->createNewChildElement ("ClCompile")->setAttribute ("Include", location);
}
const auto location = owner.rebaseFromProjectFolderToBuildTarget (owner.getVST3HelperProgramSource())
.toWindowsStyle();
cppFiles->createNewChildElement ("ClCompile")->setAttribute ("Include", location);
}
}
@@ -1344,15 +1341,18 @@ public:
// moduleinfotool doesn't handle Windows-style path separators properly when computing the bundle name
const auto normalisedBundlePath = getOwner().getOutDirFile (config, segments[0]).replace ("\\", "/");
return "\r\n"
+ writer.quoted()
+ " -create -version "
+ getOwner().project.getVersionString().quoted()
+ " -path "
+ normalisedBundlePath.quoted()
+ " -output "
+ (getOwner().getOutDirFile (config, segments[0]) + "\\Contents\\moduleinfo.json").quoted();
const auto contentsDir = normalisedBundlePath + "\\Contents";
const auto resourceDir = contentsDir + "\\Resources";
return "\r\ndel /s /q " + (contentsDir + "\\moduleinfo.json").quoted() + "\r\n"
"if not exist " + resourceDir.quoted() + " mkdir " + resourceDir.quoted() + "\r\n"
+ writer.quoted()
+ " -create -version "
+ getOwner().project.getVersionString().quoted()
+ " -path "
+ normalisedBundlePath.quoted()
+ " -output "
+ (resourceDir + "\\moduleinfo.json").quoted();
}();
const auto pkgScript = copyBuildOutputIntoBundle (segments);


+ 8
- 9
extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Make.h View File

@@ -410,11 +410,13 @@ public:
{
if (owner.project.isVst3ManifestEnabled())
{
out << "\t$(V_AT) $(JUCE_OUTDIR)/$(JUCE_TARGET_VST3_MANIFEST_HELPER) "
out << "\t-$(V_AT)mkdir -p $(JUCE_OUTDIR)/$(JUCE_VST3DIR)/Contents/Resources" << newLine
<< "\t-$(V_AT)rm -f $(JUCE_OUTDIR)/$(JUCE_VST3DIR)/Contents/moduleinfo.json" << newLine
<< "\t$(V_AT) $(JUCE_OUTDIR)/$(JUCE_TARGET_VST3_MANIFEST_HELPER) "
"-create "
"-version " << owner.project.getVersionString().quoted() << " "
"-path \"$(JUCE_OUTDIR)/$(JUCE_VST3DIR)\" "
"-output \"$(JUCE_OUTDIR)/$(JUCE_VST3DIR)/Contents/moduleinfo.json\" " << newLine;
"-output \"$(JUCE_OUTDIR)/$(JUCE_VST3DIR)/Contents/Resources/moduleinfo.json\"" << newLine;
}
out << "\t-$(V_AT)[ ! \"$(JUCE_VST3DESTDIR)\" ] || (mkdir -p $(JUCE_VST3DESTDIR) && cp -R $(JUCE_COPYCMD_VST3))" << newLine;
@@ -1200,13 +1202,10 @@ private:
}
else if (targetType == MakefileTarget::VST3Helper)
{
for (const auto& source : getVST3HelperProgramSources (*this))
{
targetFiles.emplace_back (source.rebased (projectFolder,
getTargetFolder(),
build_tools::RelativePath::buildTargetFolder),
String{});
}
targetFiles.emplace_back (getVST3HelperProgramSource().rebased (projectFolder,
getTargetFolder(),
build_tools::RelativePath::buildTargetFolder),
String{});
}
return targetFiles;


+ 11
- 19
extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Xcode.h View File

@@ -2135,18 +2135,15 @@ private:
}
if (target->type == XcodeTarget::VST3Helper
&& project.getEnabledModules().isModuleEnabled ("juce_audio_processors"))
&& project.getEnabledModules().isModuleEnabled ("juce_audio_plugin_client"))
{
for (const auto& source : getVST3HelperProgramSources (*this))
{
const auto path = rebaseFromProjectFolderToBuildTarget (source);
addFile (FileOptions().withRelativePath ({ expandPath (path.toUnixStyle()), path.getRoot() })
.withSkipPCHEnabled (true)
.withCompilationEnabled (true)
.withInhibitWarningsEnabled (true)
.withCompilerFlags ("-std=c++17 -fobjc-arc")
.withXcodeTarget (target));
}
const auto path = rebaseFromProjectFolderToBuildTarget (getVST3HelperProgramSource());
addFile (FileOptions().withRelativePath ({ expandPath (path.toUnixStyle()), path.getRoot() })
.withSkipPCHEnabled (true)
.withCompilationEnabled (true)
.withInhibitWarningsEnabled (true)
.withCompilerFlags ("-std=c++17 -fobjc-arc")
.withXcodeTarget (target));
}
auto targetName = String (target->getName());
@@ -2369,16 +2366,11 @@ private:
}
else if (target->type == XcodeTarget::VST3PlugIn && project.isVst3ManifestEnabled())
{
// Generate the manifest
script << "\"$CONFIGURATION_BUILD_DIR/" << Project::getVST3FileWriterName() << "\" "
"-create "
"-version " << project.getVersionString().quoted() << " "
"-path \"$CONFIGURATION_BUILD_DIR/$FULL_PRODUCT_NAME\" "
"-output \"$CONFIGURATION_BUILD_DIR/$FULL_PRODUCT_NAME/Contents/moduleinfo.json\"\n";
// Sign the manifest (a prerequisite of signing the containing bundle)
script << "xcrun codesign -f -s - \"$CONFIGURATION_BUILD_DIR/$FULL_PRODUCT_NAME/Contents/moduleinfo.json\"\n";
// Sign the full bundle
script << "xcrun codesign -f -s - \"$CONFIGURATION_BUILD_DIR/$FULL_PRODUCT_NAME\"\n";
"-output \"$CONFIGURATION_BUILD_DIR/$FULL_PRODUCT_NAME/Contents/Resources/moduleinfo.json\"\n";
}
target->addShellScriptBuildPhase ("Update manifest", script);
@@ -2986,7 +2978,7 @@ private:
output << "\t};\n\trootObject = " << createID ("__root") << " /* Project object */;\n}\n";
}
String addFileReference (String pathString, String fileType = {}) const
String addFileReference (String pathString, const String& fileType = {}) const
{
String sourceTree ("SOURCE_ROOT");
build_tools::RelativePath path (pathString, build_tools::RelativePath::unknown);
@@ -3004,7 +2996,7 @@ private:
return addFileOrFolderReference (pathString, sourceTree, fileType.isEmpty() ? getFileType (pathString) : fileType);
}
String addFileOrFolderReference (const String& pathString, String sourceTree, String fileType) const
String addFileOrFolderReference (const String& pathString, const String& sourceTree, const String& fileType) const
{
auto fileRefID = createFileRefID (pathString);
auto filename = build_tools::RelativePath (pathString, build_tools::RelativePath::unknown).getFileName();


+ 5
- 42
extras/Projucer/Source/ProjectSaving/jucer_ProjectExporter.h View File

@@ -223,49 +223,12 @@ public:
.getChildFile ("juce_LV2ManifestHelper.cpp");
}
std::vector<build_tools::RelativePath> getVST3HelperProgramSources (const ProjectExporter& exporter) const
build_tools::RelativePath getVST3HelperProgramSource() const
{
const auto base = getModuleFolderRelativeToProject ("juce_audio_processors").getChildFile ("format_types")
.getChildFile ("VST3_SDK");
const auto publicSdk = base.getChildFile ("public.sdk");
const auto source = publicSdk.getChildFile ("source");
const auto vst = source.getChildFile ("vst");
const auto hosting = vst.getChildFile ("hosting");
const auto plugBase = base.getChildFile ("pluginterfaces")
.getChildFile ("base");
std::vector<build_tools::RelativePath> result
{
hosting.getChildFile ("module.cpp"),
base.getChildFile ("public.sdk")
.getChildFile ("samples")
.getChildFile ("vst-utilities")
.getChildFile ("moduleinfotool")
.getChildFile ("source")
.getChildFile ("main.cpp"),
source.getChildFile ("common")
.getChildFile ("memorystream.cpp"),
source.getChildFile ("common")
.getChildFile ("readfile.cpp"),
vst.getChildFile ("moduleinfo")
.getChildFile ("moduleinfocreator.cpp"),
vst.getChildFile ("moduleinfo")
.getChildFile ("moduleinfoparser.cpp"),
vst.getChildFile ("utility")
.getChildFile ("stringconvert.cpp"),
vst.getChildFile ("vstinitiids.cpp"),
plugBase.getChildFile ("coreiids.cpp"),
plugBase.getChildFile ("funknown.cpp"),
};
if (exporter.isOSX())
result.push_back (hosting.getChildFile ("module_mac.mm"));
else if (exporter.isLinux())
result.push_back (hosting.getChildFile ("module_linux.cpp"));
else if (exporter.isWindows())
result.push_back (hosting.getChildFile ("module_win32.cpp"));
return result;
const auto suffix = isOSX() ? "mm" : "cpp";
return getModuleFolderRelativeToProject ("juce_audio_plugin_client")
.getChildFile ("VST3")
.getChildFile (String ("juce_VST3ManifestHelper.") + suffix);
}
//==============================================================================


+ 68
- 0
modules/juce_audio_plugin_client/VST3/juce_VST3ManifestHelper.cpp View File

@@ -0,0 +1,68 @@
/*
==============================================================================
This file is part of the JUCE library.
Copyright (c) 2022 - Raw Material Software Limited
JUCE is an open source library subject to commercial or open-source
licensing.
By using JUCE, you agree to the terms of both the JUCE 7 End-User License
Agreement and JUCE Privacy Policy.
End User License Agreement: www.juce.com/juce-7-licence
Privacy Policy: www.juce.com/juce-privacy-policy
Or: You may also use this code under the terms of the GPL v3 (see
www.gnu.org/licenses).
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
DISCLAIMED.
==============================================================================
*/
#include <juce_core/system/juce_CompilerWarnings.h>
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wc++98-compat-extra-semi",
"-Wdeprecated-declarations",
"-Wexpansion-to-defined",
"-Wfloat-equal",
"-Wformat",
"-Wmissing-prototypes",
"-Wpragma-pack",
"-Wredundant-decls",
"-Wshadow",
"-Wshadow-field",
"-Wshorten-64-to-32",
"-Wsign-conversion",
"-Wzero-as-null-pointer-constant")
JUCE_BEGIN_IGNORE_WARNINGS_MSVC (6387 6031)
#ifndef NOMINMAX
#define NOMINMAX 1
#endif
#if JUCE_MAC
#include <juce_audio_processors/format_types/VST3_SDK/public.sdk/source/vst/hosting/module_mac.mm>
#elif JUCE_WINDOWS
#include <juce_audio_processors/format_types/VST3_SDK/public.sdk/source/vst/hosting/module_win32.cpp>
#elif JUCE_LINUX
#include <juce_audio_processors/format_types/VST3_SDK/public.sdk/source/vst/hosting/module_linux.cpp>
#endif
#include <juce_audio_processors/format_types/VST3_SDK/pluginterfaces/base/coreiids.cpp>
#include <juce_audio_processors/format_types/VST3_SDK/pluginterfaces/base/funknown.cpp>
#include <juce_audio_processors/format_types/VST3_SDK/public.sdk/samples/vst-utilities/moduleinfotool/source/main.cpp>
#include <juce_audio_processors/format_types/VST3_SDK/public.sdk/source/common/memorystream.cpp>
#include <juce_audio_processors/format_types/VST3_SDK/public.sdk/source/common/readfile.cpp>
#include <juce_audio_processors/format_types/VST3_SDK/public.sdk/source/vst/hosting/module.cpp>
#include <juce_audio_processors/format_types/VST3_SDK/public.sdk/source/vst/moduleinfo/moduleinfocreator.cpp>
#include <juce_audio_processors/format_types/VST3_SDK/public.sdk/source/vst/moduleinfo/moduleinfoparser.cpp>
#include <juce_audio_processors/format_types/VST3_SDK/public.sdk/source/vst/utility/stringconvert.cpp>
#include <juce_audio_processors/format_types/VST3_SDK/public.sdk/source/vst/vstinitiids.cpp>
JUCE_END_IGNORE_WARNINGS_MSVC
JUCE_END_IGNORE_WARNINGS_GCC_LIKE

+ 26
- 0
modules/juce_audio_plugin_client/VST3/juce_VST3ManifestHelper.mm View File

@@ -0,0 +1,26 @@
/*
==============================================================================
This file is part of the JUCE library.
Copyright (c) 2022 - Raw Material Software Limited
JUCE is an open source library subject to commercial or open-source
licensing.
By using JUCE, you agree to the terms of both the JUCE 7 End-User License
Agreement and JUCE Privacy Policy.
End User License Agreement: www.juce.com/juce-7-licence
Privacy Policy: www.juce.com/juce-privacy-policy
Or: You may also use this code under the terms of the GPL v3 (see
www.gnu.org/licenses).
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
DISCLAIMED.
==============================================================================
*/
#include "juce_VST3ManifestHelper.cpp"

+ 2
- 0
modules/juce_audio_plugin_client/juce_audio_plugin_client_VST3.cpp View File

@@ -3954,6 +3954,8 @@ public:
tresult PLUGIN_API getCompatibilityJSON (IBStream* stream) override
{
const ScopedJuceInitialiser_GUI libraryInitialiser;
auto filter = createPluginFilterOfType (AudioProcessor::WrapperType::wrapperType_VST3);
auto* extensions = dynamic_cast<const VST3ClientExtensions*> (filter.get());


Loading…
Cancel
Save