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/cmake | |
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/cmake')
-rw-r--r-- | mesonbuild/cmake/client.py | 5 | ||||
-rw-r--r-- | mesonbuild/cmake/interpreter.py | 6 |
2 files changed, 7 insertions, 4 deletions
diff --git a/mesonbuild/cmake/client.py b/mesonbuild/cmake/client.py index f4b549b..93985e9 100644 --- a/mesonbuild/cmake/client.py +++ b/mesonbuild/cmake/client.py @@ -18,6 +18,7 @@ from .common import CMakeException from ..environment import Environment from ..dependencies.base import CMakeDependency, ExternalProgram +from ..mesonlib import MachineChoice from .. import mlog from contextlib import contextmanager from subprocess import Popen, PIPE, TimeoutExpired @@ -473,8 +474,8 @@ class CMakeClient: def startup(self) -> None: if self.proc is not None: raise CMakeException('The CMake server was already started') - - cmake_exe, cmake_vers, _ = CMakeDependency.find_cmake_binary(self.env) + for_machine = MachineChoice.HOST # TODO make parameter + cmake_exe, cmake_vers, _ = CMakeDependency.find_cmake_binary(self.env, for_machine) if cmake_exe is None or cmake_exe is False: raise CMakeException('Unable to find CMake') assert(isinstance(cmake_exe, ExternalProgram)) diff --git a/mesonbuild/cmake/interpreter.py b/mesonbuild/cmake/interpreter.py index ec17906..435f8d2 100644 --- a/mesonbuild/cmake/interpreter.py +++ b/mesonbuild/cmake/interpreter.py @@ -20,6 +20,7 @@ from .client import CMakeClient, RequestCMakeInputs, RequestConfigure, RequestCo from .. import mlog from ..build import Build from ..environment import Environment +from ..mesonlib import MachineChoice from ..mparser import Token, BaseNode, CodeBlockNode, FunctionNode, ArrayNode, ArgumentNode, AssignmentNode, BooleanNode, StringNode, IdNode, MethodNode from ..backend.backends import Backend from ..compilers.compilers import lang_suffixes, header_suffixes, obj_suffixes @@ -300,8 +301,9 @@ class CMakeInterpreter: self.generated_targets = {} def configure(self, extra_cmake_options: List[str]) -> None: + for_machine = MachineChoice.HOST # TODO make parameter # Find CMake - cmake_exe, cmake_vers, _ = CMakeDependency.find_cmake_binary(self.env) + cmake_exe, cmake_vers, _ = CMakeDependency.find_cmake_binary(self.env, for_machine) if cmake_exe is None or cmake_exe is False: raise CMakeException('Unable to find CMake') assert(isinstance(cmake_exe, ExternalProgram)) @@ -312,7 +314,7 @@ class CMakeInterpreter: cmake_args = cmake_exe.get_command() # Map meson compiler to CMake variables - for lang, comp in self.env.coredata.compilers.items(): + for lang, comp in self.env.coredata.compilers[for_machine].items(): if lang not in language_map: continue cmake_lang = language_map[lang] |