Added minsize build type that optimizes for binary size.

pull/613/merge
Jussi Pakkanen 9 years ago
parent 436eab9b85
commit b6e8809f25
  1. 31
      mesonbuild/compilers.py
  2. 2
      mesonbuild/coredata.py
  3. 3
      mesonbuild/mintro.py

@ -59,12 +59,15 @@ gnulike_buildtype_args = {'plain' : [],
# See https://github.com/mesonbuild/meson/pull/509
'debug' : ['-O0', '-g'],
'debugoptimized' : ['-O2', '-g'],
'release' : ['-O3']}
'release' : ['-O3'],
'minsize' : ['-Os', '-g']}
msvc_buildtype_args = {'plain' : [],
'debug' : ["/MDd", "/ZI", "/Ob0", "/Od", "/RTC1"],
'debugoptimized' : ["/MD", "/Zi", "/O2", "/Ob1"],
'release' : ["/MD", "/O2", "/Ob2"]}
'release' : ["/MD", "/O2", "/Ob2"],
'minsize' : ["/MD", "/Zi", "/Os", "/Ob1"],
}
gnulike_buildtype_linker_args = {}
@ -74,38 +77,50 @@ if mesonlib.is_osx():
'debug' : [],
'debugoptimized' : [],
'release' : [],
'minsize' : [],
})
else:
gnulike_buildtype_linker_args.update({'plain' : [],
'debug' : [],
'debugoptimized' : [],
'release' : ['-Wl,-O1'],
'minsize' : [],
})
msvc_buildtype_linker_args = {'plain' : [],
'debug' : [],
'debugoptimized' : [],
'release' : []}
'release' : [],
'minsize' : [],
}
java_buildtype_args = {'plain' : [],
'debug' : ['-g'],
'debugoptimized' : ['-g'],
'release' : []}
'release' : [],
'minsize' : [],
}
rust_buildtype_args = {'plain' : [],
'debug' : ['-g'],
'debugoptimized' : ['-g', '--opt-level', '2'],
'release' : ['--opt-level', '3']}
'release' : ['--opt-level', '3'],
'minsize' : [],
}
mono_buildtype_args = {'plain' : [],
'debug' : ['-debug'],
'debugoptimized': ['-debug', '-optimize+'],
'release' : ['-optimize+']}
'release' : ['-optimize+'],
'minsize' : [],
}
swift_buildtype_args = {'plain' : [],
'debug' : ['-g'],
'debugoptimized': ['-g', '-O'],
'release' : ['-O']}
'release' : ['-O'],
'minsize' : [],
}
gnu_winlibs = ['-lkernel32', '-luser32', '-lgdi32', '-lwinspool', '-lshell32',
'-lole32', '-loleaut32', '-luuid', '-lcomdlg32', '-ladvapi32']
@ -1228,7 +1243,7 @@ class ValaCompiler(Compiler):
return suffix in ('vala', 'vapi')
def get_buildtype_args(self, buildtype):
if buildtype == 'debug' or buildtype == 'debugoptimized':
if buildtype == 'debug' or buildtype == 'debugoptimized' or buildtype == 'minsize':
return ['--debug']
return []

@ -198,7 +198,7 @@ def get_builtin_option_default(optname):
raise RuntimeError('Tried to get the default value for an unknown builtin option \'%s\'.' % optname)
builtin_options = {
'buildtype' : [ UserComboOption, 'Build type to use.', [ 'plain', 'debug', 'debugoptimized', 'release' ], 'debug' ],
'buildtype' : [ UserComboOption, 'Build type to use.', [ 'plain', 'debug', 'debugoptimized', 'release', 'minsize' ], 'debug' ],
'strip' : [ UserBooleanOption, 'Strip targets on install.', False ],
'unity' : [ UserBooleanOption, 'Unity build.', False ],
'prefix' : [ UserStringOption, 'Installation prefix.', default_prefix() ],

@ -79,7 +79,6 @@ def list_target_files(target_name, coredata, builddata):
try:
t = builddata.targets[target_name]
sources = t.sources + t.extra_files
subdir = t.subdir
except KeyError:
print("Unknown target %s." % target_name)
sys.exit(1)
@ -87,7 +86,7 @@ def list_target_files(target_name, coredata, builddata):
print(json.dumps(sources))
def list_buildoptions(coredata, builddata):
buildtype= {'choices': ['plain', 'debug', 'debugoptimized', 'release'],
buildtype= {'choices': ['plain', 'debug', 'debugoptimized', 'release', 'minsize'],
'type' : 'combo',
'value' : coredata.get_builtin_option('buildtype'),
'description' : 'Build type',

Loading…
Cancel
Save