@@ -115,7 +115,15 @@ fn generate_uniffi(library_file: &Path, ffi_directory: &Path) -> Result<()> {
115
115
}
116
116
117
117
fn build_for_target ( target : & str , profile : & str ) -> Result < PathBuf > {
118
- cmd ! ( "cargo build -p matrix-sdk-ffi --target {target} --profile {profile}" ) . run ( ) ?;
118
+ let is_catalyst = target. ends_with ( "-macabi" ) ;
119
+ if is_catalyst {
120
+ const CATALYST_RUST_NIGHTLY : & str = "nightly" ;
121
+ cmd ! ( "rustup toolchain install {CATALYST_RUST_NIGHTLY} --no-self-update" ) . run ( ) ?;
122
+ cmd ! ( "rustup component add rust-src --toolchain {CATALYST_RUST_NIGHTLY}" ) . run ( ) ?;
123
+ cmd ! ( "cargo +{CATALYST_RUST_NIGHTLY} build -p matrix-sdk-ffi -Z build-std --target {target} --profile {profile}" ) . run ( ) ?;
124
+ } else {
125
+ cmd ! ( "cargo build -p matrix-sdk-ffi --target {target} --profile {profile}" ) . run ( ) ?;
126
+ }
119
127
120
128
// The builtin dev profile has its files stored under target/debug, all
121
129
// other targets have matching directory names
@@ -147,20 +155,25 @@ fn build_xcframework(
147
155
148
156
( vec ! [ build_path. clone( ) ] , build_path)
149
157
} else {
150
- println ! ( "-- Building for iOS [1/5 ]" ) ;
158
+ println ! ( "-- Building for iOS [1/7 ]" ) ;
151
159
let ios_path = build_for_target ( "aarch64-apple-ios" , profile) ?;
152
160
153
- println ! ( "-- Building for macOS (Apple Silicon) [2/5 ]" ) ;
161
+ println ! ( "-- Building for macOS (Apple Silicon) [2/7 ]" ) ;
154
162
let darwin_arm_path = build_for_target ( "aarch64-apple-darwin" , profile) ?;
155
- println ! ( "-- Building for macOS (Intel) [3/5 ]" ) ;
163
+ println ! ( "-- Building for macOS (Intel) [3/7 ]" ) ;
156
164
let darwin_x86_path = build_for_target ( "x86_64-apple-darwin" , profile) ?;
157
165
158
- println ! ( "-- Building for iOS Simulator (Apple Silicon) [4/5]" ) ;
166
+ println ! ( "-- Building for Mac Catalyst (Apple Silicon) [4/7]" ) ;
167
+ let catalyst_arm_path = build_for_target ( "aarch64-apple-ios-macabi" , profile) ?;
168
+ println ! ( "-- Building for Mac Catalyst (Intel) [5/7]" ) ;
169
+ let catalyst_x86_path = build_for_target ( "x86_64-apple-ios-macabi" , profile) ?;
170
+
171
+ println ! ( "-- Building for iOS Simulator (Apple Silicon) [6/7]" ) ;
159
172
let ios_sim_arm_path = build_for_target ( "aarch64-apple-ios-sim" , profile) ?;
160
- println ! ( "-- Building for iOS Simulator (Intel) [5/5 ]" ) ;
173
+ println ! ( "-- Building for iOS Simulator (Intel) [7/7 ]" ) ;
161
174
let ios_sim_x86_path = build_for_target ( "x86_64-apple-ios" , profile) ?;
162
175
163
- println ! ( "-- Running Lipo for macOS [1/2 ]" ) ;
176
+ println ! ( "-- Running Lipo for macOS [1/3 ]" ) ;
164
177
// # macOS
165
178
let lipo_target_macos = generated_dir. join ( "libmatrix_sdk_ffi_macos.a" ) ;
166
179
cmd ! (
@@ -169,15 +182,24 @@ fn build_xcframework(
169
182
)
170
183
. run ( ) ?;
171
184
172
- println ! ( "-- Running Lipo for iOS Simulator [2/2]" ) ;
185
+ println ! ( "-- Running Lipo for Mac Catalyst [2/3]" ) ;
186
+ // # Catalyst
187
+ let lipo_target_catalyst = generated_dir. join ( "libmatrix_sdk_ffi_catalyst.a" ) ;
188
+ cmd ! (
189
+ "lipo -create {catalyst_x86_path} {catalyst_arm_path}
190
+ -output {lipo_target_catalyst}"
191
+ )
192
+ . run ( ) ?;
193
+
194
+ println ! ( "-- Running Lipo for iOS Simulator [3/3]" ) ;
173
195
// # iOS Simulator
174
196
let lipo_target_sim = generated_dir. join ( "libmatrix_sdk_ffi_iossimulator.a" ) ;
175
197
cmd ! (
176
198
"lipo -create {ios_sim_arm_path} {ios_sim_x86_path}
177
199
-output {lipo_target_sim}"
178
200
)
179
201
. run ( ) ?;
180
- ( vec ! [ lipo_target_macos, lipo_target_sim, ios_path] , darwin_x86_path)
202
+ ( vec ! [ lipo_target_macos, lipo_target_catalyst , lipo_target_sim, ios_path] , darwin_x86_path)
181
203
} ;
182
204
183
205
println ! ( "-- Generating uniffi files" ) ;
0 commit comments