Skip to content

Commit 026f5d1

Browse files
authored
Merge pull request #5 from liveviewnative/apple-platform-support
Add watchOS build
2 parents 37d7970 + 433bb8a commit 026f5d1

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

Makefile.toml

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,12 @@ args = [
125125
"-headers", "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/crates/core/c_src/include",
126126
# Universal iOS sim
127127
"-library", "${CARGO_TARGET_DIR}/universal-ios-sim-libliveview_native_core.a",
128+
"-headers", "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/crates/core/c_src/include",
129+
# Universal watchOS
130+
"-library", "${CARGO_TARGET_DIR}/universal-watchos-libliveview_native_core.a",
128131
"-headers", "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/crates/core/c_src/include",
129132
]
130-
dependencies = ["build-macos", "build-ios", "lipo-macos", "lipo-ios-sim", "remove-existing-xcframework"]
133+
dependencies = ["build-macos", "build-ios", "build-watchos", "lipo-macos", "lipo-ios-sim", "lipo-watchos", "remove-existing-xcframework"]
131134

132135
[tasks.remove-existing-xcframework]
133136
workspace = false
@@ -151,6 +154,14 @@ command = "rustup"
151154
args = ["run", "${CARGO_MAKE_TOOLCHAIN}", "cargo", "build", "@@remove-empty(CARGO_MAKE_CARGO_VERBOSE_FLAGS)", "--target", "aarch64-apple-ios", "--target", "aarch64-apple-ios-sim", "--target", "x86_64-apple-ios", "-p", "liveview-native-core"]
152155
dependencies = ["install-targets"]
153156

157+
[tasks.build-watchos]
158+
workspace = false
159+
category = "Build"
160+
description = "Compiles for all targets needed to produce a universal library for watchOS"
161+
command = "rustup"
162+
args = ["run", "${CARGO_MAKE_TOOLCHAIN}", "cargo", "build", "@@remove-empty(CARGO_MAKE_CARGO_VERBOSE_FLAGS)", "-Z", "build-std", "--target", "arm64_32-apple-watchos", "--target", "armv7k-apple-watchos", "--target", "aarch64-apple-watchos-sim", "--target", "x86_64-apple-watchos-sim", "-p", "liveview-native-core"]
163+
dependencies = ["install-targets"]
164+
154165
# different architectures for the same platform need to be lipo'd together before going into the xcframework
155166
[tasks.lipo-macos]
156167
worksapce = false
@@ -180,6 +191,22 @@ args = [
180191
"${CARGO_TARGET_DIR}/x86_64-apple-ios/debug/libliveview_native_core.a",
181192
]
182193

194+
[tasks.lipo-watchos]
195+
worksapce = false
196+
category = "Packaging"
197+
description = "Creates universal binary for watchOS Simulator"
198+
command = "xcrun"
199+
args = [
200+
"lipo",
201+
"-create",
202+
"-output",
203+
"${CARGO_TARGET_DIR}/universal-watchos-libliveview_native_core.a",
204+
"${CARGO_TARGET_DIR}/arm64_32-apple-watchos/debug/libliveview_native_core.a",
205+
"${CARGO_TARGET_DIR}/armv7k-apple-watchos/debug/libliveview_native_core.a",
206+
"${CARGO_TARGET_DIR}/aarch64-apple-watchos-sim/debug/libliveview_native_core.a",
207+
"${CARGO_TARGET_DIR}/x86_64-apple-watchos-sim/debug/libliveview_native_core.a",
208+
]
209+
183210
[tasks.install-targets]
184211
workspace = false
185212
private = true

0 commit comments

Comments
 (0)