@@ -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)."); | |||
} | |||
@@ -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 | |||
@@ -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 <MSVCBuildConfiguration&> (*config).getPrebuildCommand() = oldStylePrebuildCommand; | |||
dynamic_cast<MSVCBuildConfiguration&> (*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<var> (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 <const MSVCBuildConfiguration&> (*config)); | |||
dynamic_cast<const MSVCBuildConfiguration&> (*config)); | |||
} | |||
static const char* getOptimisationLevelString (int level) | |||
@@ -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)", "<None>", "32-bit (-m32)", "64-bit (-m64)", "ARM v6", "ARM v7" }; | |||
const var archFlags[] = { var(), var (String()), "-m32", "-m64", "-march=armv6", "-march=armv7" }; | |||
@@ -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 }; | |||
@@ -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<var> (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<var> (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, " | |||
@@ -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: | |||