aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/compilers/compilers.py
diff options
context:
space:
mode:
authorCody Schafer <jmesmon@gmail.com>2019-06-27 13:36:09 -0400
committerJussi Pakkanen <jpakkane@gmail.com>2019-06-27 20:36:09 +0300
commit11248eb203e16dae6dc288d148b20b44fb0a5ac0 (patch)
tree307b8b0741673d7bd66fdb7a28294fa58a1d8e3c /mesonbuild/compilers/compilers.py
parentecbfc08dcacf015f9fd9e921a2136c80528f2809 (diff)
downloadmeson-11248eb203e16dae6dc288d148b20b44fb0a5ac0.zip
meson-11248eb203e16dae6dc288d148b20b44fb0a5ac0.tar.gz
meson-11248eb203e16dae6dc288d148b20b44fb0a5ac0.tar.bz2
sanitycheckc: avoid linking sanitycheckc when cross compiling
Diffstat (limited to 'mesonbuild/compilers/compilers.py')
-rw-r--r--mesonbuild/compilers/compilers.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py
index 379ec1f..5855de7 100644
--- a/mesonbuild/compilers/compilers.py
+++ b/mesonbuild/compilers/compilers.py
@@ -1139,6 +1139,15 @@ class Compiler:
suffix = 'obj'
return os.path.join(dirname, 'output.' + suffix)
+ def get_compiler_args_for_mode(self, mode):
+ args = []
+ args += self.get_always_args()
+ if mode == 'compile':
+ args += self.get_compile_only_args()
+ if mode == 'preprocess':
+ args += self.get_preprocess_only_args()
+ return args
+
@contextlib.contextmanager
def compile(self, code, extra_args=None, *, mode='link', want_output=False):
if extra_args is None:
@@ -1156,15 +1165,11 @@ class Compiler:
# Construct the compiler command-line
commands = CompilerArgs(self)
commands.append(srcname)
- commands += self.get_always_args()
- if mode == 'compile':
- commands += self.get_compile_only_args()
# Preprocess mode outputs to stdout, so no output args
- if mode == 'preprocess':
- commands += self.get_preprocess_only_args()
- else:
+ if mode != 'preprocess':
output = self._get_compile_output(tmpdirname, mode)
commands += self.get_output_args(output)
+ commands.extend(self.get_compiler_args_for_mode(mode))
# extra_args must be last because it could contain '/link' to
# pass args to VisualStudio's linker. In that case everything
# in the command line after '/link' is given to the linker.