Skip to content

Commit 2072bf8

Browse files
authored
CMake: run generate_xcode.txt only for the host platform (#71279)
Currently the test assumes that when we are testing for macOS we are targeting the host architecture (since we need to reuse existing build products to contain testing time) -- however there are some Apple internal configurations in which that's not the case. Addresses rdar://118337598
1 parent a2df540 commit 2072bf8

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

test/lit.cfg

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,15 @@ if run_vers.endswith('-simulator'):
399399
else:
400400
run_environment=''
401401

402+
# Parse the host triple
403+
(host_cpu, host_vendor, host_os, host_vers) = re.match('([^-]+)-([^-]+)-([^0-9-]+)(.*)', config.host_triple).groups()
404+
405+
if f"{host_cpu}-{host_vendor}-{host_os}" == f"{run_cpu}-{run_vendor}-{run_os}":
406+
# Ignore the version on purpose, to account for scenario
407+
# in which the compiler has a different deployment target
408+
# than the standard library
409+
config.available_features.add('target-same-as-host')
410+
402411
target_arch = run_cpu
403412
if run_os == 'openbsd' and run_cpu == 'amd64':
404413
target_arch = run_cpu
@@ -581,8 +590,6 @@ else:
581590
config.swift_driver_test_options,
582591
)
583592
)
584-
# Parse the host triple.
585-
(host_cpu, host_vendor, host_os, host_vers) = re.match('([^-]+)-([^-]+)-([^0-9-]+)(.*)', config.host_triple).groups()
586593
toolchain_lib_dir = make_path(config.swift_lib_dir, 'swift', host_os)
587594
config.host_build_swift = (
588595
"%s -target %s -g %s -I %s -L %s %s" % (

validation-test/BuildSystem/generate_xcode.test

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@
1515

1616
# REQUIRES: standalone_build
1717
# REQUIRES: OS=macosx
18+
# REQUIRES: target-same-as-host

0 commit comments

Comments
 (0)