aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/backend/backends.py
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2018-07-08 20:57:09 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2018-07-09 04:09:46 +0530
commit416a00308f5b0f228af3c93eb597eca8529fdbb0 (patch)
tree39e2576abdb4b6e79fa96d488e4413dc3af652dd /mesonbuild/backend/backends.py
parent2093d45a4e1203d868d200628918472877c7ec31 (diff)
downloadmeson-416a00308f5b0f228af3c93eb597eca8529fdbb0.zip
meson-416a00308f5b0f228af3c93eb597eca8529fdbb0.tar.gz
meson-416a00308f5b0f228af3c93eb597eca8529fdbb0.tar.bz2
cross: Use ExternalProgram for cross-file exe_wrapper
We already have code to fetch and find binaries specified in a cross file, so use the same code for exe_wrapper. This allows us to handle the same corner-cases that were fixed for other cross binaries.
Diffstat (limited to 'mesonbuild/backend/backends.py')
-rw-r--r--mesonbuild/backend/backends.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py
index 354d25a..b13aa10 100644
--- a/mesonbuild/backend/backends.py
+++ b/mesonbuild/backend/backends.py
@@ -72,6 +72,8 @@ class ExecutableSerialisation:
self.cmd_args = cmd_args
self.env = env
self.is_cross = is_cross
+ if exe_wrapper is not None:
+ assert(isinstance(exe_wrapper, dependencies.ExternalProgram))
self.exe_runner = exe_wrapper
self.workdir = workdir
self.extra_paths = extra_paths
@@ -85,6 +87,8 @@ class TestSerialisation:
self.suite = suite
self.fname = fname
self.is_cross_built = is_cross_built
+ if exe_wrapper is not None:
+ assert(isinstance(exe_wrapper, dependencies.ExternalProgram))
self.exe_runner = exe_wrapper
self.is_parallel = is_parallel
self.cmd_args = cmd_args
@@ -310,7 +314,7 @@ class Backend:
self.environment.cross_info.need_cross_compiler() and \
self.environment.cross_info.need_exe_wrapper()
if is_cross_built:
- exe_wrapper = self.environment.cross_info.config['binaries'].get('exe_wrapper', None)
+ exe_wrapper = self.environment.get_exe_wrapper()
else:
exe_wrapper = None
es = ExecutableSerialisation(basename, exe_cmd, cmd_args, env,
@@ -646,10 +650,10 @@ class Backend:
is_cross = is_cross and exe.is_cross
if isinstance(exe, dependencies.ExternalProgram):
# E.g. an external verifier or simulator program run on a generated executable.
- # Can always be run.
+ # Can always be run without a wrapper.
is_cross = False
if is_cross:
- exe_wrapper = self.environment.cross_info.config['binaries'].get('exe_wrapper', None)
+ exe_wrapper = self.environment.get_exe_wrapper()
else:
exe_wrapper = None
if mesonlib.for_windows(is_cross, self.environment) or \
@@ -711,9 +715,8 @@ class Backend:
def exe_object_to_cmd_array(self, exe):
if self.environment.is_cross_build() and \
- self.environment.cross_info.need_exe_wrapper() and \
isinstance(exe, build.BuildTarget) and exe.is_cross:
- if 'exe_wrapper' not in self.environment.cross_info.config['binaries']:
+ if self.environment.exe_wrapper is None:
s = 'Can not use target %s as a generator because it is cross-built\n'
s += 'and no exe wrapper is defined. You might want to set it to native instead.'
s = s % exe.name