diff --git a/scripts/build-skia-ios-framework.ts b/scripts/build-skia-ios-framework.ts index f69911a884..3faf2348da 100644 --- a/scripts/build-skia-ios-framework.ts +++ b/scripts/build-skia-ios-framework.ts @@ -1,6 +1,6 @@ /* eslint-disable max-len */ import { configurations } from "./skia-configuration"; -import { executeCmdSync, checkFileExists } from "./utils"; +import { executeCmdSync, checkFileExists, ensureFolderExists } from "./utils"; /** * This build script takes the prebuilt Skia Binaries and creates @@ -41,11 +41,21 @@ console.log(""); console.log("Prerequisites met. Starting build."); console.log(""); -console.log("Building fat binary for iphone simulator"); +console.log("Building fat binary for iphone / tv simulator"); configurations.ios.outputNames.forEach((out) => { console.log(`Building fat binary for simulator for file ${out}`); executeCmdSync( - `lipo -create package/libs/ios/x64/${out} package/libs/ios/arm64-iphonesimulator/${out} -output package/libs/ios/${ + `lipo -create package/libs/ios/x64-iphonesimulator/${out} package/libs/ios/arm64-iphonesimulator/${out} -output package/libs/ios/${ + out.split(".")[0] + }.a` + ); +}); + +ensureFolderExists("package/libs/ios/tvsimulator"); +configurations.tvos.outputNames.forEach((out) => { + console.log(`Building fat binary for simulator for file ${out}`); + executeCmdSync( + `lipo -create package/libs/ios/x64-tvsimulator/${out} package/libs/ios/arm64-tvsimulator/${out} -output package/libs/ios/tvsimulator/${ out.split(".")[0] }.a` ); @@ -62,7 +72,7 @@ configurations.ios.outputNames.forEach((out) => { "xcodebuild -create-xcframework " + `-library ./package/libs/ios/${libName}.a ` + `-library ./package/libs/ios/arm64-iphoneos/${libName}.a ` + - `-library ./package/libs/ios/arm64-tvsimulator/${libName}.a ` + + `-library ./package/libs/ios/tvsimulator/${libName}.a ` + `-library ./package/libs/ios/arm64-tvos/${libName}.a ` + ` -output ./package/libs/ios/${libName}.xcframework ` ); diff --git a/scripts/skia-configuration.ts b/scripts/skia-configuration.ts index c9a4972d80..b40204de77 100644 --- a/scripts/skia-configuration.ts +++ b/scripts/skia-configuration.ts @@ -131,7 +131,7 @@ export const configurations: Configuration = { ["extra_ldflags", '["-target", "arm64-apple-ios-simulator"]'], ], }, - x64: { + "x64-iphonesimulator": { cpu: "x64", args: [ ["ios_min_target", '"13.0"'], @@ -175,6 +175,15 @@ export const configurations: Configuration = { ["extra_ldflags", '["-target", "arm64-apple-tvos-simulator", "-mappletvos-version-min=13.0"]'], ], }, + "x64-tvsimulator": { + cpu: "x64", + args: [ + ["ios_use_simulator", "true"], + ["extra_cflags", '["-target", "x86_64-apple-tvos-simulator", "-mappletvos-version-min=13.0"]'], + ["extra_asmflags", '["-target", "x86_64-apple-tvos-simulator", "-mappletvos-version-min=13.0"]'], + ["extra_ldflags", '["-target", "x86_64-apple-tvos-simulator", "-mappletvos-version-min=13.0"]'], + ], + }, }, args: [ ["skia_use_metal", true],