| @@ -948,7 +948,8 @@ 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_vst_dir "${public_dir}/source/vst") | |||
| set(public_source_dir "${public_dir}/source") | |||
| set(public_vst_dir "${public_source_dir}/vst") | |||
| set(hosting_dir "${public_vst_dir}/hosting") | |||
| if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") | |||
| @@ -966,23 +967,27 @@ function(_juce_add_vst3_manifest_helper_target) | |||
| "${extra_source}" | |||
| "${hosting_dir}/module.cpp" | |||
| "${public_dir}/samples/vst-utilities/moduleinfotool/source/main.cpp" | |||
| "${public_source_dir}/common/memorystream.cpp" | |||
| "${public_vst_dir}/moduleinfo/moduleinfocreator.cpp" | |||
| "${public_vst_dir}/moduleinfo/moduleinfoparser.cpp" | |||
| "${public_vst_dir}/utility/stringconvert.cpp" | |||
| "${vst3_dir}/pluginterfaces/base/coreiids.cpp") | |||
| "${public_vst_dir}/vstinitiids.cpp" | |||
| "${vst3_dir}/pluginterfaces/base/coreiids.cpp" | |||
| "${vst3_dir}/pluginterfaces/base/funknown.cpp") | |||
| 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 | |||
| "${module_path}/juce_audio_processors/format_types/VST3_SDK") | |||
| 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-deprecated-declarations") | |||
| "-Wno-format" | |||
| "-Wno-pragma-pack") | |||
| endif() | |||
| if((CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") OR (CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC")) | |||
| @@ -996,7 +1001,7 @@ function(_juce_add_vst3_manifest_helper_target) | |||
| set_target_properties(juce_vst3_helper PROPERTIES BUILD_WITH_INSTALL_RPATH ON) | |||
| set(THREADS_PREFER_PTHREAD_FLAG ON) | |||
| find_package(Threads REQUIRED) | |||
| target_link_libraries(juce_vst3_helper PRIVATE Threads::Threads ${CMAKE_DL_LIBS}) | |||
| target_link_libraries(juce_vst3_helper PRIVATE Threads::Threads ${CMAKE_DL_LIBS} juce_recommended_config_flags) | |||
| endfunction() | |||
| # ================================================================================================== | |||
| @@ -227,29 +227,33 @@ public: | |||
| { | |||
| const auto base = getModuleFolderRelativeToProject ("juce_audio_processors").getChildFile ("format_types") | |||
| .getChildFile ("VST3_SDK"); | |||
| const auto vst = base.getChildFile ("public.sdk") | |||
| .getChildFile ("source") | |||
| .getChildFile ("vst"); | |||
| 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"), | |||
| base.getChildFile ("pluginterfaces") | |||
| .getChildFile ("base") | |||
| .getChildFile ("coreiids.cpp"), | |||
| hosting.getChildFile ("module.cpp"), | |||
| source.getChildFile ("common") | |||
| .getChildFile ("memorystream.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()) | |||
| @@ -23,3 +23,6 @@ inclusion in JUCE. | |||
| - std:: qualification was added to std::move call in module.cpp to silence | |||
| a -Wunqualified-std-cast-call warning | |||
| - The main.cpp of moduleinfotool was updated to include information exported | |||
| by the plugin's IPluginCompatibility object, if present. | |||
| @@ -35,11 +35,13 @@ | |||
| // OF THE POSSIBILITY OF SUCH DAMAGE. | |||
| //----------------------------------------------------------------------------- | |||
| #include "public.sdk/source/common/memorystream.h" | |||
| #include "public.sdk/source/vst/hosting/module.h" | |||
| #include "public.sdk/source/vst/moduleinfo/moduleinfocreator.h" | |||
| #include "public.sdk/source/vst/moduleinfo/moduleinfoparser.h" | |||
| #include "base/source/fcommandline.h" | |||
| #include "pluginterfaces/vst/vsttypes.h" | |||
| #include "pluginterfaces/base/iplugincompatibility.h" | |||
| #include <cstdio> | |||
| #include <fstream> | |||
| #include <iostream> | |||
| @@ -109,6 +111,35 @@ std::optional<ModuleInfo::CompatibilityList> openAndParseCompatJSON (const std:: | |||
| return result; | |||
| } | |||
| //------------------------------------------------------------------------ | |||
| std::optional<ModuleInfo::CompatibilityList> loadCompatibilityFromModule (const VST3::Hosting::Module& module) | |||
| { | |||
| const auto& factory = module.getFactory(); | |||
| const auto& infos = factory.classInfos(); | |||
| const auto iter = std::find_if (infos.begin(), infos.end(), [&] (const auto& info) | |||
| { | |||
| return info.category() == kPluginCompatibilityClass; | |||
| }); | |||
| if (iter == infos.end()) | |||
| return {}; | |||
| const auto compatibility = factory.createInstance<Steinberg::IPluginCompatibility> (iter->ID()); | |||
| if (compatibility == nullptr) | |||
| return {}; | |||
| Steinberg::MemoryStream stream; | |||
| if (compatibility->getCompatibilityJSON (&stream) != kResultOk) | |||
| return {}; | |||
| const std::string_view streamView (stream.getData(), stream.getSize()); | |||
| return ModuleInfoLib::parseCompatibilityJson (streamView, nullptr); | |||
| } | |||
| //------------------------------------------------------------------------ | |||
| int createJSON (const std::optional<ModuleInfo::CompatibilityList>& compat, | |||
| const std::string& modulePath, const std::string& moduleVersion, | |||
| @@ -124,6 +155,9 @@ int createJSON (const std::optional<ModuleInfo::CompatibilityList>& compat, | |||
| auto moduleInfo = ModuleInfoLib::createModuleInfo (*module, false); | |||
| if (compat) | |||
| moduleInfo.compatibility = *compat; | |||
| else if (auto loaded = loadCompatibilityFromModule (*module)) | |||
| moduleInfo.compatibility = *loaded; | |||
| moduleInfo.version = moduleVersion; | |||
| std::stringstream output; | |||