Skip to content

Allow cross host compilation without stdlib build #35858

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,15 @@ def __init__(self, host_target, args):
# Otherwise, this is a host we are building as part of
# cross-compiling, so we only need the target itself.
stdlib_targets_to_configure = [host_target]
stdlib_targets_to_build = set(stdlib_targets_to_configure)
if (hasattr(args, 'stdlib_deployment_targets')):
# there are some build configs that expect
# not to be building the stdlib for the target
# since it will be provided by different means
stdlib_targets_to_build = set(
stdlib_targets_to_configure).intersection(
set(args.stdlib_deployment_targets))
else:
stdlib_targets_to_build = set(stdlib_targets_to_configure)

if (hasattr(args, 'stdlib_deployment_targets') and
args.stdlib_deployment_targets == []):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,34 @@ def test_should_configure_and_build_when_cross_compiling(self):
self.assertIn('swift-test-stdlib-iphoneos-arm64',
hsc.swift_stdlib_build_targets)

def test_should_configure_and_build_cross_compiling_with_stdlib_targets(self):
args = self.default_args()
args.build_ios_device = True
args.host_target = 'macosx-x86_64'
args.stdlib_deployment_targets = ['iphoneos-arm64']

hsc = HostSpecificConfiguration('iphoneos-arm64', args)

self.assertEqual(len(hsc.sdks_to_configure), 1)
self.assertIn('IOS', hsc.sdks_to_configure)

self.assertEqual(len(hsc.swift_stdlib_build_targets), 1)
self.assertIn('swift-test-stdlib-iphoneos-arm64',
hsc.swift_stdlib_build_targets)

def test_should_only_configure_when_cross_compiling_different_stdlib_targets(self):
args = self.default_args()
args.build_ios_device = True
args.host_target = 'macosx-x86_64'
args.stdlib_deployment_targets = ['iphonesimulator-arm64']

hsc = HostSpecificConfiguration('iphoneos-arm64', args)

self.assertEqual(len(hsc.sdks_to_configure), 1)
self.assertIn('IOS', hsc.sdks_to_configure)

self.assertEqual(len(hsc.swift_stdlib_build_targets), 0)

def generate_should_skip_building_platform(
host_target, sdk_name, build_target, build_arg_name):
def test(self):
Expand Down