Skip to content

Commit 7b06638

Browse files
authored
Cross-compile flags should be in get_swiftpm_flags (#2916)
These flags were only passed for regular builds, but not for testing or other actions. rdar://problem/68542579
1 parent a068be4 commit 7b06638

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

Utilities/bootstrap

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -577,13 +577,6 @@ def build_swiftpm_with_swiftpm(args, integrated_swift_driver):
577577
if integrated_swift_driver:
578578
swiftpm_args.append("--use-integrated-swift-driver")
579579

580-
build_target = get_build_target(args)
581-
cross_compile_hosts = args.cross_compile_hosts
582-
if build_target == 'x86_64-apple-macosx' and "macosx-arm64" in cross_compile_hosts:
583-
swiftpm_args += ["--arch", "x86_64", "--arch", "arm64"]
584-
elif cross_compile_hosts:
585-
error("cannot cross-compile for %s" % cross_compile_hosts)
586-
587580
call_swiftpm(args, swiftpm_args)
588581

589582
# Setup symlinks that'll allow using swiftpm from the build directory.
@@ -734,6 +727,13 @@ def get_swiftpm_flags(args):
734727
if platform.system() != "Darwin" and args.command == 'install':
735728
build_flags.extend(["-Xswiftc", "-no-toolchain-stdlib-rpath"])
736729

730+
build_target = get_build_target(args)
731+
cross_compile_hosts = args.cross_compile_hosts
732+
if build_target == 'x86_64-apple-macosx' and "macosx-arm64" in cross_compile_hosts:
733+
build_flags += ["--arch", "x86_64", "--arch", "arm64"]
734+
elif cross_compile_hosts:
735+
error("cannot cross-compile for %s" % cross_compile_hosts)
736+
737737
return build_flags
738738

739739
if __name__ == '__main__':

0 commit comments

Comments
 (0)