Skip to content

Commit

Permalink
Fix the VS backend a bit.
Browse files Browse the repository at this point in the history
  • Loading branch information
jpakkane committed Aug 20, 2024
1 parent 2a7dd81 commit 9734ea3
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions mesonbuild/backend/vs2010backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -996,9 +996,9 @@ def get_args_defines_and_inc_dirs(self, target, compiler, generated_files_includ
for l, comp in target.compilers.items():
if l in file_args:
file_args[l] += compilers.get_base_compile_args(
target.get_options(), comp, self.environment)
target, comp, self.environment)
file_args[l] += comp.get_option_compile_args(
target.get_options())
target, self.environment, target.subproject)

# Add compile args added using add_project_arguments()
for l, args in self.build.projects_args[target.for_machine].get(target.subproject, {}).items():
Expand All @@ -1012,7 +1012,7 @@ def get_args_defines_and_inc_dirs(self, target, compiler, generated_files_includ
# Compile args added from the env or cross file: CFLAGS/CXXFLAGS, etc. We want these
# to override all the defaults, but not the per-target compile args.
for lang in file_args.keys():
file_args[lang] += self.get_target_option(OptionKey(f'{lang}_args', machine=target.for_machine))
file_args[lang] += self.get_target_option(target, OptionKey(f'{lang}_args', machine=target.for_machine))
for args in file_args.values():
# This is where Visual Studio will insert target_args, target_defines,
# etc, which are added later from external deps (see below).
Expand Down Expand Up @@ -1340,7 +1340,7 @@ def add_non_makefile_vcxproj_elements(
# Exception handling has to be set in the xml in addition to the "AdditionalOptions" because otherwise
# cl will give warning D9025: overriding '/Ehs' with cpp_eh value
if 'cpp' in target.compilers:
eh = self.get_target_option(OptionKey('cpp_eh', machine=target.for_machine))
eh = self.environment.coredata.get_option_for_target(target, OptionKey('cpp_eh', machine=target.for_machine))
if eh == 'a':
ET.SubElement(clconf, 'ExceptionHandling').text = 'Async'
elif eh == 's':
Expand Down Expand Up @@ -1435,7 +1435,7 @@ def add_non_makefile_vcxproj_elements(
# to be after all internal and external libraries so that unresolved
# symbols from those can be found here. This is needed when the
# *_winlibs that we want to link to are static mingw64 libraries.
extra_link_args += compiler.get_option_link_args(target.get_options())
extra_link_args += compiler.get_option_link_args(target, self.environment, target.subproject)
(additional_libpaths, additional_links, extra_link_args) = self.split_link_args(extra_link_args.to_native())

# Add more libraries to be linked if needed
Expand Down
2 changes: 1 addition & 1 deletion mesonbuild/coredata.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ def set_option(self, key: OptionKey, value, first_invocation: bool = False) -> b
except KeyError:
raise MesonException(f'Tried to set unknown builtin option {str(key)}')

changed = self.optstore.set_value(key, value)
changed = self.optstore.set_value(key, value, first_invocation)
dirty |= changed

if key.name == 'buildtype':
Expand Down
2 changes: 1 addition & 1 deletion mesonbuild/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -871,7 +871,7 @@ def set_value(self, key: T.Union[OptionKey, str], new_value: 'T.Any', first_invo
changed = valobj.set_value(new_value)

if valobj.readonly and changed and not first_invocation:
raise MesonException(f'Tried modify read only option {str(key)!r}')
raise MesonException(f'Tried to modify read only option {str(key)!r}')

if key.name == 'prefix' and first_invocation and changed:
self.reset_prefixed_options(old_value, new_value)
Expand Down
2 changes: 1 addition & 1 deletion unittests/platformagnostictests.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def test_change_backend(self):
# Change backend option is not allowed
with self.assertRaises(subprocess.CalledProcessError) as cm:
self.setconf('-Dbackend=none')
self.assertIn("ERROR: Tried modify read only option 'backend'", cm.exception.stdout)
self.assertIn("ERROR: Tried to modify read only option 'backend'", cm.exception.stdout)

# Check that the new value was not written in the store.
self.assertEqual(self.getconf('backend'), 'ninja')
Expand Down

0 comments on commit 9734ea3

Please sign in to comment.