mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[build-script] Add option to build lld as part of LLVM
This commit is contained in:
@@ -1833,17 +1833,9 @@ for host in "${ALL_HOSTS[@]}"; do
|
||||
llvm_enable_projects+=("clang-tools-extra")
|
||||
fi
|
||||
|
||||
# On non-Darwin platforms, build lld so we can always have a
|
||||
# linker that is compatible with the swift we are using to
|
||||
# compile the stdlib.
|
||||
#
|
||||
# This makes it easier to build target stdlibs on systems that
|
||||
# have old toolchains without more modern linker features.
|
||||
if [[ "$(uname -s)" != "Darwin" ]] ; then
|
||||
if [[ ! "${SKIP_BUILD_LLD}" ]]; then
|
||||
llvm_enable_projects+=("lld")
|
||||
fi
|
||||
fi
|
||||
|
||||
cmake_options+=(
|
||||
-DLLVM_ENABLE_PROJECTS="$(join ";" ${llvm_enable_projects[@]})"
|
||||
|
||||
@@ -721,6 +721,9 @@ def create_argument_parser():
|
||||
option(['--build-libparser-only'], toggle_true('build_libparser_only'),
|
||||
help='build only libParser for SwiftSyntax')
|
||||
|
||||
option(['--build-lld'], toggle_true('build_lld'),
|
||||
help='build lld as part of llvm')
|
||||
|
||||
option('--skip-build-clang-tools-extra',
|
||||
toggle_false('build_clang_tools_extra'),
|
||||
default=True,
|
||||
|
||||
@@ -71,6 +71,7 @@ EXPECTED_DEFAULTS = {
|
||||
'build_lldb': False,
|
||||
'build_libcxx': False,
|
||||
'build_ninja': False,
|
||||
'build_lld': False,
|
||||
'build_osx': True,
|
||||
'build_playgroundsupport': False,
|
||||
'build_runtime_with_host_compiler': False,
|
||||
@@ -531,6 +532,7 @@ EXPECTED_OPTIONS = [
|
||||
EnableOption('--android'),
|
||||
EnableOption('--build-external-benchmarks'),
|
||||
EnableOption('--build-ninja'),
|
||||
EnableOption('--build-lld'),
|
||||
EnableOption('--build-runtime-with-host-compiler'),
|
||||
EnableOption('--build-swift-dynamic-sdk-overlay'),
|
||||
EnableOption('--build-swift-dynamic-stdlib'),
|
||||
|
||||
@@ -427,6 +427,20 @@ class BuildScriptInvocation(object):
|
||||
"--llvm-install-components=%s" % args.llvm_install_components
|
||||
]
|
||||
|
||||
# On non-Darwin platforms, build lld so we can always have a
|
||||
# linker that is compatible with the swift we are using to
|
||||
# compile the stdlib.
|
||||
#
|
||||
# This makes it easier to build target stdlibs on systems that
|
||||
# have old toolchains without more modern linker features.
|
||||
#
|
||||
# On Darwin, only build lld if explicitly requested using --build-lld.
|
||||
should_build_lld = (platform.system() != 'Darwin' or args.build_lld)
|
||||
if not should_build_lld:
|
||||
impl_args += [
|
||||
"--skip-build-lld"
|
||||
]
|
||||
|
||||
if not args.clean_libdispatch:
|
||||
impl_args += [
|
||||
"--skip-clean-libdispatch"
|
||||
|
||||
9
validation-test/BuildSystem/build_lld.test
Normal file
9
validation-test/BuildSystem/build_lld.test
Normal file
@@ -0,0 +1,9 @@
|
||||
# RUN: %empty-directory(%t)
|
||||
# RUN: mkdir -p %t
|
||||
# RUN: SKIP_XCODE_VERSION_CHECK=1 SWIFT_BUILD_ROOT=%t %swift_src_root/utils/build-script --dry-run --build-lld 2>&1 | %FileCheck %s
|
||||
|
||||
# REQUIRES: standalone_build
|
||||
|
||||
# Check that lld is in LLVM_ENABLE_PROJECTS of the llvm-project/llvm build
|
||||
|
||||
# CHECK: '-DLLVM_ENABLE_PROJECTS={{[^']*}}lld{{[^']*}}'{{.*}}llvm-project/llvm{{$}}
|
||||
Reference in New Issue
Block a user