Skip to content

Commit 7fdbbf4

Browse files
committed
[build-script] Cross-compile sourcekit-lsp for arm64
Currently, when building an open source toolchain, SourceKit-LSP is only built for x86_64. Copy the cross-compilation config from swiftpm.py to also produce a fat sourcekit-lsp executable for both x86_64 and arm64. rdar://78039145
1 parent 997ace4 commit 7fdbbf4

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

utils/swift_build_support/swift_build_support/products/indexstoredb.py

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -105,18 +105,24 @@ def run_build_script_helper(action, host_target, product, args,
105105
elif args.enable_tsan:
106106
helper_cmd.extend(['--sanitize', 'thread'])
107107

108-
if not product.is_darwin_host(
109-
host_target) and product.is_cross_compile_target(host_target):
110-
helper_cmd.extend(['--cross-compile-host', host_target])
111-
build_toolchain_path = install_destdir + args.install_prefix
112-
resource_dir = '%s/lib/swift' % build_toolchain_path
113-
helper_cmd += [
114-
'--cross-compile-config',
115-
targets.StdlibDeploymentTarget.get_target_for_name(host_target).platform
116-
.swiftpm_config(args, output_dir=build_toolchain_path,
117-
swift_toolchain=toolchain_path,
118-
resource_path=resource_dir)
119-
]
108+
# Pass Cross compile host info
109+
if product.has_cross_compile_hosts(args):
110+
if product.is_darwin_host(host_target):
111+
helper_cmd += ['--cross-compile-hosts']
112+
for cross_compile_host in args.cross_compile_hosts:
113+
helper_cmd += [cross_compile_host]
114+
elif product.is_cross_compile_target(host_target):
115+
helper_cmd += ['--cross-compile-hosts', host_target,
116+
'--skip-cmake-bootstrap']
117+
build_toolchain_path = product.host_install_destdir(
118+
host_target) + args.install_prefix
119+
resource_dir = '%s/lib/swift' % build_toolchain_path
120+
helper_cmd += [
121+
'--cross-compile-config',
122+
targets.StdlibDeploymentTarget.get_target_for_name(host_target).platform
123+
.swiftpm_config(args, output_dir=build_toolchain_path,
124+
swift_toolchain=toolchain_path,
125+
resource_path=resource_dir)]
120126

121127
if action == 'install' and product.product_name() == "sourcekitlsp":
122128
helper_cmd.extend([

0 commit comments

Comments
 (0)