Add property to disable compiler sanity checks during cross compilation.

pull/6363/head
Jussi Pakkanen 4 years ago
parent 1cf7799df2
commit 9e5c881b06
  1. 2
      cross/ubuntu-armhf.txt
  2. 9
      docs/markdown/snippets/skipsanity.md
  3. 15
      mesonbuild/interpreter.py
  4. 2
      mesonbuild/mlog.py

@ -18,6 +18,8 @@ cpp_args = '-DMESON_TEST_ISSUE_1665=1'
has_function_printf = true
has_function_hfkerhisadf = false
skip_sanity_check = true
[host_machine]
system = 'linux'
cpu_family = 'arm'

@ -0,0 +1,9 @@
## Skip sanity tests when cross compiling
For certain cross compilation environments it is not possible to
compile a sanity check application. This can now be disabled by adding
the following entry to your cross file's `properties` section:
```
skip_sanity_check = true
```

@ -3080,6 +3080,16 @@ external dependencies (including libraries) must go to "dependencies".''')
self._redetect_machines()
return success
def should_skip_sanity_check(self, for_machine: MachineChoice) -> bool:
if for_machine != MachineChoice.HOST:
return False
if not self.environment.is_cross_build():
return False
should = self.environment.properties.host.get('skip_sanity_check', False)
if not isinstance(should, bool):
raise InterpreterException('Option skip_sanity_check must be a boolean.')
return should
def add_languages_for(self, args, required, for_machine: MachineChoice):
success = True
for lang in sorted(args, key=compilers.sort_clink):
@ -3093,7 +3103,10 @@ external dependencies (including libraries) must go to "dependencies".''')
comp = self.environment.detect_compiler_for(lang, for_machine)
if comp is None:
raise InvalidArguments('Tried to use unknown language "%s".' % lang)
comp.sanity_check(self.environment.get_scratch_dir(), self.environment)
if self.should_skip_sanity_check(for_machine):
mlog.log_once('Cross compiler sanity tests disabled via the cross file.')
else:
comp.sanity_check(self.environment.get_scratch_dir(), self.environment)
except Exception:
if not required:
mlog.log('Compiler for language',

@ -213,7 +213,7 @@ def log_once(*args: T.Union[str, AnsiDecorator], is_error: bool = False,
**kwargs: T.Any) -> None:
"""Log variant that only prints a given message one time per meson invocation.
This considers nasi decorated values by the values they wrap without
This considers ansi decorated values by the values they wrap without
regard for the AnsiDecorator itself.
"""
t = tuple(a.text if isinstance(a, AnsiDecorator) else a for a in args)

Loading…
Cancel
Save