From 1654444b01614eca579edff3cf1ef791c36afcbe Mon Sep 17 00:00:00 2001 From: Oleksandr Karpovich Date: Thu, 12 Dec 2024 16:26:47 +0100 Subject: [PATCH] Set -arch flag for clang++ to properly cross-compile for macOS (#1004) --- .../kotlin/tasks/configuration/NativeTasksConfiguration.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/skiko/buildSrc/src/main/kotlin/tasks/configuration/NativeTasksConfiguration.kt b/skiko/buildSrc/src/main/kotlin/tasks/configuration/NativeTasksConfiguration.kt index d84aa8353..43b250efc 100644 --- a/skiko/buildSrc/src/main/kotlin/tasks/configuration/NativeTasksConfiguration.kt +++ b/skiko/buildSrc/src/main/kotlin/tasks/configuration/NativeTasksConfiguration.kt @@ -117,7 +117,12 @@ fun SkikoProjectContext.compileNativeBridgesTask( OS.MacOS -> { flags.set(listOf( *buildType.clangFlags, - *skiaPreprocessorFlags(OS.MacOS, buildType) + *skiaPreprocessorFlags(OS.MacOS, buildType), + when(arch) { + Arch.Arm64 -> "-arch arm64" + Arch.X64 -> "-arch x86_64" + else -> error("Unexpected arch: $arch for $os") + } )) } OS.Linux -> {