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

VST3: Allow manifest helper to run independently

This commit is contained in:
Anthony Nicholls 2025-05-14 10:27:35 +01:00 committed by Anthony Nicholls
parent 80116d60da
commit f3d7c74ea1
46 changed files with 1299 additions and 1519 deletions

View file

@ -32,6 +32,28 @@
==============================================================================
*/
//==============================================================================
// This suppresses a warning caused by some of the Steinberg source code
#ifndef _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING
#define _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING
#endif
#include <array>
#include <atomic>
#include <cassert>
#include <cctype>
#include <cstddef>
#include <cstring>
#include <functional>
#include <iomanip>
#include <ios>
#include <memory>
#include <sstream>
#include <string>
#include <utility>
#include <vector>
//==============================================================================
// This suppresses a warning in juce_TargetPlatform.h
#ifndef JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED
#define JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED 1
@ -40,6 +62,7 @@
#include <juce_core/system/juce_CompilerWarnings.h>
#include <juce_core/system/juce_CompilerSupport.h>
//==============================================================================
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wc++98-compat-extra-semi",
"-Wdeprecated-declarations",
"-Wexpansion-to-defined",
@ -56,36 +79,12 @@ JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wc++98-compat-extra-semi",
JUCE_BEGIN_IGNORE_WARNINGS_MSVC (6387 6031)
// As of at least 3.7.12 there is a bug in fplatform.h that leads to SMTG_CPP20
// having the wrong value when the /Zc:__cplusplus is not enabled. This work
// around prevents needing to provide that flag
#include <juce_audio_processors/format_types/VST3_SDK/pluginterfaces/base/fplatform.h>
#ifdef SMTG_CPP20
#undef SMTG_CPP20
#define SMTG_CPP20 JUCE_CXX20_IS_AVAILABLE
#endif
#ifndef _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING
#define _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING
#endif
#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>
#define NOMINMAX
#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/commonstringconvert.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>
@ -97,3 +96,93 @@ JUCE_BEGIN_IGNORE_WARNINGS_MSVC (6387 6031)
JUCE_END_IGNORE_WARNINGS_MSVC
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
//==============================================================================
#if JucePlugin_Enable_ARA
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wpragma-pack")
#include <ARA_API/ARAVST3.h>
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
#endif // JucePlugin_Enable_ARA
//==============================================================================
#define jassert(x) assert ((x))
#define jassertfalse assert (false)
#define DBG(x)
#define JUCE_DECLARE_NON_COPYABLE(x)
#define JUCE_API
#if __has_include ("JucePluginDefines.h")
#include "JucePluginDefines.h"
#endif
#include <juce_audio_processors/format_types/juce_VST3Utilities.h>
#include <juce_audio_processors/utilities/juce_VST3Interface.h>
#include "juce_VST3ModuleInfo.h"
//==============================================================================
class JucePluginModule : public VST3::Hosting::Module
{
public:
JucePluginModule()
{
using namespace Steinberg;
using namespace VST3::Hosting;
PluginFactory tmp { owned (new juce::JucePluginFactoryBase()) };
factory = std::move (tmp);
}
private:
bool load (const std::string&, std::string&) final { return {}; }
};
std::optional<Steinberg::ModuleInfo::CompatibilityList> loadCompatibilityFromModule (const VST3::Hosting::Module& pluginModule)
{
const auto& factory = pluginModule.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) != Steinberg::kResultOk)
return {};
const std::string_view streamView (stream.getData(), stream.getSize());
return Steinberg::ModuleInfoLib::parseCompatibilityJson (streamView, nullptr);
}
//==============================================================================
int main()
{
const JucePluginModule pluginModule;
auto moduleInfo = Steinberg::ModuleInfoLib::createModuleInfo (pluginModule, false);
if (auto compatibility = loadCompatibilityFromModule (pluginModule))
moduleInfo.compatibility = *compatibility;
std::stringstream output;
Steinberg::ModuleInfoLib::outputJson (moduleInfo, output);
std::cout << output.str() << std::endl;
return 0;
}
//==============================================================================
namespace VST3::Hosting
{
Module::SnapshotList Module::getSnapshots (const std::string&) { return {}; }
Optional<std::string> Module::getModuleInfoPath (const std::string&) { return {}; }
Module::Ptr Module::create (const std::string&, std::string&) { return {}; }
} // namespace VST3::Hosting