aboutsummaryrefslogtreecommitdiffstats
path: root/configure.py
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2016-11-03 11:52:32 -0400
committerJack Lloyd <[email protected]>2016-11-03 11:52:32 -0400
commitb1021ca76bb3c47b1b520421ccece38d772e5907 (patch)
tree7991dd83c4ab3d443b2d34c6a8d3bdaaf08e352c /configure.py
parent277b4f703ba6354a37b5d12adebfc4f726cc72af (diff)
Add new configure argument --optimize-for-size
Uses -Os for GCC/Clang/ICC, /O1 for MSVC. Might be used in the future to control compile time features also (eg using a large precomputed table, vs not). Does not have any influence on module selection, just informs the build that a smaller binary is preferable. [ci skip]
Diffstat (limited to 'configure.py')
-rwxr-xr-xconfigure.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/configure.py b/configure.py
index 57f24c8f3..9122b38f0 100755
--- a/configure.py
+++ b/configure.py
@@ -287,6 +287,10 @@ def process_command_line(args):
action='store_false',
help='disable building shared library')
+ build_group.add_option('--optimize-for-size', dest='optimize_for_size',
+ action='store_true', default=False,
+ help='optimize for code size')
+
build_group.add_option('--no-optimizations', dest='no_optimizations',
action='store_true', default=False,
help='disable all optimizations (for debugging)')
@@ -853,6 +857,7 @@ class CompilerInfo(object):
'compile_flags': '',
'debug_info_flags': '',
'optimization_flags': '',
+ 'size_optimization_flags': '',
'coverage_flags': '',
'sanitizer_flags': '',
'shared_flags': '',
@@ -963,7 +968,14 @@ class CompilerInfo(object):
yield self.debug_info_flags
if not options.no_optimizations:
- yield self.optimization_flags
+ if options.optimize_for_size:
+ if self.size_optimization_flags != '':
+ yield self.size_optimization_flags
+ else:
+ logging.warning("No size optimization flags set for current compiler")
+ yield self.optimization_flags
+ else:
+ yield self.optimization_flags
def submodel_fixup(flags, tup):
return tup[0].replace('SUBMODEL', flags.replace(tup[1], ''))