diff --git a/packages/skia/scripts/build-skia.ts b/packages/skia/scripts/build-skia.ts index acc4f1a8cf..46b1c12226 100644 --- a/packages/skia/scripts/build-skia.ts +++ b/packages/skia/scripts/build-skia.ts @@ -135,6 +135,12 @@ const buildXCFrameworks = () => { // eslint-disable-next-line max-len `lipo -create ${OutFolder}/${os}/x64-iphonesimulator/${name} ${OutFolder}/${os}/arm64-iphonesimulator/${name} -output ${OutFolder}/${os}/iphonesimulator/${name}` ); + $(`mkdir -p ${OutFolder}/${os}/maccatalyst`); + $(`rm -rf ${OutFolder}/${os}/maccatalyst/${name}`); + $( + // eslint-disable-next-line max-len + `lipo -create ${OutFolder}/${os}/x64-maccatalyst/${name} ${OutFolder}/${os}/arm64-maccatalyst/${name} -output ${OutFolder}/${os}/maccatalyst/${name}` + ); $(`mkdir -p ${OutFolder}/${os}/macosx`); $(`rm -rf ${OutFolder}/${os}/macosx/${name}`); $( @@ -150,6 +156,7 @@ const buildXCFrameworks = () => { `-library ${prefix}/arm64-tvos/${name} ` + `-library ${prefix}/tvsimulator/${name} ` + `-library ${prefix}/macosx/${name} ` + + `-library ${prefix}/maccatalyst/${name} ` + ` -output ${dstPath}` ); }); diff --git a/packages/skia/scripts/skia-configuration.ts b/packages/skia/scripts/skia-configuration.ts index 518ad4776d..1dea866c17 100644 --- a/packages/skia/scripts/skia-configuration.ts +++ b/packages/skia/scripts/skia-configuration.ts @@ -2,6 +2,7 @@ import path from "path"; import { $ } from "./utils"; +import { spawnSync } from "child_process"; const DEBUG = false; export const GRAPHITE = !!process.env.SK_GRAPHITE; @@ -103,6 +104,8 @@ export type Platform = { const appleMinTarget = GRAPHITE ? "15.1" : "13.0"; const iosMinTarget = `"${appleMinTarget}"`; +const appleSdkRoot = spawnSync(`xcrun --sdk macosx --show-sdk-path`, {shell:true}).stdout.toString().trim(); + export const configurations = { android: { targets: { @@ -227,6 +230,54 @@ export const configurations = { ], ], }, + "arm64-maccatalyst": { + cpu: "arm64", + platform: "mac", + args: [ + ["skia_enable_gpu", true], + ["target_os", `"mac"`], + ["target_cpu", `"arm64"`], + ["mac_deployment_target", `"14.0"`], + [ + "extra_cflags", + `["-target","arm64-apple-ios14.0-macabi",` + + `"-isysroot","${appleSdkRoot}",` + + `"-isystem","${appleSdkRoot}/System/iOSSupport/usr/include",` + + `"-iframework","${appleSdkRoot}/System/iOSSupport/System/Library/Frameworks"]`, + ], + [ + "extra_ldflags", + `["-isysroot","${appleSdkRoot}",` + + `"-iframework","${appleSdkRoot}/System/iOSSupport/System/Library/Frameworks"]`, + ], + ["cc", "\"clang\""], + ["cxx", "\"clang++\""], + ], + }, + "x64-maccatalyst": { + cpu: "x64", + platform: "mac", + args: [ + ["skia_enable_gpu", true], + ["target_os", `"mac"`], + ["target_cpu", `"x64"`], + ["mac_deployment_target", `"14.0"`], + [ + "extra_cflags", + `["-target","x86_64-apple-ios14.0-macabi",` + + `"-isysroot","${appleSdkRoot}",` + + `"-isystem","${appleSdkRoot}/System/iOSSupport/usr/include",` + + `"-iframework","${appleSdkRoot}/System/iOSSupport/System/Library/Frameworks"]`, + ], + [ + "extra_ldflags", + `["-isysroot","${appleSdkRoot}",` + + `"-iframework","${appleSdkRoot}/System/iOSSupport/System/Library/Frameworks"]`, + ], + ["cc", "\"clang\""], + ["cxx", "\"clang++\""], + ], + }, "arm64-macosx": { platformGroup: "macosx", cpu: "arm64",