aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2019-09-25 12:40:55 -0400
committerJussi Pakkanen <jpakkane@gmail.com>2019-09-25 22:50:48 +0300
commit2e7f0ce55736bdb0079e4e386a1a8b041f9da9f7 (patch)
treef750c87746e187344a69e36cf7783ffccd694426
parentc4f96e00a6a49613efd25fe75b521ea2dff72f8d (diff)
downloadmeson-2e7f0ce55736bdb0079e4e386a1a8b041f9da9f7.zip
meson-2e7f0ce55736bdb0079e4e386a1a8b041f9da9f7.tar.gz
meson-2e7f0ce55736bdb0079e4e386a1a8b041f9da9f7.tar.bz2
Print user defined options in meson-log.txt
It can be useful to know what options have been passed to the command line, excluding default values. Closes: #5956
-rw-r--r--mesonbuild/coredata.py14
-rw-r--r--mesonbuild/msetup.py1
2 files changed, 15 insertions, 0 deletions
diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py
index 5796377..0a541cc 100644
--- a/mesonbuild/coredata.py
+++ b/mesonbuild/coredata.py
@@ -31,6 +31,7 @@ from typing import (
)
import typing
import enum
+import shlex
if typing.TYPE_CHECKING:
from . import dependencies
@@ -776,6 +777,9 @@ def get_cmd_line_file(build_dir):
def read_cmd_line_file(build_dir, options):
filename = get_cmd_line_file(build_dir)
+ if not os.path.isfile(filename):
+ return
+
config = CmdLineFileParser()
config.read(filename)
@@ -816,6 +820,16 @@ def update_cmd_line_file(build_dir, options):
with open(filename, 'w') as f:
config.write(f)
+def get_cmd_line_options(build_dir, options):
+ copy = argparse.Namespace(**vars(options))
+ read_cmd_line_file(build_dir, copy)
+ cmdline = ['-D{}={}'.format(k, v) for k, v in copy.cmd_line_options.items()]
+ if options.cross_file:
+ cmdline += ['--cross-file {}'.format(f) for f in options.cross_file]
+ if options.native_file:
+ cmdline += ['--native-file {}'.format(f) for f in options.native_file]
+ return ' '.join([shlex.quote(x) for x in cmdline])
+
def major_versions_differ(v1, v2):
return v1.split('.')[0:2] != v2.split('.')[0:2]
diff --git a/mesonbuild/msetup.py b/mesonbuild/msetup.py
index 13df6ea..e06a803 100644
--- a/mesonbuild/msetup.py
+++ b/mesonbuild/msetup.py
@@ -161,6 +161,7 @@ class MesonApp:
def _generate(self, env):
mlog.debug('Build started at', datetime.datetime.now().isoformat())
mlog.debug('Main binary:', sys.executable)
+ mlog.debug('Build Options:', coredata.get_cmd_line_options(self.build_dir, self.options))
mlog.debug('Python system:', platform.system())
mlog.log(mlog.bold('The Meson build system'))
mlog.log('Version:', coredata.version)