diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2018-09-24 11:08:19 -0700 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2018-10-04 23:50:31 +0300 |
commit | a0e4548c4169cd0db3992e8fc923e523e93643ed (patch) | |
tree | b862022f0ef47f6092f11261fb98dc5cdf557d30 /mesonbuild | |
parent | 88054c48a60e386909421dc8e2c89c918f2253d0 (diff) | |
download | meson-a0e4548c4169cd0db3992e8fc923e523e93643ed.zip meson-a0e4548c4169cd0db3992e8fc923e523e93643ed.tar.gz meson-a0e4548c4169cd0db3992e8fc923e523e93643ed.tar.bz2 |
backends: allow running host arch binaries on compatible build machines
Meson 0.48.0 some validation for using compiled binaries in custom
targets and generators, which is nice. It didn't take into account
though that as long as the OS is the same, some architectures support
running a related architecture natively (x86_64 can run x86 natively,
for example).
Fortunately we already have a method for covering this case available
through the Environment class.
Fixes #4254
Diffstat (limited to 'mesonbuild')
-rw-r--r-- | mesonbuild/backend/backends.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py index 0a28782..40ba213 100644 --- a/mesonbuild/backend/backends.py +++ b/mesonbuild/backend/backends.py @@ -13,6 +13,7 @@ # limitations under the License. import os, pickle, re +import textwrap from .. import build from .. import dependencies from .. import mesonlib @@ -729,10 +730,11 @@ class Backend: def exe_object_to_cmd_array(self, exe): if self.environment.is_cross_build() and \ isinstance(exe, build.BuildTarget) and exe.is_cross: - 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 + if self.environment.exe_wrapper is None and self.environment.cross_info.need_exe_wrapper(): + s = textwrap.dedent(''' + Can not use target {} as a generator because it is cross-built + and no exe wrapper is defined or needs_exe_wrapper is true. + You might want to set it to native instead.'''.format(exe.name)) raise MesonException(s) if isinstance(exe, build.BuildTarget): exe_arr = [os.path.join(self.environment.get_build_dir(), self.get_target_filename(exe))] |