Skip to content

Commit

Permalink
Fix options in project() call.
Browse files Browse the repository at this point in the history
  • Loading branch information
jpakkane committed Jul 28, 2024
1 parent c2e588a commit 484a90b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
2 changes: 1 addition & 1 deletion mesonbuild/dependencies/qt.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ def __init__(self, name: str, env: 'Environment', kwargs: T.Dict[str, T.Any]):
# Use the buildtype by default, but look at the b_vscrt option if the
# compiler supports it.
is_debug = self.env.coredata.optstore.get_value_for('buildtype') == 'debug'
if self.env.coredata.optstore.has_option('b_vscrt'))
if 'b_vscrt' in self.env.coredata.optstore:
if self.env.coredata.optstore.get_value_for('b_vscrt') in {'mdd', 'mtd'}:
is_debug = True
modules_lib_suffix = _get_modules_lib_suffix(self.version, self.env.machines[self.for_machine], is_debug)
Expand Down
1 change: 0 additions & 1 deletion mesonbuild/interpreter/interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -1189,7 +1189,6 @@ def func_project(self, node: mparser.FunctionNode, args: T.Tuple[str, T.List[str
invoker_method_default_options = self.default_project_options
self.coredata.optstore.set_from_subproject_call(self.subproject, invoker_method_default_options, self.project_default_options)


if not self.is_subproject():
self.build.project_name = proj_name
self.active_projectname = proj_name
Expand Down
21 changes: 20 additions & 1 deletion mesonbuild/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -951,13 +951,32 @@ def set_from_top_level_project_call(self, project_default_options, cmd_line_opti
#else:
# self.pending_project_options[key] = valstr
for keystr, valstr in project_default_options.items():
# Ths is complicated by the fact that a string can have two meanings:
#
# default_options: 'foo=bar'
#
# can be either
#
# A) a system option in which case the subproject is None
# B) a project option, in which case the subproject is '' (this method is only called from top level)
#
# The key parsing fucntion can not handle the difference between the two
# an defaults to A
key = OptionKey.from_string(keystr)
if key.subproject is not None:
self.pending_project_options[key] = valstr
elif key in self.options:
self.set_option(key.name, key.subproject, valstr)
else:
self.pending_project_options[key] = valstr
# Setting a project option with default_options.
# Argubly this should be a hard error, the default
# value of project option should be set in the option
# file, not in the project call.
proj_key = key.evolve(subproject='')
if self.is_project_option(proj_key):
self.options[proj_key].set_value(valstr)
else:
self.pending_project_options[key] = valstr
for keystr, valstr in cmd_line_options.items():
key = OptionKey.from_string(keystr)
if key.subproject is None:
Expand Down

0 comments on commit 484a90b

Please sign in to comment.