1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-09 23:34:20 +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

@ -1834,8 +1834,7 @@ public:
+ writerTarget->getBinaryNameWithSuffix (config);
{
// moduleinfotool doesn't handle Windows-style path separators properly when computing the bundle name
const auto normalisedBundlePath = getOwner().getOutDirFile (config, segments[0]).replace ("\\", "/");
const auto normalisedBundlePath = getOwner().getOutDirFile (config, segments[0]);
const auto contentsDir = normalisedBundlePath + "\\Contents";
const auto resourceDir = contentsDir + "\\Resources";
const auto manifestPath = (resourceDir + "\\moduleinfo.json");
@ -1845,10 +1844,8 @@ public:
const auto manifestInvocationString = StringArray
{
helperExecutablePath.quoted(),
"-create",
"-version", getOwner().project.getVersionString().quoted(),
"-path", normalisedBundlePath.quoted(),
"-output", manifestPath.quoted()
">",
manifestPath.quoted()
}.joinIntoString (" ");
const auto crossCompilationPairs =

View file

@ -424,11 +424,8 @@ public:
{
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/Resources/moduleinfo.json" << newLine
<< "\t$(V_AT) $(JUCE_OUTDIR)/$(JUCE_TARGET_VST3_MANIFEST_HELPER) > "
"$(JUCE_OUTDIR)/$(JUCE_VST3DIR)/Contents/Resources/moduleinfo.json" << newLine
<< "\t-$(V_AT)[ ! \"$(JUCE_VST3DESTDIR)\" ] || (mkdir -p $(JUCE_VST3DESTDIR) && cp -R $(JUCE_COPYCMD_VST3))" << newLine;
}
else if (type == VSTPlugIn)

View file

@ -66,8 +66,13 @@ public:
template <typename... Args>
ScriptBuilder& run (const String& command, Args&&... args)
{
const auto joined = StringArray { command, std::forward<Args> (args)... }.joinIntoString (" ");
return echo ("Running " + joined).insertLine (joined);
const auto runCommand = StringArray { command, std::forward<Args> (args)... }.joinIntoString (" ");
const auto echoCommand = runCommand.replace ("|", "\\|")
.replace ("&", "\\&")
.replace ("<", "\\<")
.replace (">", "\\>");
return echo ("Running " + echoCommand).insertLine (runCommand);
}
ScriptBuilder& echo (const String& text)
@ -1439,9 +1444,7 @@ public:
}
if (type == XcodeTarget::LV2Helper || type == XcodeTarget::VST3Helper)
{
return;
}
if (type != XcodeTarget::SharedCodeTarget) // everything else depends on the sharedCodeTarget
{
@ -2366,7 +2369,7 @@ private:
if (target->type == XcodeTarget::LV2Helper)
addFile (getFileOptions (getLV2HelperProgramSource()));
else if (target->type == XcodeTarget::VST3Helper)
addFile (getFileOptions (getVST3HelperProgramSource()).withCompilerFlags ("-fobjc-arc"));
addFile (getFileOptions (getVST3HelperProgramSource()));
}
auto targetName = String (target->getName());
@ -2546,17 +2549,18 @@ private:
}
}
// When building LV2 and VST3 plugins on Arm macs, we need to load and run the plugin
// bundle during a post-build step in order to generate the plugin's supporting files.
// Arm macs will only load shared libraries if they are signed, but Xcode runs its
// signing step after any post-build scripts. As a workaround, we sign the plugin
// using an adhoc certificate.
if (target->type == XcodeTarget::VST3PlugIn || target->type == XcodeTarget::LV2PlugIn)
{
ScriptBuilder script;
if (target->type == XcodeTarget::LV2PlugIn)
{
// When building LV2 plugins on Arm macs, we need to load and run the plugin bundle
// during a post-build step in order to generate the plugin's supporting files.
// Arm macs will only load shared libraries if they are signed, but Xcode runs its
// signing step after any post-build scripts. As a workaround, we sign the plugin
// using an adhoc certificate.
// Note: LV2 has a non-standard config build dir
script.run ("codesign --verbose=4 --force --sign -", doubleQuoted ("${CONFIGURATION_BUILD_DIR}/${EXECUTABLE_NAME}"))
.insertLine()
@ -2565,13 +2569,8 @@ private:
}
else if (target->type == XcodeTarget::VST3PlugIn)
{
script.run ("codesign --verbose=4 --force --sign -", doubleQuoted ("${CONFIGURATION_BUILD_DIR}/${WRAPPER_NAME}"))
.insertLine()
.run (doubleQuoted ("${CONFIGURATION_BUILD_DIR}/" + Project::getVST3FileWriterName()),
"-create",
"-version", doubleQuoted (project.getVersionString()),
"-path", doubleQuoted ("${CONFIGURATION_BUILD_DIR}/${WRAPPER_NAME}"),
"-output", doubleQuoted ("${CONFIGURATION_BUILD_DIR}/${WRAPPER_NAME}/Contents/Resources/moduleinfo.json"));
script.run (doubleQuoted ("${CONFIGURATION_BUILD_DIR}/" + Project::getVST3FileWriterName()), ">",
doubleQuoted ("${CONFIGURATION_BUILD_DIR}/${WRAPPER_NAME}/Contents/Resources/moduleinfo.json"));
}
target->addShellScriptBuildPhase ("Update manifest", script.toStringWithDefaultShellOptions());