aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/compilers/swift.py
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2019-04-02 00:40:05 +0300
committerGitHub <noreply@github.com>2019-04-02 00:40:05 +0300
commit75219989ca468923142738d93df8aef64e897b8e (patch)
tree225bab977e67835540dddc8f0506f51378e861f5 /mesonbuild/compilers/swift.py
parent663517d23376809fd6bc0b69549ee823a06682d7 (diff)
parenta4b2fbc807e2459f50dc43950753737f558e782b (diff)
downloadmeson-75219989ca468923142738d93df8aef64e897b8e.zip
meson-75219989ca468923142738d93df8aef64e897b8e.tar.gz
meson-75219989ca468923142738d93df8aef64e897b8e.tar.bz2
Merge pull request #5128 from Ericson2314/sanity-check-with-flags
Sanity check with external args
Diffstat (limited to 'mesonbuild/compilers/swift.py')
-rw-r--r--mesonbuild/compilers/swift.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/mesonbuild/compilers/swift.py b/mesonbuild/compilers/swift.py
index 94e6736..17705ac 100644
--- a/mesonbuild/compilers/swift.py
+++ b/mesonbuild/compilers/swift.py
@@ -14,7 +14,7 @@
import subprocess, os.path
-from ..mesonlib import EnvironmentException
+from ..mesonlib import EnvironmentException, MachineChoice
from .compilers import Compiler, swift_buildtype_args, clike_debug_args
@@ -102,13 +102,25 @@ class SwiftCompiler(Compiler):
src = 'swifttest.swift'
source_name = os.path.join(work_dir, src)
output_name = os.path.join(work_dir, 'swifttest')
+ if environment.is_cross_build() and not self.is_cross:
+ for_machine = MachineChoice.BUILD
+ else:
+ for_machine = MachineChoice.HOST
+ extra_flags = environment.coredata.get_external_args(for_machine, self.language)
+ if self.is_cross:
+ extra_flags += self.get_compile_only_args()
+ else:
+ extra_flags += environment.coredata.get_external_link_args(for_machine, self.language)
with open(source_name, 'w') as ofile:
ofile.write('''print("Swift compilation is working.")
''')
- pc = subprocess.Popen(self.exelist + ['-emit-executable', '-o', output_name, src], cwd=work_dir)
+ pc = subprocess.Popen(self.exelist + extra_flags + ['-emit-executable', '-o', output_name, src], cwd=work_dir)
pc.wait()
if pc.returncode != 0:
raise EnvironmentException('Swift compiler %s can not compile programs.' % self.name_string())
+ if self.is_cross:
+ # Can't check if the binaries run so we have to assume they do
+ return
if subprocess.call(output_name) != 0:
raise EnvironmentException('Executables created by Swift compiler %s are not runnable.' % self.name_string())