From a166f01fcef86d38ffd00e4a19662f87d2a856da Mon Sep 17 00:00:00 2001 From: ed Date: Fri, 20 Oct 2017 12:06:56 +0100 Subject: [PATCH] Projucer: Added an option to the Xcode and VS exporters to enable/disable the post-build plugin binary copy step --- .../ProjectSaving/jucer_ProjectExport_MSVC.h | 85 ++++++++++++------- .../ProjectSaving/jucer_ProjectExport_Xcode.h | 37 +++++--- .../Source/Utility/Helpers/jucer_PresetIDs.h | 1 + .../jucer_DependencyPathPropertyComponent.h | 10 +++ .../jucer_TextWithDefaultPropertyComponent.h | 31 +++++++ 5 files changed, 120 insertions(+), 44 deletions(-) diff --git a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_MSVC.h b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_MSVC.h index d531467f7d..02b82cc100 100644 --- a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_MSVC.h +++ b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_MSVC.h @@ -161,6 +161,7 @@ public: setValueIfVoid (shouldGenerateManifestValue(), true); setValueIfVoid (getArchitectureType(), get64BitArchName()); setValueIfVoid (getDebugInformationFormatValue(), isDebug() ? "ProgramDatabase" : "None"); + setValueIfVoid (getPluginBinaryCopyStepEnabledValue(), false); if (! isDebug()) updateOldLTOSetting(); @@ -168,47 +169,51 @@ public: initialisePluginCachedValues(); } - Value getWarningLevelValue() { return getValue (Ids::winWarningLevel); } - int getWarningLevel() const { return config [Ids::winWarningLevel]; } + Value getWarningLevelValue() { return getValue (Ids::winWarningLevel); } + int getWarningLevel() const { return config [Ids::winWarningLevel]; } - Value getWarningsTreatedAsErrors() { return getValue (Ids::warningsAreErrors); } - bool areWarningsTreatedAsErrors() const { return config [Ids::warningsAreErrors]; } + Value getWarningsTreatedAsErrors() { return getValue (Ids::warningsAreErrors); } + bool areWarningsTreatedAsErrors() const { return config [Ids::warningsAreErrors]; } - Value getPrebuildCommand() { return getValue (Ids::prebuildCommand); } - String getPrebuildCommandString() const { return config [Ids::prebuildCommand]; } - Value getPostbuildCommand() { return getValue (Ids::postbuildCommand); } - String getPostbuildCommandString() const { return config [Ids::postbuildCommand]; } + Value getPrebuildCommand() { return getValue (Ids::prebuildCommand); } + String getPrebuildCommandString() const { return config [Ids::prebuildCommand]; } - Value shouldGenerateDebugSymbolsValue() { return getValue (Ids::alwaysGenerateDebugSymbols); } - bool shouldGenerateDebugSymbols() const { return config [Ids::alwaysGenerateDebugSymbols]; } + Value getPostbuildCommand() { return getValue (Ids::postbuildCommand); } + String getPostbuildCommandString() const { return config [Ids::postbuildCommand]; } - Value shouldGenerateManifestValue() { return getValue (Ids::generateManifest); } - bool shouldGenerateManifest() const { return config [Ids::generateManifest]; } + Value shouldGenerateDebugSymbolsValue() { return getValue (Ids::alwaysGenerateDebugSymbols); } + bool shouldGenerateDebugSymbols() const { return config [Ids::alwaysGenerateDebugSymbols]; } - Value shouldLinkIncrementalValue() { return getValue (Ids::enableIncrementalLinking); } - bool shouldLinkIncremental() const { return config [Ids::enableIncrementalLinking]; } + Value shouldGenerateManifestValue() { return getValue (Ids::generateManifest); } + bool shouldGenerateManifest() const { return config [Ids::generateManifest]; } - Value getUsingRuntimeLibDLL() { return getValue (Ids::useRuntimeLibDLL); } - bool isUsingRuntimeLibDLL() const { return config [Ids::useRuntimeLibDLL]; } + Value shouldLinkIncrementalValue() { return getValue (Ids::enableIncrementalLinking); } + bool shouldLinkIncremental() const { return config [Ids::enableIncrementalLinking]; } - String getIntermediatesPath() const { return config [Ids::intermediatesPath].toString(); } - Value getIntermediatesPathValue() { return getValue (Ids::intermediatesPath); } + Value getUsingRuntimeLibDLL() { return getValue (Ids::useRuntimeLibDLL); } + bool isUsingRuntimeLibDLL() const { return config [Ids::useRuntimeLibDLL]; } - String getCharacterSet() const { return config [Ids::characterSet].toString(); } - Value getCharacterSetValue() { return getValue (Ids::characterSet); } + Value getIntermediatesPathValue() { return getValue (Ids::intermediatesPath); } + String getIntermediatesPath() const { return config [Ids::intermediatesPath].toString(); } - Value getArchitectureType() { return getValue (Ids::winArchitecture); } - bool is64Bit() const { return config [Ids::winArchitecture].toString() == get64BitArchName(); } + Value getCharacterSetValue() { return getValue (Ids::characterSet); } + String getCharacterSet() const { return config [Ids::characterSet].toString(); } - Value getFastMathValue() { return getValue (Ids::fastMath); } - bool isFastMathEnabled() const { return config [Ids::fastMath]; } + Value getArchitectureType() { return getValue (Ids::winArchitecture); } + bool is64Bit() const { return config [Ids::winArchitecture].toString() == get64BitArchName(); } - String get64BitArchName() const { return "x64"; } - String get32BitArchName() const { return "Win32"; } + Value getFastMathValue() { return getValue (Ids::fastMath); } + bool isFastMathEnabled() const { return config [Ids::fastMath]; } + + String get64BitArchName() const { return "x64"; } + String get32BitArchName() const { return "Win32"; } Value getDebugInformationFormatValue() { return getValue (Ids::debugInformationFormat); } String getDebugInformationFormatString() const { return config [Ids::debugInformationFormat]; } + Value getPluginBinaryCopyStepEnabledValue() { return getValue (Ids::enablePluginBinaryCopyStep); } + bool isPluginBinaryCopyStepEnabled() const { return config [Ids::enablePluginBinaryCopyStep]; } + String createMSVCConfigName() const { return getName() + "|" + (config [Ids::winArchitecture] == get64BitArchName() ? "x64" : "Win32"); @@ -331,20 +336,31 @@ public: void addVisualStudioPluginInstallPathProperties (PropertyListBuilder& props) { + auto isBuildingAnyPlugins = (project.shouldBuildVST() || project.shouldBuildVST3() + || project.shouldBuildRTAS() || project.shouldBuildAAX()); + + if (isBuildingAnyPlugins) + props.add (new BooleanPropertyComponent (getPluginBinaryCopyStepEnabledValue(), "Enable Plugin Copy Step", "Enabled"), + "Enable this to copy plugin binaries to a specified folder after building."); + if (project.shouldBuildVST()) - props.add (new TextWithDefaultPropertyComponent (vstBinaryLocation, "VST Binary location", 1024), + props.add (new TextWithDefaultPropertyComponentWithEnablement (vstBinaryLocation, getPluginBinaryCopyStepEnabledValue(), + "VST Binary Location", 1024), "The folder in which the compiled VST binary should be placed."); if (project.shouldBuildVST3()) - props.add (new TextWithDefaultPropertyComponent (vst3BinaryLocation, "VST3 Binary location", 1024), + props.add (new TextWithDefaultPropertyComponentWithEnablement (vst3BinaryLocation, getPluginBinaryCopyStepEnabledValue(), + "VST3 Binary Location", 1024), "The folder in which the compiled VST3 binary should be placed."); if (project.shouldBuildRTAS()) - props.add (new TextWithDefaultPropertyComponent (rtasBinaryLocation, "RTAS Binary location", 1024), + props.add (new TextWithDefaultPropertyComponentWithEnablement (rtasBinaryLocation, getPluginBinaryCopyStepEnabledValue(), + "RTAS Binary Location", 1024), "The folder in which the compiled RTAS binary should be placed."); if (project.shouldBuildAAX()) - props.add (new TextWithDefaultPropertyComponent (aaxBinaryLocation, "AAX Binary location", 1024), + props.add (new TextWithDefaultPropertyComponentWithEnablement (aaxBinaryLocation, getPluginBinaryCopyStepEnabledValue(), + "AAX Binary Location", 1024), "The folder in which the compiled AAX binary should be placed."); } @@ -1073,10 +1089,13 @@ public: auto pkgScript = String ("copy /Y ") + getOutputFilePath (config).quoted() + String (" ") + executable.quoted() + String ("\r\ncall ") + createRebasedPath (bundleScript) + String (" ") + macOSDir.quoted() + String (" ") + createRebasedPath (iconFilePath); - return pkgScript + "\r\n" + String ("xcopy ") + bundleDir.quoted() + " " - + String (config.aaxBinaryLocation.get() + "\\" + outputFilename + "\\").quoted() + " /E /Y"; + if (config.isPluginBinaryCopyStepEnabled()) + return pkgScript + "\r\n" + String ("xcopy ") + bundleDir.quoted() + " " + + String (config.aaxBinaryLocation.get() + "\\" + outputFilename + "\\").quoted() + " /E /Y"; + + return pkgScript; } - else + else if (config.isPluginBinaryCopyStepEnabled()) { auto copyScript = String ("copy /Y \"$(OutDir)$(TargetFileName)\"") + String (" \"$COPYDIR$\\$(TargetFileName)\""); diff --git a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Xcode.h b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Xcode.h index a7f4b2f6b2..a38b74e595 100644 --- a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Xcode.h +++ b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Xcode.h @@ -412,12 +412,14 @@ protected: codeSignIdentity (config, Ids::codeSigningIdentity, nullptr, iOS ? "iPhone Developer" : "Mac Developer"), fastMathEnabled (config, Ids::fastMath, nullptr), stripLocalSymbolsEnabled (config, Ids::stripLocalSymbols, nullptr), + pluginBinaryCopyStepEnabled (config, Ids::enablePluginBinaryCopyStep, nullptr), vstBinaryLocation (config, Ids::vstBinaryLocation, nullptr, "$(HOME)/Library/Audio/Plug-Ins/VST/"), vst3BinaryLocation (config, Ids::vst3BinaryLocation, nullptr, "$(HOME)/Library/Audio/Plug-Ins/VST3/"), auBinaryLocation (config, Ids::auBinaryLocation, nullptr, "$(HOME)/Library/Audio/Plug-Ins/Components/"), rtasBinaryLocation (config, Ids::rtasBinaryLocation, nullptr, "/Library/Application Support/Digidesign/Plug-Ins/"), aaxBinaryLocation (config, Ids::aaxBinaryLocation, nullptr, "/Library/Application Support/Avid/Audio/Plug-Ins/") { + setValueIfVoid (pluginBinaryCopyStepEnabled.getPropertyAsValue(), true); updateOldPluginBinaryLocations(); } @@ -426,7 +428,7 @@ protected: CachedValue osxSDKVersion, osxDeploymentTarget, iosDeploymentTarget, osxArchitecture, customXcodeFlags, plistPreprocessorDefinitions, cppStandardLibrary, codeSignIdentity; - CachedValue fastMathEnabled, stripLocalSymbolsEnabled; + CachedValue fastMathEnabled, stripLocalSymbolsEnabled, pluginBinaryCopyStepEnabled; CachedValue vstBinaryLocation, vst3BinaryLocation, auBinaryLocation, rtasBinaryLocation, aaxBinaryLocation; //========================================================================== @@ -515,24 +517,37 @@ protected: //========================================================================== void addXcodePluginInstallPathProperties (PropertyListBuilder& props) { + auto isBuildingAnyPlugins = (project.shouldBuildVST() || project.shouldBuildVST3() || project.shouldBuildAU() + || project.shouldBuildRTAS() || project.shouldBuildAAX()); + + if (isBuildingAnyPlugins) + props.add (new BooleanPropertyComponent (pluginBinaryCopyStepEnabled.getPropertyAsValue(), + "Enable Plugin Copy Step", "Enabled"), + "Enable this to copy plugin binaries to the specified folder after building."); + if (project.shouldBuildVST()) - props.add (new TextWithDefaultPropertyComponent (vstBinaryLocation, "VST Binary location", 1024), + props.add (new TextWithDefaultPropertyComponentWithEnablement (vstBinaryLocation, pluginBinaryCopyStepEnabled.getPropertyAsValue(), + "VST Binary Location", 1024), "The folder in which the compiled VST binary should be placed."); if (project.shouldBuildVST3()) - props.add (new TextWithDefaultPropertyComponent (vst3BinaryLocation, "VST3 Binary location", 1024), + props.add (new TextWithDefaultPropertyComponentWithEnablement (vst3BinaryLocation, pluginBinaryCopyStepEnabled.getPropertyAsValue(), + "VST3 Binary Location", 1024), "The folder in which the compiled VST3 binary should be placed."); if (project.shouldBuildAU()) - props.add (new TextWithDefaultPropertyComponent (auBinaryLocation, "AU Binary location", 1024), + props.add (new TextWithDefaultPropertyComponentWithEnablement (auBinaryLocation, pluginBinaryCopyStepEnabled.getPropertyAsValue(), + "AU Binary Location", 1024), "The folder in which the compiled AU binary should be placed."); if (project.shouldBuildRTAS()) - props.add (new TextWithDefaultPropertyComponent (rtasBinaryLocation, "RTAS Binary location", 1024), + props.add (new TextWithDefaultPropertyComponentWithEnablement (rtasBinaryLocation, pluginBinaryCopyStepEnabled.getPropertyAsValue(), + "RTAS Binary Location", 1024), "The folder in which the compiled RTAS binary should be placed."); if (project.shouldBuildAAX()) - props.add (new TextWithDefaultPropertyComponent (aaxBinaryLocation, "AAX Binary location", 1024), + props.add (new TextWithDefaultPropertyComponentWithEnablement (aaxBinaryLocation, pluginBinaryCopyStepEnabled.getPropertyAsValue(), + "AAX Binary Location", 1024), "The folder in which the compiled AAX binary should be placed."); } @@ -1154,11 +1169,11 @@ public: { case GUIApp: return "$(HOME)/Applications"; case ConsoleApp: return "/usr/bin"; - case VSTPlugIn: return config.vstBinaryLocation.get(); - case VST3PlugIn: return config.vst3BinaryLocation.get(); - case AudioUnitPlugIn: return config.auBinaryLocation.get(); - case RTASPlugIn: return config.rtasBinaryLocation.get(); - case AAXPlugIn: return config.aaxBinaryLocation.get(); + case VSTPlugIn: return config.pluginBinaryCopyStepEnabled.get() ? config.vstBinaryLocation.get() : String(); + case VST3PlugIn: return config.pluginBinaryCopyStepEnabled.get() ? config.vst3BinaryLocation.get() : String(); + case AudioUnitPlugIn: return config.pluginBinaryCopyStepEnabled.get() ? config.auBinaryLocation.get() : String(); + case RTASPlugIn: return config.pluginBinaryCopyStepEnabled.get() ? config.rtasBinaryLocation.get() : String(); + case AAXPlugIn: return config.pluginBinaryCopyStepEnabled.get() ? config.aaxBinaryLocation.get() : String(); case SharedCodeTarget: return owner.isiOS() ? "@executable_path/Frameworks" : "@executable_path/../Frameworks"; default: return {}; } diff --git a/extras/Projucer/Source/Utility/Helpers/jucer_PresetIDs.h b/extras/Projucer/Source/Utility/Helpers/jucer_PresetIDs.h index d6bc02ac07..f33313640a 100644 --- a/extras/Projucer/Source/Utility/Helpers/jucer_PresetIDs.h +++ b/extras/Projucer/Source/Utility/Helpers/jucer_PresetIDs.h @@ -108,6 +108,7 @@ namespace Ids DECLARE_ID (auBinaryLocation); DECLARE_ID (rtasBinaryLocation); DECLARE_ID (aaxBinaryLocation); + DECLARE_ID (enablePluginBinaryCopyStep); DECLARE_ID (stripLocalSymbols); DECLARE_ID (osxSDK); DECLARE_ID (osxCompatibility); diff --git a/extras/Projucer/Source/Utility/UI/PropertyComponents/jucer_DependencyPathPropertyComponent.h b/extras/Projucer/Source/Utility/UI/PropertyComponents/jucer_DependencyPathPropertyComponent.h index 9f6943aba9..e713ffd3a6 100644 --- a/extras/Projucer/Source/Utility/UI/PropertyComponents/jucer_DependencyPathPropertyComponent.h +++ b/extras/Projucer/Source/Utility/UI/PropertyComponents/jucer_DependencyPathPropertyComponent.h @@ -260,6 +260,11 @@ public: setEnabled (value.getValue()); } + ~TextPropertyComponentWithEnablement() + { + value.removeListener (this); + } + private: Value value; @@ -287,6 +292,11 @@ public: setEnabled (value.getValue()); } + ~ChoicePropertyComponentWithEnablement() + { + value.removeListener (this); + } + private: Value value; diff --git a/extras/Projucer/Source/Utility/UI/PropertyComponents/jucer_TextWithDefaultPropertyComponent.h b/extras/Projucer/Source/Utility/UI/PropertyComponents/jucer_TextWithDefaultPropertyComponent.h index a606f7940d..380cbcb57d 100644 --- a/extras/Projucer/Source/Utility/UI/PropertyComponents/jucer_TextWithDefaultPropertyComponent.h +++ b/extras/Projucer/Source/Utility/UI/PropertyComponents/jucer_TextWithDefaultPropertyComponent.h @@ -169,3 +169,34 @@ private: JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (TextWithDefaultPropertyComponent) }; + + +//============================================================================== +class TextWithDefaultPropertyComponentWithEnablement : public TextWithDefaultPropertyComponent, + private Value::Listener +{ +public: + TextWithDefaultPropertyComponentWithEnablement (CachedValue& valueToControl, + const Value& valueToListenTo, + const String& propertyName, + int maxNumChars) + : TextWithDefaultPropertyComponent (valueToControl, propertyName, maxNumChars), + value (valueToListenTo) + { + value.addListener (this); + setEnabled (value.getValue()); + } + + ~TextWithDefaultPropertyComponentWithEnablement() + { + value.removeListener (this); + } + +private: + Value value; + + void valueChanged (Value& v) override + { + setEnabled (v.getValue()); + } +};