Skip to content

Commit

Permalink
feat(🍏): add tvOS build support
Browse files Browse the repository at this point in the history
  • Loading branch information
RuudBurger committed Jan 2, 2025
1 parent 899913d commit 8c65e58
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/skia/react-native-skia.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Pod::Spec.new do |s|
"Christian Falch" => "[email protected]",
"William Candillon" => "[email protected]"
}
s.platforms = { :ios => "13.0" }
s.platforms = { :ios => "13.0", :tvos => "13.0" }
s.source = { :git => "https://github.com/shopify/react-native-skia/react-native-skia.git", :tag => "#{s.version}" }

s.requires_arc = true
Expand All @@ -54,7 +54,7 @@ Pod::Spec.new do |s|

s.frameworks = 'MetalKit'

s.ios.vendored_frameworks = use_graphite ?
s.vendored_frameworks = use_graphite ?
base_frameworks + graphite_frameworks :
base_frameworks

Expand Down
8 changes: 8 additions & 0 deletions packages/skia/scripts/build-skia.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,12 @@ const buildXCFrameworks = () => {
outputNames.forEach((name) => {
console.log("Building XCFramework for " + name);
const prefix = `${OutFolder}/${os}`;
$(`mkdir -p ${OutFolder}/${os}/tvsimulator`);
$(`rm -rf ${OutFolder}/${os}/tvsimulator/${name}`);
$(
// eslint-disable-next-line max-len
`lipo -create ${OutFolder}/${os}/x64-tvsimulator/${name} ${OutFolder}/${os}/arm64-tvsimulator/${name} -output ${OutFolder}/${os}/tvsimulator/${name}`
);
$(`mkdir -p ${OutFolder}/${os}/iphonesimulator`);
$(`rm -rf ${OutFolder}/${os}/iphonesimulator/${name}`);
$(
Expand All @@ -141,6 +147,8 @@ const buildXCFrameworks = () => {
"xcodebuild -create-xcframework " +
`-library ${prefix}/arm64-iphoneos/${name} ` +
`-library ${prefix}/iphonesimulator/${name} ` +
`-library ${prefix}/arm64-tvos/${name} ` +
`-library ${prefix}/tvsimulator/${name} ` +
`-library ${prefix}/macosx/${name} ` +
` -output ${dstPath}`
);
Expand Down
29 changes: 29 additions & 0 deletions packages/skia/scripts/skia-configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,35 @@ export const configurations = {
platform: "ios",
args: [["ios_min_target", iosMinTarget]],
},
"arm64-tvos": {
cpu: "arm64",
platform: "tvos",
args: [
["extra_cflags", '["-target", "arm64-apple-tvos", "-mappletvos-version-min=13.0"]'],
["extra_asmflags", '["-target", "arm64-apple-tvos", "-mappletvos-version-min=13.0"]'],
["extra_ldflags", '["-target", "arm64-apple-tvos", "-mappletvos-version-min=13.0"]'],
],
},
"arm64-tvsimulator": {
cpu: "arm64",
platform: "tvos",
args: [
["ios_use_simulator", true],
["extra_cflags", '["-target", "arm64-apple-tvos-simulator", "-mappletvsimulator-version-min=13.0"]'],
["extra_asmflags", '["-target", "arm64-apple-tvos-simulator", "-mappletvsimulator-version-min=13.0"]'],
["extra_ldflags", '["-target", "arm64-apple-tvos-simulator", "-mappletvsimulator-version-min=13.0"]'],
],
},
"x64-tvsimulator": {
cpu: "x64",
platform: "tvos",
args: [
["ios_use_simulator", true],
["extra_cflags", '["-target", "arm64-apple-tvos-simulator", "-mappletvsimulator-version-min=13.0"]'],
["extra_asmflags", '["-target", "arm64-apple-tvos-simulator", "-mappletvsimulator-version-min=13.0"]'],
["extra_ldflags", '["-target", "arm64-apple-tvos-simulator", "-mappletvsimulator-version-min=13.0"]'],
],
},
"arm64-macosx": {
platformGroup: "macosx",
cpu: "arm64",
Expand Down

0 comments on commit 8c65e58

Please sign in to comment.