From 84e87f739145b44d6c8d9048abcd534a10bdf6c3 Mon Sep 17 00:00:00 2001 From: jules Date: Tue, 29 Jan 2013 17:48:33 +0000 Subject: [PATCH] Introjucer: tidied up optimisation level descriptions. --- .../VisualStudio2005/The Introjucer.vcproj | 2 +- .../VisualStudio2008/The Introjucer.vcproj | 2 +- .../VisualStudio2010/The Introjucer.vcxproj | 2 +- .../Introjucer/JuceLibraryCode/BinaryData.cpp | 4 +-- .../Introjucer/JuceLibraryCode/BinaryData.h | 2 +- .../Project Saving/jucer_ProjectExport_MSVC.h | 30 ++++++++++++++----- .../Project Saving/jucer_ProjectExporter.cpp | 14 +++++---- .../Project Saving/jucer_ProjectExporter.h | 8 +++++ 8 files changed, 46 insertions(+), 18 deletions(-) diff --git a/extras/Introjucer/Builds/VisualStudio2005/The Introjucer.vcproj b/extras/Introjucer/Builds/VisualStudio2005/The Introjucer.vcproj index bf752ba968..52b2a6cc3b 100644 --- a/extras/Introjucer/Builds/VisualStudio2005/The Introjucer.vcproj +++ b/extras/Introjucer/Builds/VisualStudio2005/The Introjucer.vcproj @@ -86,7 +86,7 @@ TypeLibraryName="$(IntDir)\Introjucer.tlb" HeaderFileName=""/> - MaxSpeed + Full ..\..\JuceLibraryCode;%(AdditionalIncludeDirectories) WIN32;_WINDOWS;NDEBUG;JUCER_VS2010_78A501D=1;%(PreprocessorDefinitions) MultiThreaded diff --git a/extras/Introjucer/JuceLibraryCode/BinaryData.cpp b/extras/Introjucer/JuceLibraryCode/BinaryData.cpp index 6b766ff21d..b97390148f 100644 --- a/extras/Introjucer/JuceLibraryCode/BinaryData.cpp +++ b/extras/Introjucer/JuceLibraryCode/BinaryData.cpp @@ -19,7 +19,7 @@ static const unsigned char temp_43731c40[] = "copyAU=`nm -g \"$CONFIGURATION_BUILD_DIR/$EXECUTABLE_PATH\" | grep -i 'AudioUnit' | wc -l`\r\n" "copyVST=`nm -g \"$CONFIGURATION_BUILD_DIR/$EXECUTABLE_PATH\" | grep -i 'VSTPlugin' | wc -l`\r\n" "copyRTAS=`nm -g \"$CONFIGURATION_BUILD_DIR/$EXECUTABLE_PATH\" | grep -i 'CProcess' | wc -l`\r\n" -"copyAAX=`nm -g \"$CONFIGURATION_BUILD_DIR/$EXECUTABLE_PATH\" | grep -i 'GetEffectDescriptions' | wc -l`\r\n" +"copyAAX=`nm -g \"$CONFIGURATION_BUILD_DIR/$EXECUTABLE_PATH\" | grep -i 'ACFStartup' | wc -l`\r\n" "\r\n" "if [ $copyAU -gt 0 ]; then\r\n" " echo \"Copying to AudioUnit folder...\"\r\n" @@ -1011,7 +1011,7 @@ const char* getNamedResource (const char* resourceNameUTF8, int& numBytes) throw switch (hash) { - case 0x44be9398: numBytes = 2112; return AudioPluginXCodeScript_txt; + case 0x44be9398: numBytes = 2101; return AudioPluginXCodeScript_txt; case 0x4a0cfd09: numBytes = 151; return background_tile_png; case 0x763d39dc: numBytes = 1050; return colourscheme_dark_xml; case 0xe8b08520: numBytes = 1050; return colourscheme_light_xml; diff --git a/extras/Introjucer/JuceLibraryCode/BinaryData.h b/extras/Introjucer/JuceLibraryCode/BinaryData.h index f3f99f656c..14dd6ce013 100644 --- a/extras/Introjucer/JuceLibraryCode/BinaryData.h +++ b/extras/Introjucer/JuceLibraryCode/BinaryData.h @@ -7,7 +7,7 @@ namespace BinaryData { extern const char* AudioPluginXCodeScript_txt; - const int AudioPluginXCodeScript_txtSize = 2112; + const int AudioPluginXCodeScript_txtSize = 2101; extern const char* background_tile_png; const int background_tile_pngSize = 151; diff --git a/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_MSVC.h b/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_MSVC.h index 7a6877559d..bcc2a8540b 100644 --- a/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_MSVC.h +++ b/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_MSVC.h @@ -745,8 +745,7 @@ protected: { XmlElement* compiler = createToolElement (xml, "VCCLCompilerTool"); - const int optimiseLevel = config.getOptimisationLevelInt(); - compiler->setAttribute ("Optimization", optimiseLevel <= 1 ? "0" : (optimiseLevel == 2 ? "1" : "3")); + compiler->setAttribute ("Optimization", getOptimisationLevelString (config.getOptimisationLevelInt())); if (isDebug) { @@ -883,6 +882,16 @@ protected: dynamic_cast (*config)); } + static const char* getOptimisationLevelString (int level) + { + switch (level) + { + case optimiseMaxSpeed: return "3"; + case optimiseMinSize: return "1"; + default: return "0"; + } + } + //============================================================================== JUCE_DECLARE_NON_COPYABLE (MSVCProjectExporterVC2008) }; @@ -1164,12 +1173,9 @@ protected: { XmlElement* cl = group->createNewChildElement ("ClCompile"); - const int optimiseLevel = config.getOptimisationLevelInt(); - cl->createNewChildElement ("Optimization")->addTextElement (optimiseLevel <= 1 ? "Disabled" - : optimiseLevel == 2 ? "MinSpace" - : "Full"); + cl->createNewChildElement ("Optimization")->addTextElement (getOptimisationLevelString (config.getOptimisationLevelInt())); - if (isDebug && optimiseLevel <= 1) + if (isDebug && config.getOptimisationLevelInt() <= optimisationOff) cl->createNewChildElement ("DebugInformationFormat")->addTextElement (is64Bit (config) ? "ProgramDatabase" : "EditAndContinue"); @@ -1310,6 +1316,16 @@ protected: return String::empty; } + static const char* getOptimisationLevelString (int level) + { + switch (level) + { + case optimiseMaxSpeed: return "Full"; + case optimiseMinSize: return "MinSpace"; + default: return "Disabled"; + } + } + //============================================================================== void addFilesToCompile (const Project::Item& projectItem, XmlElement& cpps, XmlElement& headers, XmlElement& otherFiles) const { diff --git a/extras/Introjucer/Source/Project Saving/jucer_ProjectExporter.cpp b/extras/Introjucer/Source/Project Saving/jucer_ProjectExporter.cpp index f6a25c169c..5509a1e154 100644 --- a/extras/Introjucer/Source/Project Saving/jucer_ProjectExporter.cpp +++ b/extras/Introjucer/Source/Project Saving/jucer_ProjectExporter.cpp @@ -403,7 +403,7 @@ void ProjectExporter::createDefaultConfigs() config->getNameValue() = debugConfig ? "Debug" : "Release"; config->isDebugValue() = debugConfig; - config->getOptimisationLevel() = debugConfig ? 1 : 2; + config->getOptimisationLevel() = debugConfig ? optimisationOff : optimiseMinSize; config->getTargetBinaryName() = project.getProjectFilenameRoot(); } } @@ -508,8 +508,12 @@ ProjectExporter::BuildConfiguration::~BuildConfiguration() String ProjectExporter::BuildConfiguration::getGCCOptimisationFlag() const { - const int level = getOptimisationLevelInt(); - return String (level <= 1 ? "0" : (level == 2 ? "s" : "3")); + switch (getOptimisationLevelInt()) + { + case optimiseMaxSpeed: return "3"; + case optimiseMinSize: return "s"; + default: return "0"; + } } void ProjectExporter::BuildConfiguration::createPropertyEditors (PropertyListBuilder& props) @@ -520,8 +524,8 @@ void ProjectExporter::BuildConfiguration::createPropertyEditors (PropertyListBui props.add (new BooleanPropertyComponent (isDebugValue(), "Debug mode", "Debugging enabled"), "If enabled, this means that the configuration should be built with debug synbols."); - const char* optimisationLevels[] = { "No optimisation", "Optimise for size and speed", "Optimise for maximum speed", 0 }; - const int optimisationLevelValues[] = { 1, 2, 3, 0 }; + const char* optimisationLevels[] = { "No optimisation", "Minimise size", "Maximise speed", 0 }; + const int optimisationLevelValues[] = { optimisationOff, optimiseMinSize, optimiseMaxSpeed, 0 }; props.add (new ChoicePropertyComponent (getOptimisationLevel(), "Optimisation", StringArray (optimisationLevels), Array (optimisationLevelValues)), "The optimisation level for this configuration"); diff --git a/extras/Introjucer/Source/Project Saving/jucer_ProjectExporter.h b/extras/Introjucer/Source/Project Saving/jucer_ProjectExporter.h index 1bbe245d72..3c404cc386 100644 --- a/extras/Introjucer/Source/Project Saving/jucer_ProjectExporter.h +++ b/extras/Introjucer/Source/Project Saving/jucer_ProjectExporter.h @@ -276,6 +276,14 @@ public: ValueTree settings; + //============================================================================== + enum OptimisationLevel + { + optimisationOff = 1, + optimiseMinSize = 2, + optimiseMaxSpeed = 3 + }; + protected: //============================================================================== String name;