@@ -116,15 +116,18 @@ description = "Generates the LiveViewNativeCore.xcframework package"
116116command = " xcodebuild"
117117args = [
118118 " -create-xcframework" ,
119- " -library" , " ${CARGO_TARGET_DIR}/aarch64-apple-darwin/debug/libliveview_native_core.a" ,
119+ " -output" , " ${CARGO_TARGET_DIR}/swift/liveview_native_core.xcframework" ,
120+ # Universal macOS
121+ " -library" , " ${CARGO_TARGET_DIR}/universal-macos-libliveview_native_core.a" ,
120122 " -headers" , " ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/crates/core/c_src/include" ,
123+ # iOS
121124 " -library" , " ${CARGO_TARGET_DIR}/aarch64-apple-ios/debug/libliveview_native_core.a" ,
122125 " -headers" , " ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/crates/core/c_src/include" ,
123- " -library" , " ${CARGO_TARGET_DIR}/aarch64-apple-ios-sim/debug/libliveview_native_core.a" ,
126+ # Universal iOS sim
127+ " -library" , " ${CARGO_TARGET_DIR}/universal-ios-sim-libliveview_native_core.a" ,
124128 " -headers" , " ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/crates/core/c_src/include" ,
125- " -output" , " ${CARGO_TARGET_DIR}/swift/liveview_native_core.xcframework"
126129]
127- dependencies = [" build-macos" , " build-ios" , " remove-existing-xcframework" ]
130+ dependencies = [" build-macos" , " build-ios" , " lipo-macos " , " lipo-ios-sim " , " remove-existing-xcframework" ]
128131
129132[tasks .remove-existing-xcframework ]
130133workspace = false
@@ -148,6 +151,35 @@ command = "rustup"
148151args = [" 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" ]
149152dependencies = [" install-targets" ]
150153
154+ # different architectures for the same platform need to be lipo'd together before going into the xcframework
155+ [tasks .lipo-macos ]
156+ worksapce = false
157+ category = " Packaging"
158+ description = " Creates universal binary for macOS"
159+ command = " xcrun"
160+ args = [
161+ " lipo" ,
162+ " -create" ,
163+ " -output" ,
164+ " ${CARGO_TARGET_DIR}/universal-macos-libliveview_native_core.a" ,
165+ " ${CARGO_TARGET_DIR}/aarch64-apple-darwin/debug/libliveview_native_core.a" ,
166+ " ${CARGO_TARGET_DIR}/x86_64-apple-darwin/debug/libliveview_native_core.a" ,
167+ ]
168+
169+ [tasks .lipo-ios-sim ]
170+ worksapce = false
171+ category = " Packaging"
172+ description = " Creates universal binary for iOS Simulator"
173+ command = " xcrun"
174+ args = [
175+ " lipo" ,
176+ " -create" ,
177+ " -output" ,
178+ " ${CARGO_TARGET_DIR}/universal-ios-sim-libliveview_native_core.a" ,
179+ " ${CARGO_TARGET_DIR}/aarch64-apple-ios-sim/debug/libliveview_native_core.a" ,
180+ " ${CARGO_TARGET_DIR}/x86_64-apple-ios/debug/libliveview_native_core.a" ,
181+ ]
182+
151183[tasks .install-targets ]
152184workspace = false
153185private = true
0 commit comments