aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/backend/backends.py
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2018-07-31 19:33:06 +0300
committerGitHub <noreply@github.com>2018-07-31 19:33:06 +0300
commite75f6e43050594c77a09eb7b27ee3ec0b0d0898f (patch)
treee89968d5d63109721a11cb385b77d2f7d69a232c /mesonbuild/backend/backends.py
parenta5d0a501fd27a7a68675f5ca6b371ee3c0234016 (diff)
parente8dae2b966498207867cb07d58f4404b76c087ce (diff)
downloadmeson-e75f6e43050594c77a09eb7b27ee3ec0b0d0898f.zip
meson-e75f6e43050594c77a09eb7b27ee3ec0b0d0898f.tar.gz
meson-e75f6e43050594c77a09eb7b27ee3ec0b0d0898f.tar.bz2
Merge pull request #3850 from mesonbuild/nirbheek/exe-wrapper-compiler-fallbacks
Be more permissive about not-found exe_wrapper
Diffstat (limited to 'mesonbuild/backend/backends.py')
-rw-r--r--mesonbuild/backend/backends.py31
1 files changed, 21 insertions, 10 deletions
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py
index ee67462..2105d42 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
@@ -272,8 +276,11 @@ class Backend:
raise MesonException('Unknown data type in object list.')
return obj_list
- def serialize_executable(self, exe, cmd_args, workdir, env={},
+ def serialize_executable(self, tname, exe, cmd_args, workdir, env={},
extra_paths=None, capture=None):
+ '''
+ Serialize an executable for running with a generator or a custom target
+ '''
import hashlib
if extra_paths is None:
# The callee didn't check if we needed extra paths, so check it here
@@ -298,19 +305,24 @@ class Backend:
with open(exe_data, 'wb') as f:
if isinstance(exe, dependencies.ExternalProgram):
exe_cmd = exe.get_command()
- exe_needs_wrapper = False
+ exe_is_native = True
elif isinstance(exe, (build.BuildTarget, build.CustomTarget)):
exe_cmd = [self.get_target_filename_abs(exe)]
- exe_needs_wrapper = exe.is_cross
+ exe_is_native = not exe.is_cross
else:
exe_cmd = [exe]
- exe_needs_wrapper = False
- is_cross_built = exe_needs_wrapper and \
+ exe_is_native = True
+ is_cross_built = (not exe_is_native) and \
self.environment.is_cross_build() and \
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()
+ if not exe_wrapper.found():
+ msg = 'The exe_wrapper {!r} defined in the cross file is ' \
+ 'needed by target {!r}, but was not found. Please ' \
+ 'check the command and/or add it to PATH.'
+ raise MesonException(msg.format(exe_wrapper.name, tname))
else:
exe_wrapper = None
es = ExecutableSerialisation(basename, exe_cmd, cmd_args, env,
@@ -646,10 +658,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 +723,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