@@ -116,15 +116,18 @@ description = "Generates the LiveViewNativeCore.xcframework package"
116
116
command = " xcodebuild"
117
117
args = [
118
118
" -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" ,
120
122
" -headers" , " ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/crates/core/c_src/include" ,
123
+ # iOS
121
124
" -library" , " ${CARGO_TARGET_DIR}/aarch64-apple-ios/debug/libliveview_native_core.a" ,
122
125
" -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" ,
124
128
" -headers" , " ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/crates/core/c_src/include" ,
125
- " -output" , " ${CARGO_TARGET_DIR}/swift/liveview_native_core.xcframework"
126
129
]
127
- dependencies = [" build-macos" , " build-ios" , " remove-existing-xcframework" ]
130
+ dependencies = [" build-macos" , " build-ios" , " lipo-macos " , " lipo-ios-sim " , " remove-existing-xcframework" ]
128
131
129
132
[tasks .remove-existing-xcframework ]
130
133
workspace = false
@@ -148,6 +151,35 @@ command = "rustup"
148
151
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" ]
149
152
dependencies = [" install-targets" ]
150
153
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
+
151
183
[tasks .install-targets ]
152
184
workspace = false
153
185
private = true
0 commit comments