aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/modules
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2018-10-04 20:52:08 -0400
committerJohn Ericson <git@JohnEricson.me>2019-06-09 13:13:25 -0400
commit07777e15d47dbddaf849d24b3a30c85745c533ca (patch)
treef472472ed511498c329b4e13e19b1585e1afb621 /mesonbuild/modules
parent32e827dcdc451e1c5dde952cf08e4b654eac7057 (diff)
downloadmeson-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')
-rw-r--r--mesonbuild/modules/cmake.py2
-rw-r--r--mesonbuild/modules/gnome.py2
-rw-r--r--mesonbuild/modules/pkgconfig.py2
-rw-r--r--mesonbuild/modules/python.py2
-rw-r--r--mesonbuild/modules/windows.py9
5 files changed, 9 insertions, 8 deletions
diff --git a/mesonbuild/modules/cmake.py b/mesonbuild/modules/cmake.py
index 8ce5aef..a36d748 100644
--- a/mesonbuild/modules/cmake.py
+++ b/mesonbuild/modules/cmake.py
@@ -110,7 +110,7 @@ class CmakeModule(ExtensionModule):
self.snippets.add('subproject')
def detect_voidp_size(self, env):
- compilers = env.coredata.compilers
+ compilers = env.coredata.compilers.host
compiler = compilers.get('c', None)
if not compiler:
compiler = compilers.get('cpp', None)
diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py
index a223b78..fd9e063 100644
--- a/mesonbuild/modules/gnome.py
+++ b/mesonbuild/modules/gnome.py
@@ -1048,7 +1048,7 @@ This will become a hard error in the future.''')
if state.environment.is_cross_build():
compiler = state.environment.coredata.cross_compilers.get('c')
else:
- compiler = state.environment.coredata.compilers.get('c')
+ compiler = state.environment.coredata.compilers.host.get('c')
compiler_flags = self._get_langs_compilers_flags(state, [('c', compiler)])
cflags.extend(compiler_flags[0])
diff --git a/mesonbuild/modules/pkgconfig.py b/mesonbuild/modules/pkgconfig.py
index d4d0625..0284f3d 100644
--- a/mesonbuild/modules/pkgconfig.py
+++ b/mesonbuild/modules/pkgconfig.py
@@ -397,7 +397,7 @@ class PkgConfigModule(ExtensionModule):
dversions = kwargs.get('d_module_versions', None)
if dversions:
- compiler = state.environment.coredata.compilers.get('d')
+ compiler = state.environment.coredata.compilers.host.get('d')
if compiler:
deps.add_cflags(compiler.get_feature_args({'versions': dversions}, None))
diff --git a/mesonbuild/modules/python.py b/mesonbuild/modules/python.py
index 04941ea..2f4e5d6 100644
--- a/mesonbuild/modules/python.py
+++ b/mesonbuild/modules/python.py
@@ -211,7 +211,7 @@ class PythonDependency(ExternalDependency):
if pyarch is None:
self.is_found = False
return
- arch = detect_cpu_family(env.coredata.compilers)
+ arch = detect_cpu_family(env.coredata.compilers.host)
if arch == 'x86':
arch = '32'
elif arch == 'x86_64':
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: