@@ -253,9 +253,12 @@ impl SwiftLinker {
253
253
arch => arch,
254
254
} ;
255
255
256
+ let swift_target_triple = rust_target
257
+ . swift_target_triple ( & self . macos_min_version , self . ios_min_version . as_deref ( ) ) ;
258
+
256
259
command
257
260
// Build the package (duh)
258
- . args ( [ "build" ] )
261
+ . arg ( "build" )
259
262
// SDK path for regular compilation (idk)
260
263
. args ( [ "--sdk" , sdk_path. trim ( ) ] )
261
264
// Release/Debug configuration
@@ -270,24 +273,17 @@ impl SwiftLinker {
270
273
// Override target triple for each swiftc instance.
271
274
// Necessary for iOS compilation.
272
275
. args ( [ "-Xswiftc" , "-target" ] )
273
- . args ( [
274
- "-Xswiftc" ,
275
- & rust_target. swift_target_triple (
276
- & self . macos_min_version ,
277
- self . ios_min_version . as_deref ( ) ,
278
- ) ,
279
- ] ) ;
276
+ . args ( [ "-Xswiftc" , & swift_target_triple] )
277
+ . args ( [ "-Xcc" , & format ! ( "--target={swift_target_triple}" ) ] )
278
+ . args ( [ "-Xcxx" , & format ! ( "--target={swift_target_triple}" ) ] ) ;
280
279
281
280
if !command. status ( ) . unwrap ( ) . success ( ) {
282
281
panic ! ( "Failed to compile swift package {}" , package. name) ;
283
282
}
284
283
285
284
let search_path = out_path
286
285
// swift build uses this output folder no matter what is the target
287
- . join ( format ! (
288
- "{}-apple-macosx" ,
289
- arch
290
- ) )
286
+ . join ( format ! ( "{}-apple-macosx" , arch) )
291
287
. join ( configuration) ;
292
288
293
289
println ! ( "cargo:rerun-if-changed={}" , package_path. display( ) ) ;
0 commit comments