@@ -6,18 +6,14 @@ fn main() {
66 let mut target_bits = target. split ( '-' ) ;
77
88 // https://rust-lang.github.io/rfcs/0131-target-specification.html#detailed-design
9- let mut arch = target_bits. next ( ) . expect ( "TARGET triple has an arch" ) ;
9+ let _arch = target_bits. next ( ) . expect ( "TARGET triple has an arch" ) ;
1010 let _vendor = target_bits. next ( ) ;
1111 let platform = target_bits. next ( ) . expect ( "TARGET triple has a platform" ) ;
1212
1313 if platform != "darwin" {
1414 return ;
1515 }
1616
17- if arch == "aarch64" {
18- arch = "arm64" ; // enforce Darwin naming conventions
19- }
20-
2117 println ! ( "cargo:rerun-if-changed=native/swift/AssetCatalogParser" ) ;
2218
2319 let out_dir = env:: var ( "OUT_DIR" ) . expect ( "OUT_DIR is set for build scripts" ) ;
@@ -32,14 +28,13 @@ fn main() {
3228 "native/swift/AssetCatalogParser" ,
3329 "--scratch-path" ,
3430 & format ! ( "{out_dir}/swift-scratch" ) ,
35- "--triple" ,
36- & format ! ( "{arch}-apple-macosx11" ) ,
3731 ] )
3832 . status ( )
3933 . expect ( "Failed to compile SPM" ) ;
4034
4135 assert ! ( status. success( ) , "swift build failed" ) ;
4236
37+ // Create a static library of the Swift and Objective-C code
4338 let status = Command :: new ( "ar" )
4439 . args ( [
4540 "crus" ,
@@ -56,16 +51,19 @@ fn main() {
5651
5752 assert ! ( status. success( ) , "ar failed" ) ;
5853
54+ // Add the new static library to search paths and link to it
5955 println ! ( "cargo:rustc-link-search=native={out_dir}" ) ;
6056 println ! ( "cargo:rustc-link-lib=static=swiftbridge" ) ;
6157
58+ // Link to CoreUI framework
6259 println ! ( "cargo:rustc-link-search=framework=/System/Library/PrivateFrameworks" ) ;
6360 println ! ( "cargo:rustc-link-lib=framework=CoreUI" ) ;
6461
62+ // Link to swift macOS support libraries for Swift runtime support on older macOS versions
6563 let developer_dir = Command :: new ( "xcode-select" )
6664 . args ( [ "-p" ] )
6765 . output ( )
68- . expect ( "Failed to get developer directory" ) ;
66+ . expect ( "Failed to get developer directory, please ensure Xcode is installed. " ) ;
6967 let developer_dir_path = String :: from_utf8 ( developer_dir. stdout )
7068 . expect ( "Failed to convert developer directory to UTF-8" )
7169 . trim ( )
0 commit comments