|
|
|
@ -20,6 +20,7 @@ from collections import OrderedDict |
|
|
|
|
from .mesonlib import MesonException |
|
|
|
|
from .mesonlib import default_libdir, default_libexecdir, default_prefix |
|
|
|
|
import ast |
|
|
|
|
import argparse |
|
|
|
|
|
|
|
|
|
version = '0.46.0.dev1' |
|
|
|
|
backendlist = ['ninja', 'vs', 'vs2010', 'vs2015', 'vs2017', 'xcode'] |
|
|
|
@ -390,6 +391,29 @@ def get_builtin_option_default(optname, prefix='', noneIfSuppress=False): |
|
|
|
|
else: |
|
|
|
|
raise RuntimeError('Tried to get the default value for an unknown builtin option \'%s\'.' % optname) |
|
|
|
|
|
|
|
|
|
def add_builtin_argument(p, name): |
|
|
|
|
kwargs = {} |
|
|
|
|
k = get_builtin_option_destination(name) |
|
|
|
|
c = get_builtin_option_choices(k) |
|
|
|
|
b = get_builtin_option_action(k) |
|
|
|
|
h = get_builtin_option_description(k) |
|
|
|
|
if not b: |
|
|
|
|
h = h.rstrip('.') + ' (default: %s).' % get_builtin_option_default(k) |
|
|
|
|
else: |
|
|
|
|
kwargs['action'] = b |
|
|
|
|
if c and not b: |
|
|
|
|
kwargs['choices'] = c |
|
|
|
|
default = get_builtin_option_default(k, noneIfSuppress=True) |
|
|
|
|
if default is not None: |
|
|
|
|
kwargs['default'] = default |
|
|
|
|
else: |
|
|
|
|
kwargs['default'] = argparse.SUPPRESS |
|
|
|
|
p.add_argument('--' + name.replace('_', '-'), help=h, **kwargs) |
|
|
|
|
|
|
|
|
|
def register_builtin_arguments(parser): |
|
|
|
|
for n in builtin_options: |
|
|
|
|
add_builtin_argument(parser, n) |
|
|
|
|
|
|
|
|
|
builtin_options = { |
|
|
|
|
'buildtype': [UserComboOption, 'Build type to use.', ['plain', 'debug', 'debugoptimized', 'release', 'minsize'], 'debug'], |
|
|
|
|
'strip': [UserBooleanOption, 'Strip targets on install.', False], |
|
|
|
|