Skip to content

Commit

Permalink
ide; added fast math option to ProjectSettings dialog and equal to op…
Browse files Browse the repository at this point in the history
…timize functionality in makefile generation. (#677)
  • Loading branch information
redj committed Oct 24, 2012
1 parent 41ceae8 commit cca0a0e
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
8 changes: 7 additions & 1 deletion ide/src/ProjectSettings.ec
Original file line number Diff line number Diff line change
Expand Up @@ -1936,10 +1936,16 @@ class CompilerTab : Tab
};
BoolOptionBox strictNameSpaces
{
rightPane, this, position = { 172, 112 },
rightPane, this, position = { 172, 112 },
text = $"Strict Name Spaces", option = OPTION(strictNameSpaces);
};

BoolOptionBox fastMath
{
rightPane, this, position = { 316, 112 },
text = $"Fast Math", option = OPTION(fastMath);
};

BoolOptionBox memoryGuard
{
rightPane, this, position = { 8, 154 };
Expand Down
2 changes: 2 additions & 0 deletions ide/src/dialogs/NewProjectDialog.ec
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ class NewProjectDialog : Window
options =
{
optimization = speed;
fastMath = true;
debug = false;
};
makingModified = true;
Expand Down Expand Up @@ -403,6 +404,7 @@ class QuickProjectDialog : Window
options =
{
optimization = speed;
fastMath = true;
debug = false;
};
makingModified = true;
Expand Down
12 changes: 11 additions & 1 deletion ide/src/project/Project.ec
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,9 @@ define localProfile = config && config.options && config.options.profile ?
define localOptimization = config && config.options && config.options.optimization ?
config.options.optimization : options && options.optimization ?
options.optimization : OptimizationStrategy::none;
define localFastMath = config && config.options && config.options.fastMath ?
config.options.fastMath : options && options.fastMath ?
options.fastMath : SetBool::unset;
define localDefaultNameSpace = config && config.options && config.options.defaultNameSpace ?
config.options.defaultNameSpace : options && options.defaultNameSpace ?
options.defaultNameSpace : null;
Expand Down Expand Up @@ -987,6 +990,12 @@ private:
return optimization;
}

bool GetFastMath(ProjectConfig config)
{
SetBool fastMath = localFastMath;
return fastMath == true;
}

String GetDefaultNameSpace(ProjectConfig config)
{
String defaultNameSpace = localDefaultNameSpace;
Expand Down Expand Up @@ -2224,12 +2233,13 @@ private:
{
case speed:
f.Printf(" -O2");
f.Printf(" -ffast-math");
break;
case size:
f.Printf(" -Os");
break;
}
if(GetFastMath(config))
f.Printf(" -ffast-math");
if(GetDebug(config))
f.Printf(" -g");
f.Printf("\n");
Expand Down
2 changes: 2 additions & 0 deletions ide/src/project/ProjectConfig.ec
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ public:

SetBool excludeFromBuild;
BuildBitDepth buildBitDepth;
SetBool fastMath;

property Array<String> prebuildCommands
{
Expand Down Expand Up @@ -339,6 +340,7 @@ public:
console = console,
compress = compress,
excludeFromBuild = excludeFromBuild,
fastMath = fastMath,
preprocessorDefinitions = CopyArrayString(preprocessorDefinitions),
includeDirs = CopyArrayString(includeDirs),
libraries = CopyArrayString(libraries),
Expand Down

0 comments on commit cca0a0e

Please sign in to comment.