@@ -70,22 +70,15 @@ def swiftpm_bin_path(swift_exec: str, swiftpm_args: List[str], additional_env: D
70
70
71
71
def get_build_target (swift_exec : str , args : argparse .Namespace , cross_compile : bool = False ) -> str :
72
72
"""Returns the target-triple of the current machine or for cross-compilation."""
73
- try :
74
- command = [swift_exec , '-print-target-info' ]
75
- if cross_compile :
76
- cross_compile_json = json .load (open (args .cross_compile_config ))
77
- command += ['-target' , cross_compile_json ["target" ]]
78
- target_info_json = subprocess .check_output (command , stderr = subprocess .PIPE , universal_newlines = True ).strip ()
79
- args .target_info = json .loads (target_info_json )
80
- if '-apple-macosx' in args .target_info ["target" ]["unversionedTriple" ]:
81
- return args .target_info ["target" ]["unversionedTriple" ]
82
- return args .target_info ["target" ]["triple" ]
83
- except Exception as e :
84
- # Temporary fallback for Darwin.
85
- if platform .system () == 'Darwin' :
86
- return 'x86_64-apple-macosx'
87
- else :
88
- fatal_error (str (e ))
73
+ command = [swift_exec , '-print-target-info' ]
74
+ if cross_compile :
75
+ cross_compile_json = json .load (open (args .cross_compile_config ))
76
+ command += ['-target' , cross_compile_json ["target" ]]
77
+ target_info_json = subprocess .check_output (command , stderr = subprocess .PIPE , universal_newlines = True ).strip ()
78
+ args .target_info = json .loads (target_info_json )
79
+ if '-apple-macosx' in args .target_info ["target" ]["unversionedTriple" ]:
80
+ return args .target_info ["target" ]["unversionedTriple" ]
81
+ return args .target_info ["target" ]["triple" ]
89
82
90
83
# -----------------------------------------------------------------------------
91
84
# Build SourceKit-LSP
@@ -144,7 +137,7 @@ def get_swiftpm_options(swift_exec: str, args: argparse.Namespace, suppress_verb
144
137
145
138
if args .cross_compile_host :
146
139
if build_os .startswith ('macosx' ) and args .cross_compile_host .startswith ('macosx-' ):
147
- swiftpm_args += ["--arch" , "x86_64" , "--arch" , "arm64" ]
140
+ swiftpm_args += ["--arch" , args . cross_compile_host [ 7 :] ]
148
141
elif args .cross_compile_host .startswith ('android-' ):
149
142
print ('Cross-compiling for %s' % args .cross_compile_host )
150
143
swiftpm_args += ['--destination' , args .cross_compile_config ]
0 commit comments