aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiklas Claesson <nicke.claesson@gmail.com>2018-06-13 21:51:32 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2018-06-21 00:56:30 +0300
commit9620755ff7db9c2614ea1929fcc95bec22734cd0 (patch)
tree1b9b2bac7b6072ead8062ca756e8dce35b8e4b45
parent7140afc0a86f2aae0689617fca985ef209a7c097 (diff)
downloadmeson-9620755ff7db9c2614ea1929fcc95bec22734cd0.zip
meson-9620755ff7db9c2614ea1929fcc95bec22734cd0.tar.gz
meson-9620755ff7db9c2614ea1929fcc95bec22734cd0.tar.bz2
Print default option values that don't match the current value
-rw-r--r--mesonbuild/interpreter.py18
-rw-r--r--mesonbuild/mesonmain.py5
2 files changed, 21 insertions, 2 deletions
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index 605eecb..d008eb9 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -1855,6 +1855,7 @@ class Interpreter(InterpreterBase):
self.default_project_options = default_project_options.copy()
else:
self.default_project_options = {}
+ self.project_default_options = {}
self.build_func_dict()
# build_def_files needs to be defined before parse_project is called
self.build_def_files = [os.path.join(self.subdir, environment.build_filename)]
@@ -1874,6 +1875,18 @@ class Interpreter(InterpreterBase):
else:
self.builtin['target_machine'] = self.builtin['host_machine']
+ def get_non_matching_default_options(self):
+ env = self.environment
+ for def_opt_name, def_opt_value in self.project_default_options.items():
+ for option_type in [
+ env.coredata.builtins, env.coredata.compiler_options,
+ env.coredata.backend_options, env.coredata.base_options,
+ env.coredata.user_options]:
+ for cur_opt_name, cur_opt_value in option_type.items():
+ if (def_opt_name == cur_opt_name and
+ def_opt_value != cur_opt_value.value):
+ yield (def_opt_name, def_opt_value, cur_opt_value.value)
+
def build_func_dict(self):
self.funcs.update({'add_global_arguments': self.func_add_global_arguments,
'add_project_arguments': self.func_add_project_arguments,
@@ -2377,9 +2390,10 @@ external dependencies (including libraries) must go to "dependencies".''')
# values previously set from command line. That means that changing
# default_options in a project will trigger a reconfigure but won't
# have any effect.
+ self.project_default_options = mesonlib.stringlistify(kwargs.get('default_options', []))
+ self.project_default_options = coredata.create_options_dict(self.project_default_options)
if self.environment.first_invocation:
- default_options = mesonlib.stringlistify(kwargs.get('default_options', []))
- default_options = coredata.create_options_dict(default_options)
+ default_options = self.project_default_options
default_options.update(self.default_project_options)
else:
default_options = {}
diff --git a/mesonbuild/mesonmain.py b/mesonbuild/mesonmain.py
index a4406be..b70fd61 100644
--- a/mesonbuild/mesonmain.py
+++ b/mesonbuild/mesonmain.py
@@ -141,6 +141,11 @@ class MesonApp:
profile.runctx('intr.run()', globals(), locals(), filename=fname)
else:
intr.run()
+ # Print all default option values that don't match the current value
+ for def_opt_name, def_opt_value, cur_opt_value in intr.get_non_matching_default_options():
+ mlog.log('Option', mlog.bold(def_opt_name), 'is:',
+ mlog.bold(str(cur_opt_value)),
+ '[default: {}]'.format(str(def_opt_value)))
try:
dumpfile = os.path.join(env.get_scratch_dir(), 'build.dat')
# We would like to write coredata as late as possible since we use the existence of