diff --git a/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_Android.h b/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_Android.h index e6f3d4f68b..98a5ac3fc3 100644 --- a/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_Android.h +++ b/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_Android.h @@ -233,8 +233,12 @@ protected: Value getArchitecturesValue() { return getValue (Ids::androidArchitectures); } String getArchitectures() const { return config [Ids::androidArchitectures]; } - void createConfigProperties (PropertyListBuilder& props) + var getDefaultOptimisationLevel() const override { return var ((int) (isDebug() ? gccO0 : gccO3)); } + + void createConfigProperties (PropertyListBuilder& props) override { + addGCCOptimisationProperty (props); + props.add (new TextPropertyComponent (getArchitecturesValue(), "Architectures", 256, false), "A list of the ARM architectures to build (for a fat binary)."); } diff --git a/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_CodeBlocks.h b/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_CodeBlocks.h index 246cece579..27870c7a14 100644 --- a/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_CodeBlocks.h +++ b/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_CodeBlocks.h @@ -80,9 +80,12 @@ private: { } - void createConfigProperties (PropertyListBuilder&) + void createConfigProperties (PropertyListBuilder& props) override { + addGCCOptimisationProperty (props); } + + var getDefaultOptimisationLevel() const override { return var ((int) (isDebug() ? gccO0 : gccO3)); } }; BuildConfiguration::Ptr createBuildConfig (const ValueTree& tree) const override diff --git a/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_MSVC.h b/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_MSVC.h index 317b10f411..813e1630b1 100644 --- a/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_MSVC.h +++ b/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_MSVC.h @@ -63,6 +63,13 @@ public: { } + enum OptimisationLevel + { + optimisationOff = 1, + optimiseMinSize = 2, + optimiseMaxSpeed = 3 + }; + protected: String projectGUID; mutable File rcFile, iconFile; @@ -91,7 +98,7 @@ protected: if (oldStylePrebuildCommand.isNotEmpty()) for (ConfigIterator config (*this); config.next();) - dynamic_cast (*config).getPrebuildCommand() = oldStylePrebuildCommand; + dynamic_cast (*config).getPrebuildCommand() = oldStylePrebuildCommand; } { @@ -167,8 +174,18 @@ protected: return target; } + var getDefaultOptimisationLevel() const override { return var ((int) (isDebug() ? optimisationOff : optimiseMaxSpeed)); } + void createConfigProperties (PropertyListBuilder& props) override { + static 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"); + props.add (new TextPropertyComponent (getIntermediatesPathValue(), "Intermediates path", 2048, false), "An optional path to a folder to use for the intermediate build files. Note that Visual Studio allows " "you to use macros in this path, e.g. \"$(TEMP)\\MyAppBuildFiles\\$(Configuration)\", which is a handy way to " @@ -888,7 +905,7 @@ protected: { for (ConstConfigIterator config (*this); config.next();) createConfig (*xml.createNewChildElement ("Configuration"), - dynamic_cast (*config)); + dynamic_cast (*config)); } static const char* getOptimisationLevelString (int level) diff --git a/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_Make.h b/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_Make.h index 75bb43c5c4..80dbbbbd96 100644 --- a/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_Make.h +++ b/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_Make.h @@ -85,8 +85,12 @@ protected: Value getArchitectureType() { return getValue (Ids::linuxArchitecture); } var getArchitectureTypeVar() const { return config [Ids::linuxArchitecture]; } + var getDefaultOptimisationLevel() const override { return var ((int) (isDebug() ? gccO0 : gccO3)); } + void createConfigProperties (PropertyListBuilder& props) override { + addGCCOptimisationProperty (props); + static const char* const archNames[] = { "(Default)", "", "32-bit (-m32)", "64-bit (-m64)", "ARM v6", "ARM v7" }; const var archFlags[] = { var(), var (String()), "-m32", "-m64", "-march=armv6", "-march=armv7" }; diff --git a/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_XCode.h b/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_XCode.h index bc4d8f4dcf..c19cc71b47 100644 --- a/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_XCode.h +++ b/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_XCode.h @@ -204,8 +204,12 @@ protected: Value getLinkTimeOptimisationValue() { return getValue (Ids::linkTimeOptimisation); } bool isLinkTimeOptimisationEnabled() const { return config [Ids::linkTimeOptimisation]; } + var getDefaultOptimisationLevel() const override { return var ((int) (isDebug() ? gccO0 : gccO3)); } + void createConfigProperties (PropertyListBuilder& props) { + addGCCOptimisationProperty (props); + if (iOS) { const char* iosVersions[] = { "Use Default", "3.2", "4.0", "4.1", "4.2", "4.3", "5.0", "5.1", "6.0", "6.1", "7.0", "7.1", 0 }; diff --git a/extras/Introjucer/Source/Project Saving/jucer_ProjectExporter.cpp b/extras/Introjucer/Source/Project Saving/jucer_ProjectExporter.cpp index 63c10cf0c8..deb18dee09 100644 --- a/extras/Introjucer/Source/Project Saving/jucer_ProjectExporter.cpp +++ b/extras/Introjucer/Source/Project Saving/jucer_ProjectExporter.cpp @@ -525,7 +525,7 @@ void ProjectExporter::createDefaultConfigs() config->getNameValue() = debugConfig ? "Debug" : "Release"; config->isDebugValue() = debugConfig; - config->getOptimisationLevel() = debugConfig ? optimisationOff : optimiseMinSize; + config->getOptimisationLevel() = config->getDefaultOptimisationLevel(); config->getTargetBinaryName() = project.getProjectFilenameRoot(); } } @@ -641,10 +641,40 @@ String ProjectExporter::BuildConfiguration::getGCCOptimisationFlag() const { switch (getOptimisationLevelInt()) { - case optimiseMaxSpeed: return "3"; - case optimiseMinSize: return "s"; - default: return "0"; + case gccO0: return "0"; + case gccO1: return "1"; + case gccO2: return "2"; + case gccO3: return "3"; + case gccOs: return "s"; + case gccOfast: return "fast"; + default: break; } + + return "0"; +} + +void ProjectExporter::BuildConfiguration::addGCCOptimisationProperty (PropertyListBuilder& props) +{ + static const char* optimisationLevels[] = { "-O0 (no optimisation)", + "-Os (minimise code size)", + "-O1 (fast)", + "-O2 (faster)", + "-O3 (fastest with safe optimisations)", + "-Ofast (uses aggressive optimisations)", + nullptr }; + + static const int optimisationLevelValues[] = { gccO0, + gccOs, + gccO1, + gccO2, + gccO3, + gccOfast, + 0 }; + + props.add (new ChoicePropertyComponent (getOptimisationLevel(), "Optimisation", + StringArray (optimisationLevels), + Array (optimisationLevelValues)), + "The optimisation level for this configuration"); } void ProjectExporter::BuildConfiguration::createPropertyEditors (PropertyListBuilder& props) @@ -655,11 +685,7 @@ 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."); - static 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"); +// addGCCOptimisationProperty (props); props.add (new TextPropertyComponent (getTargetBinaryName(), "Binary name", 256, false), "The filename to use for the destination binary executable file. If you don't add a suffix to this name, " diff --git a/extras/Introjucer/Source/Project Saving/jucer_ProjectExporter.h b/extras/Introjucer/Source/Project Saving/jucer_ProjectExporter.h index 6ddc35d008..54861b5271 100644 --- a/extras/Introjucer/Source/Project Saving/jucer_ProjectExporter.h +++ b/extras/Introjucer/Source/Project Saving/jucer_ProjectExporter.h @@ -195,6 +195,7 @@ public: //============================================================================== virtual void createConfigProperties (PropertyListBuilder&) = 0; + virtual var getDefaultOptimisationLevel() const = 0; //============================================================================== Value getNameValue() { return getValue (Ids::name); } @@ -233,6 +234,7 @@ public: UndoManager* getUndoManager() const { return project.getUndoManagerFor (config); } void createPropertyEditors (PropertyListBuilder&); + void addGCCOptimisationProperty (PropertyListBuilder&); void removeFromExporter(); //============================================================================== @@ -306,12 +308,14 @@ public: ValueTree settings; - //============================================================================== - enum OptimisationLevel + enum GCCOptimisationLevel { - optimisationOff = 1, - optimiseMinSize = 2, - optimiseMaxSpeed = 3 + gccO0 = 1, + gccO1 = 4, + gccO2 = 5, + gccO3 = 3, + gccOs = 2, + gccOfast = 6 }; protected: