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
This commit is contained in:
parent
c4f96e00a6
commit
2e7f0ce557
|
@ -31,6 +31,7 @@ from typing import (
|
||||||
)
|
)
|
||||||
import typing
|
import typing
|
||||||
import enum
|
import enum
|
||||||
|
import shlex
|
||||||
|
|
||||||
if typing.TYPE_CHECKING:
|
if typing.TYPE_CHECKING:
|
||||||
from . import dependencies
|
from . import dependencies
|
||||||
|
@ -776,6 +777,9 @@ def get_cmd_line_file(build_dir):
|
||||||
|
|
||||||
def read_cmd_line_file(build_dir, options):
|
def read_cmd_line_file(build_dir, options):
|
||||||
filename = get_cmd_line_file(build_dir)
|
filename = get_cmd_line_file(build_dir)
|
||||||
|
if not os.path.isfile(filename):
|
||||||
|
return
|
||||||
|
|
||||||
config = CmdLineFileParser()
|
config = CmdLineFileParser()
|
||||||
config.read(filename)
|
config.read(filename)
|
||||||
|
|
||||||
|
@ -816,6 +820,16 @@ def update_cmd_line_file(build_dir, options):
|
||||||
with open(filename, 'w') as f:
|
with open(filename, 'w') as f:
|
||||||
config.write(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):
|
def major_versions_differ(v1, v2):
|
||||||
return v1.split('.')[0:2] != v2.split('.')[0:2]
|
return v1.split('.')[0:2] != v2.split('.')[0:2]
|
||||||
|
|
||||||
|
|
|
@ -161,6 +161,7 @@ class MesonApp:
|
||||||
def _generate(self, env):
|
def _generate(self, env):
|
||||||
mlog.debug('Build started at', datetime.datetime.now().isoformat())
|
mlog.debug('Build started at', datetime.datetime.now().isoformat())
|
||||||
mlog.debug('Main binary:', sys.executable)
|
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.debug('Python system:', platform.system())
|
||||||
mlog.log(mlog.bold('The Meson build system'))
|
mlog.log(mlog.bold('The Meson build system'))
|
||||||
mlog.log('Version:', coredata.version)
|
mlog.log('Version:', coredata.version)
|
||||||
|
|
Loading…
Reference in New Issue