Skip to content

Commit 05fced2

Browse files
committed
Include tvOS targets in sources
1 parent 2606c8b commit 05fced2

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

tool/build_xcframework.sh

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ TARGETS=(
1919
aarch64-apple-watchos-sim
2020
x86_64-apple-watchos-sim
2121
arm64_32-apple-watchos
22+
23+
# tvOS and simulator
24+
aarch64-apple-tvos
25+
aarch64-apple-tvos-sim
26+
x86_64-apple-tvos
2227
)
2328
VERSION=0.4.2
2429

@@ -40,6 +45,21 @@ function generatePlist() {
4045
EOF
4146
)
4247
min_os_version="9.0";;
48+
*"tvos"*)
49+
additional_keys=$(cat <<EOF
50+
<key>CFBundleSupportedPlatforms</key>
51+
<array>
52+
<string>AppleTVOS</string>
53+
</array>
54+
<key>MinimumOSVersion</key>
55+
<string>13.0</string>
56+
<key>UIDeviceFamily</key>
57+
<array>
58+
<integer>3</integer>
59+
</array>
60+
EOF
61+
)
62+
min_os_version="13.0";;
4363
*)
4464
min_os_version="11.0";;
4565
esac
@@ -77,6 +97,7 @@ function createXcframework() {
7797
ios_plist=$(generatePlist "ios")
7898
macos_plist=$(generatePlist "macos")
7999
watchos_plist=$(generatePlist "watchos")
100+
tvos_plist=$(generatePlist "tvos")
80101

81102
echo "===================== create ios device framework ====================="
82103
mkdir -p "${BUILD_DIR}/ios-arm64/powersync-sqlite-core.framework"
@@ -117,6 +138,22 @@ function createXcframework() {
117138
lipo ./target/aarch64-apple-watchos-sim/release_apple/libpowersync.a ./target/x86_64-apple-watchos-sim/release_apple/libpowersync.a -create -output "${BUILD_DIR}/watchos-arm64_x86_64-simulator/powersync-sqlite-core.framework/powersync-sqlite-core"
118139
# install_name_tool isn't necessary, we use a statically-linked library
119140

141+
echo "===================== create tvos device framework ====================="
142+
mkdir -p "${BUILD_DIR}/tvos-arm64/powersync-sqlite-core.framework"
143+
echo "${tvos_plist}" > "${BUILD_DIR}/tvos-arm64/powersync-sqlite-core.framework/Info.plist"
144+
cp -f "./target/aarch64-apple-tvos/release_apple/libpowersync.dylib" "${BUILD_DIR}/tvos-arm64/powersync-sqlite-core.framework/powersync-sqlite-core"
145+
install_name_tool -id "@rpath/powersync-sqlite-core.framework/powersync-sqlite-core" "${BUILD_DIR}/tvos-arm64/powersync-sqlite-core.framework/powersync-sqlite-core"
146+
# Generate dSYM for tvOS Device
147+
dsymutil "${BUILD_DIR}/tvos-arm64/powersync-sqlite-core.framework/powersync-sqlite-core" -o "${BUILD_DIR}/tvos-arm64/powersync-sqlite-core.framework.dSYM"
148+
149+
echo "===================== create tvos simulator framework ====================="
150+
mkdir -p "${BUILD_DIR}/tvos-arm64_x86_64-simulator/powersync-sqlite-core.framework"
151+
echo "${tvos_plist}" > "${BUILD_DIR}/tvos-arm64_x86_64-simulator/powersync-sqlite-core.framework/Info.plist"
152+
lipo ./target/aarch64-apple-tvos-sim/release_apple/libpowersync.dylib ./target/x86_64-apple-tvos/release_apple/libpowersync.dylib -create -output "${BUILD_DIR}/tvos-arm64_x86_64-simulator/powersync-sqlite-core.framework/powersync-sqlite-core"
153+
install_name_tool -id "@rpath/powersync-sqlite-core.framework/powersync-sqlite-core" "${BUILD_DIR}/tvos-arm64_x86_64-simulator/powersync-sqlite-core.framework/powersync-sqlite-core"
154+
# Generate dSYM for tvOS Simulator
155+
dsymutil "${BUILD_DIR}/tvos-arm64_x86_64-simulator/powersync-sqlite-core.framework/powersync-sqlite-core" -o "${BUILD_DIR}/tvos-arm64_x86_64-simulator/powersync-sqlite-core.framework.dSYM"
156+
120157
echo "===================== create xcframework ====================="
121158
rm -rf "${BUILD_DIR}/powersync-sqlite-core.xcframework"
122159

@@ -129,6 +166,10 @@ function createXcframework() {
129166
-debug-symbols "$(pwd -P)/${BUILD_DIR}/macos-arm64_x86_64/powersync-sqlite-core.framework.dSYM" \
130167
-framework "${BUILD_DIR}/watchos-arm64_arm64_32_armv7k/powersync-sqlite-core.framework" \
131168
-framework "${BUILD_DIR}/watchos-arm64_x86_64-simulator/powersync-sqlite-core.framework" \
169+
-framework "${BUILD_DIR}/tvos-arm64/powersync-sqlite-core.framework" \
170+
-debug-symbols "$(pwd -P)/${BUILD_DIR}/tvos-arm64/powersync-sqlite-core.framework.dSYM" \
171+
-framework "${BUILD_DIR}/tvos-arm64_x86_64-simulator/powersync-sqlite-core.framework" \
172+
-debug-symbols "$(pwd -P)/${BUILD_DIR}/tvos-arm64_x86_64-simulator/powersync-sqlite-core.framework.dSYM" \
132173
-output "${BUILD_DIR}/powersync-sqlite-core.xcframework"
133174

134175
cp -Rf "${BUILD_DIR}/powersync-sqlite-core.xcframework" "powersync-sqlite-core.xcframework"

0 commit comments

Comments
 (0)