Details
-
Suggestion
-
Resolution: Won't Do
-
P3: Somewhat important
-
0.3
-
None
Description
Lets go to share/qbs/modules/cpp/gcc.js and look at the line #47. Currently, it looks as follows:
var opt = ModUtils.moduleProperty(config, "optimization") if (opt === 'fast') args.push('-O2'); if (opt === 'small') args.push('-Os');
However, I'd love to rather see something like this:
var opt = ModUtils.moduleProperty(config, "optimization") if (opt === 'aggressive') args.push('-O3'); args.push('-fomit-frame-pointer'); args.push('-funroll-loops'); args.push('-flto'); if (opt === 'fastest') args.push('-O3'); if (opt === 'fast') args.push('-O2'); if (opt === 'balanced') args.push('-O1'); if (opt === 'small') args.push('-Os'); if (opt === 'debug') args.push('-Og');
I understand that there are no equivalents to some of these flags in other compilers, and therefore you might think that this somehow breaks the cross-compiler interface. However, you could simply map the same flags from Microsoft VC++, for example, to multiple values above. For instance:
var opt = ModUtils.moduleProperty(config, "optimization") if (opt === 'aggressive') args.push('/O2'); // I can't remember exactly now, // but probably something could be added here too... if (opt === 'fastest') args.push('/O2'); if (opt === 'fast') args.push('/O2'); if (opt === 'balanced') args.push('/Od'); if (opt === 'small') args.push('/O1'); if (opt === 'debug') args.push('/Od');
You could also add more properties concerning optimization, for example something like this:
var opt = ModUtils.moduleProperty(config, "platformSpecificOptimization") if (opt === 'native') args.push('-march=native');
Looking forward to your feedback.
Best regards.