@@ -77,23 +77,26 @@ def run_swift_build(host_target, product, swiftpm_package_product_name, set_inst
7777 # Building with the freshly-built SwiftPM
7878 swift_build = os .path .join (product .install_toolchain_path (host_target ), "bin" , "swift-build" )
7979
80- build_os = host_target .split ('-' )[0 ]
81- if set_installation_rpath and not host_target .startswith ('macos' ):
80+ if host_target .startswith ('macos' ):
81+ # Universal binary on macOS
82+ platform_args = ['--arch' , 'x86_64' , '--arch' , 'arm64' ]
83+ elif set_installation_rpath :
8284 # Library rpath for swift, dispatch, Foundation, etc. when installing
83- rpath_args = [
85+ build_os = host_target .split ('-' )[0 ]
86+ platform_args = [
8487 '--disable-local-rpath' , '-Xswiftc' , '-no-toolchain-stdlib-rpath' ,
8588 '-Xlinker' , '-rpath' , '-Xlinker' , '$ORIGIN/../lib/swift/' + build_os
8689 ]
8790 else :
88- rpath_args = []
91+ platform_args = []
8992
9093 build_args = [
9194 swift_build ,
9295 '--product' , swiftpm_package_product_name ,
9396 '--package-path' , os .path .join (product .source_dir ),
9497 '--build-path' , product .build_dir ,
9598 '--configuration' , 'release' ,
96- ] + rpath_args
99+ ] + platform_args
97100
98101 if product .args .verbose_build :
99102 build_args .append ('--verbose' )
0 commit comments