diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2018-10-04 20:52:08 -0400 |
---|---|---|
committer | John Ericson <git@JohnEricson.me> | 2019-06-09 13:13:25 -0400 |
commit | 07777e15d47dbddaf849d24b3a30c85745c533ca (patch) | |
tree | f472472ed511498c329b4e13e19b1585e1afb621 /mesonbuild/modules/windows.py | |
parent | 32e827dcdc451e1c5dde952cf08e4b654eac7057 (diff) | |
download | meson-07777e15d47dbddaf849d24b3a30c85745c533ca.zip meson-07777e15d47dbddaf849d24b3a30c85745c533ca.tar.gz meson-07777e15d47dbddaf849d24b3a30c85745c533ca.tar.bz2 |
Purge `is_cross` and friends without changing user interfaces
In most cases instead pass `for_machine`, the name of the relevant
machines (what compilers target, what targets run on, etc). This allows
us to use the cross code path in the native case, deduplicating the
code.
As one can see, environment got bigger as more information is kept
structured there, while ninjabackend got a smaller. Overall a few amount
of lines were added, but the hope is what's added is a lot simpler than
what's removed.
Diffstat (limited to 'mesonbuild/modules/windows.py')
-rw-r--r-- | mesonbuild/modules/windows.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/mesonbuild/modules/windows.py b/mesonbuild/modules/windows.py index 3b4eb15..efc3218 100644 --- a/mesonbuild/modules/windows.py +++ b/mesonbuild/modules/windows.py @@ -18,7 +18,7 @@ import re from .. import mlog from .. import mesonlib, build -from ..mesonlib import MesonException, extract_as_list +from ..mesonlib import MachineChoice, MesonException, extract_as_list from . import get_include_args from . import ModuleReturnValue from . import ExtensionModule @@ -41,16 +41,17 @@ class WindowsModule(ExtensionModule): def _find_resource_compiler(self, state): # FIXME: Does not handle `native: true` executables, see # See https://github.com/mesonbuild/meson/issues/1531 - # But given a machine, we can un-hardcode `binaries.host` below. + # Take a parameter instead of the hardcoded definition below + for_machine = MachineChoice.HOST if hasattr(self, '_rescomp'): return self._rescomp # Will try cross / native file and then env var - rescomp = ExternalProgram.from_bin_list(state.environment.binaries.host, 'windres') + rescomp = ExternalProgram.from_bin_list(state.environment.binaries[for_machine], 'windres') if not rescomp or not rescomp.found(): - comp = self.detect_compiler(state.environment.coredata.compilers) + comp = self.detect_compiler(state.environment.coredata.compilers[for_machine]) if comp.id in {'msvc', 'clang-cl', 'intel-cl'}: rescomp = ExternalProgram('rc', silent=True) else: |