From 76c2bf6c8a2efd31b05f84a2c22b730b3eae0d8f Mon Sep 17 00:00:00 2001 From: Martin Kroeker Date: Mon, 7 Oct 2019 13:54:47 +0200 Subject: [PATCH] Add automatic fixups for OSX/IOS cross-compilation --- c_check | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/c_check b/c_check index 271182c54..3d82aa73c 100644 --- a/c_check +++ b/c_check @@ -260,6 +260,19 @@ if ($architecture ne $hostarch) { $cross = 1 if ($os ne $hostos); +# rework cross suffix and architecture if we are on OSX cross-compiling for ARMV8-based IOS +# the initial autodetection will have been confused by the command-line arguments to clang +# and the cross-compiler apparently still claims to build for x86_64 in its CC -E output +if (($os eq "Darwin") && ($cross_suffix ne "")) { + my $tmpnam = `xcrun --sdk iphoneos --find clang`; + $cross_suffix = substr($tmpnam, 0, rindex($tmpnam, "/")+1 ); +# this should produce something like $cross_suffix="/Applications/Xcode-10.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/"; + $cross =1; + $architecture = arm64; +} + + + $openmp = "" if $ENV{USE_OPENMP} != 1; $linker_L = "";