Skip to content

Resolve conflicts with upstream main #3611

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 55 commits into from
Sep 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
9a4572e
[NFC] Rename argNumber to avoid confusion with numArgs.
amritpan Aug 31, 2021
2667d3d
[CSSimplify] Add omitted projection name label as valid argument labe…
amritpan Sep 1, 2021
66d5e67
[Test] Add test for omitted projected value label.
amritpan Sep 1, 2021
e57ff02
[NFC] Replace similar if block in claimNextArgs with matchParameterLa…
amritpan Sep 1, 2021
998a787
[Sema] Add cancellation flag to typechecker options
ahoppen Aug 5, 2021
7a80034
[SourceKit] Support cancellation of requests while an AST is being built
ahoppen Aug 9, 2021
0adf067
[cxx-interop] A few misc. changes from #38675.
zoecarver Sep 23, 2021
be26554
Add a module alias option to frontend
elsh Sep 20, 2021
58a01c4
Use StringMap
elsh Sep 23, 2021
993a371
fix comment
elsh Sep 23, 2021
955f1a2
fix diag msg
elsh Sep 24, 2021
8a6ee37
Improve assert
elsh Sep 24, 2021
47ab4a9
AST: GenericSignatures point directly to their RequirementMachine
slavapestov Sep 28, 2021
5bbd126
Redo The Notes For "Uninhabited" Parameter Types
CodaFi Sep 28, 2021
4802c31
Add Tests for Parameters with Uninhabited Product Types
CodaFi Sep 28, 2021
02ec0cd
[SILOpt] Added experimental lexical lifetimes flag.
nate-chandler Sep 27, 2021
d97a24a
SILSROA: Propagate lexical flag on alloc_stacks.
nate-chandler Sep 22, 2021
cac03a6
[SIL] Let addArgumentToBranch accept plural args.
nate-chandler Sep 24, 2021
92a304b
[NFC] Fixed whitespace.
nate-chandler Sep 24, 2021
63192ba
[AllocBoxToStack] Make alloc_stacks lexical.
nate-chandler Sep 24, 2021
16cbae3
[SILMem2Reg] Added explanation to assert.
nate-chandler Sep 24, 2021
79bc4cb
[Mem2Reg] Lexical allocs create lexical borrows.
nate-chandler Sep 24, 2021
46063d3
Merge pull request #39476 from slavapestov/rqm-avoid-hashtable-lookup
slavapestov Sep 28, 2021
1df455b
Allow building a concurrent libSwiftConcurrency without libdispatch
rjmccall Sep 28, 2021
86a4e05
Merge pull request #39477 from CodaFi/tenancy-in-common
CodaFi Sep 28, 2021
f872d00
Merge pull request #39460 from nate-chandler/lexical_lifetimes/mem2reg
swift-ci Sep 28, 2021
94f4aca
Merge pull request #39480 from rjmccall/dispatchless-concurrency-builds
swift-ci Sep 28, 2021
f227643
[test] Add some constructor ranking test cases
hamishknight Sep 28, 2021
5c01efa
[test] Add a couple of IUO test cases
hamishknight Sep 28, 2021
a84833b
[test] Add AnyObject construction test case
hamishknight Sep 28, 2021
07cc404
[NFC] Tweaked doc for alloc_stack's lexical attr.
nate-chandler Sep 28, 2021
dcbba6e
Merge pull request #39481 from hamishknight/some-tests
hamishknight Sep 28, 2021
af71088
libswift: bootstrapping build
eeckstein Sep 23, 2021
f9b008e
Merge pull request #39484 from nate-chandler/lexical_lifetimes/alloc_…
swift-ci Sep 28, 2021
0e507f2
Revert "Allow building a concurrent libSwiftConcurrency without libdi…
benlangmuir Sep 28, 2021
d301f66
Merge pull request #39487 from apple/revert-39480-dispatchless-concur…
benlangmuir Sep 28, 2021
a4b4b1f
ClangImporter: don't import clang SPI attributes by default
nkcsgexi Sep 28, 2021
118b47c
Update symbol-visibility-linux.test-sh
compnerd Sep 28, 2021
a0f4484
RequirementMachine: Don't forget to delete requirement machines when …
slavapestov Sep 28, 2021
4521c99
Merge pull request #38782 from ahoppen/pr/sourcekit-cancellation
ahoppen Sep 28, 2021
f34e321
WebAssembly: add WASI cases to POSIXErrorCode enum (#39482)
MaxDesiatov Sep 28, 2021
14eefd1
Merge pull request #39376 from apple/es-mod-alias1
elsh Sep 28, 2021
1d427ea
AST: Add request to compute protocol structural requirements and depe…
slavapestov Aug 31, 2021
0343108
Merge pull request #39488 from nkcsgexi/enable-clang-spi
nkcsgexi Sep 28, 2021
603907a
Merge pull request #39489 from apple/compnerd/20.04-c++-ignorance
compnerd Sep 28, 2021
7812de8
Merge pull request #39490 from slavapestov/fix-rqm-memory-leak
slavapestov Sep 28, 2021
4871212
Merge pull request #39491 from slavapestov/structural-requirements
slavapestov Sep 28, 2021
e28f590
Removing undefined variables from mem2reg_lifetime.sil
etcwilde Sep 28, 2021
9bf9de8
Merge pull request #39188 from amritpan/projected-value-labels
hborla Sep 28, 2021
4432453
Merge pull request #39432 from zoecarver/lazy-pt4-misc-changes
zoecarver Sep 29, 2021
8252a56
Merge pull request #39498 from etcwilde/ewilde/remove-extra-filecheck…
shahmishal Sep 29, 2021
fc58596
Don't allow missing conformances from superclasses to block Sendable …
DougGregor Sep 29, 2021
36c2c83
Merge pull request #39500 from DougGregor/superclass-missing-sendable…
swift-ci Sep 29, 2021
510d66b
Merge pull request #39461 from eeckstein/libswift-bootstrapping
eeckstein Sep 29, 2021
f50ae11
Merge branch 'main' of github.com:apple/swift into maxd/main-merge
MaxDesiatov Sep 29, 2021
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
25 changes: 21 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
cmake_minimum_required(VERSION 3.19.6)


# set_property(GLOBAL PROPERTY GLOBAL_DEPENDS_DEBUG_MODE 1)

# TODO: Fix RPATH usage to be CMP0068 compliant
# Disable Policy CMP0068 for CMake 3.9
# rdar://37725888
Expand Down Expand Up @@ -196,9 +199,13 @@ set(SWIFT_TOOLS_ENABLE_LTO OFF CACHE STRING "Build Swift tools with LTO. One
no effect on the target libraries (the standard library and the runtime).")

# NOTE: We do not currently support building libswift with the Xcode generator.
cmake_dependent_option(SWIFT_TOOLS_ENABLE_LIBSWIFT
"Enable building libswift and linking libswift into the compiler itself." FALSE
"NOT CMAKE_GENERATOR STREQUAL \"Xcode\"" FALSE)
cmake_dependent_option(LIBSWIFT_BUILD_MODE "How to build libswift. Possible values are
OFF: the compiler is built without libswift
HOSTTOOLS: libswift is built with a pre-installed toolchain
BOOTSTRAPPING: libswift is built with a 2-stage bootstrapping process
BOOTSTRAPPING-WITH-HOSTLIBS: libswift is built with a 2-stage bootstrapping process,
but the compiler links against the host system swift libs (macOS only)"
OFF "NOT CMAKE_GENERATOR STREQUAL \"Xcode\"" OFF)

# The following only works with the Ninja generator in CMake >= 3.0.
set(SWIFT_PARALLEL_LINK_JOBS "" CACHE STRING
Expand Down Expand Up @@ -594,6 +601,13 @@ set(SWIFT_RUNTIME_OUTPUT_INTDIR "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin")
set(SWIFT_LIBRARY_OUTPUT_INTDIR "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib")
if("${SWIFT_NATIVE_SWIFT_TOOLS_PATH}" STREQUAL "")
set(SWIFT_NATIVE_SWIFT_TOOLS_PATH "${SWIFT_RUNTIME_OUTPUT_INTDIR}")
set(SWIFT_EXEC_FOR_LIBSWIFT "${CMAKE_Swift_COMPILER}")
elseif(LIBSWIFT_BUILD_MODE STREQUAL "BOOTSTRAPPING" OR LIBSWIFT_BUILD_MODE STREQUAL "BOOTSTRAPPING-WITH-HOSTLIBS")
# If cross-compiling we don't have to bootstrap. We can just use the previously
# built native swiftc to build libswift.
message(STATUS "Building libswift with native host tools instead of bootstrapping")
set(LIBSWIFT_BUILD_MODE "HOSTTOOLS")
set(SWIFT_EXEC_FOR_LIBSWIFT "${SWIFT_NATIVE_SWIFT_TOOLS_PATH}/swiftc")
endif()

# This setting causes all CMakeLists.txt to automatically have
Expand Down Expand Up @@ -938,7 +952,7 @@ if(SWIFT_INCLUDE_TOOLS)
message(STATUS " Build type: ${CMAKE_BUILD_TYPE}")
message(STATUS " Assertions: ${LLVM_ENABLE_ASSERTIONS}")
message(STATUS " LTO: ${SWIFT_TOOLS_ENABLE_LTO}")
message(STATUS " libswift: ${SWIFT_TOOLS_ENABLE_LIBSWIFT}")
message(STATUS " libswift: ${LIBSWIFT_BUILD_MODE}")
message(STATUS "")
else()
message(STATUS "Not building host Swift tools")
Expand Down Expand Up @@ -1045,6 +1059,9 @@ if(SWIFT_ENABLE_DISPATCH)
include(Libdispatch)
endif()

add_bootstrapping_target(0)
add_bootstrapping_target(1)

# Add all of the subdirectories, where we actually do work.

###############
Expand Down
219 changes: 153 additions & 66 deletions cmake/modules/AddSwift.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ function(add_swift_host_library name)

add_library(${name} ${libkind} ${ASHL_SOURCES})

if (ASHL_HAS_LIBSWIFT AND SWIFT_TOOLS_ENABLE_LIBSWIFT)
if (ASHL_HAS_LIBSWIFT AND LIBSWIFT_BUILD_MODE)
# Workaround for a linker crash related to autolinking: rdar://77839981
set_property(TARGET ${name} APPEND_STRING PROPERTY
LINK_FLAGS " -lobjc ")
Expand Down Expand Up @@ -724,8 +724,13 @@ endfunction()
# This is a temporary workaround until it's possible to compile libswift with
# cmake's builtin swift support.
function(add_libswift name)
cmake_parse_arguments(ALS
""
"BOOTSTRAPPING;SWIFT_EXEC;DEPENDS"
""
${ARGN})

set(libswift_compile_options
"-target" "x86_64-apple-macosx10.15" # TODO: remove this once #38675 lands.
"-Xfrontend" "-validate-tbd-against-ir=none"
"-Xfrontend" "-enable-cxx-interop")

Expand All @@ -735,10 +740,11 @@ function(add_libswift name)
list(APPEND libswift_compile_options "-O" "-cross-module-optimization")
endif()

set(build_dir ${CMAKE_CURRENT_BINARY_DIR})
get_bootstrapping_path(build_dir ${CMAKE_CURRENT_BINARY_DIR} "${ALS_BOOTSTRAPPING}")

if(SWIFT_HOST_VARIANT_SDK IN_LIST SWIFT_DARWIN_PLATFORMS)
set(deployment_version "${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_DEPLOYMENT_VERSION}")
set(deployment_version "10.15") # TODO: once #38675 lands, replace this with
# set(deployment_version "${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_DEPLOYMENT_VERSION}")
endif()
get_versioned_target_triple(target ${SWIFT_HOST_VARIANT_SDK}
${SWIFT_HOST_VARIANT_ARCH} "${deployment_version}")
Expand All @@ -750,10 +756,15 @@ function(add_libswift name)
get_target_property(module ${module_target} "module_name")
get_target_property(sources ${module_target} SOURCES)
get_target_property(dependencies ${module_target} "module_depends")
if(dependencies)
list(TRANSFORM dependencies PREPEND "LibSwift")
else()
set(dependencies "")
set(deps, "")
if (dependencies)
foreach(dep_module ${dependencies})
if (DEFINED "${dep_module}_dep_target")
list(APPEND deps "${${dep_module}_dep_target}")
else()
message(FATAL_ERROR "libswift module dependency ${module} -> ${dep_module} not found. Make sure to add modules in dependency order")
endif()
endforeach()
endif()

set(module_obj_file "${build_dir}/${module}.o")
Expand All @@ -765,8 +776,8 @@ function(add_libswift name)
# Compile the libswift module into an object file
add_custom_command_target(dep_target OUTPUT ${module_obj_file}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS ${sources} ${dependencies}
COMMAND ${CMAKE_Swift_COMPILER} "-c" "-o" ${module_obj_file}
DEPENDS ${sources} ${deps} ${ALS_DEPENDS}
COMMAND ${ALS_SWIFT_EXEC} "-c" "-o" ${module_obj_file}
"-sdk" "${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_ARCH_${SWIFT_HOST_VARIANT_ARCH}_PATH}"
"-target" ${target}
"-module-name" ${module} "-emit-module"
Expand All @@ -777,8 +788,7 @@ function(add_libswift name)
"-I" "${build_dir}"
COMMENT "Building libswift module ${module}")

add_dependencies(${module_target} ${dep_target})

set("${module}_dep_target" ${dep_target})
endforeach()

# Create a static libswift library containing all module object files.
Expand All @@ -794,9 +804,19 @@ macro(add_swift_lib_subdirectory name)
add_llvm_subdirectory(SWIFT LIB ${name})
endmacro()

function(_link_built_compatibility_libs executable)
set(platform ${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_LIB_SUBDIR})
target_link_directories(${executable} PRIVATE
${SWIFTLIB_DIR}/${platform})
add_dependencies(${executable}
"swiftCompatibility50-${platform}"
"swiftCompatibility51-${platform}"
"swiftCompatibilityDynamicReplacements-${platform}")
endfunction()

function(add_swift_host_tool executable)
set(options HAS_LIBSWIFT)
set(single_parameter_options SWIFT_COMPONENT)
set(single_parameter_options SWIFT_COMPONENT BOOTSTRAPPING)
set(multiple_parameter_options LLVM_LINK_COMPONENTS)

cmake_parse_arguments(ASHT
Expand Down Expand Up @@ -835,76 +855,119 @@ function(add_swift_host_tool executable)
add_dependencies(${executable} ${LLVM_COMMON_DEPENDS})
endif()

if(NOT ${ASHT_BOOTSTRAPPING} STREQUAL "")
# Strip the "-bootstrapping<n>" suffix from the target name to get the base
# executable name.
string(REGEX REPLACE "-bootstrapping.*" "" executable_filename ${executable})
set_target_properties(${executable}
PROPERTIES OUTPUT_NAME ${executable_filename})
endif()

set_target_properties(${executable} PROPERTIES
FOLDER "Swift executables")
if(SWIFT_PARALLEL_LINK_JOBS)
set_target_properties(${executable} PROPERTIES
JOB_POOL_LINK swift_link_job_pool)
endif()
if(${SWIFT_HOST_VARIANT_SDK} IN_LIST SWIFT_DARWIN_PLATFORMS)

# Lists of rpaths that we are going to add to our executables.
#
# Please add each rpath separately below to the list, explaining why you are
# adding it.
set(RPATH_LIST)

# If we found a swift compiler and are going to use swift code in swift
# host side tools but link with clang, add the appropriate -L paths so we
# find all of the necessary swift libraries on Darwin.
if (CMAKE_Swift_COMPILER)
# Add in the toolchain directory so we can grab compatibility libraries
get_filename_component(TOOLCHAIN_BIN_DIR ${CMAKE_Swift_COMPILER} DIRECTORY)
get_filename_component(TOOLCHAIN_LIB_DIR "${TOOLCHAIN_BIN_DIR}/../lib/swift/macosx" ABSOLUTE)
target_link_directories(${executable} PUBLIC ${TOOLCHAIN_LIB_DIR})
if (ASHT_HAS_LIBSWIFT AND LIBSWIFT_BUILD_MODE)

if(LIBSWIFT_BUILD_MODE STREQUAL "HOSTTOOLS")
# Add in the toolchain directory so we can grab compatibility libraries
get_filename_component(TOOLCHAIN_BIN_DIR ${SWIFT_EXEC_FOR_LIBSWIFT} DIRECTORY)
get_filename_component(TOOLCHAIN_LIB_DIR "${TOOLCHAIN_BIN_DIR}/../lib/swift/macosx" ABSOLUTE)
target_link_directories(${executable} PUBLIC ${TOOLCHAIN_LIB_DIR})

# Add in the SDK directory for the host platform.
target_link_directories(${executable} PRIVATE
${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_ARCH_${SWIFT_HOST_VARIANT_ARCH}_PATH}/usr/lib/swift)

# Include the abi stable system stdlib in our rpath.
list(APPEND RPATH_LIST "/usr/lib/swift")

elseif(LIBSWIFT_BUILD_MODE STREQUAL "BOOTSTRAPPING-WITH-HOSTLIBS")
# Pick up the built libswiftCompatibility<n>.a libraries
_link_built_compatibility_libs(${executable})

# Add in the SDK directory for the host platform.
target_link_directories(${executable} PRIVATE
${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_ARCH_${SWIFT_HOST_VARIANT_ARCH}_PATH}/usr/lib/swift)

# Add in the SDK directory for the host platform and add an rpath.
# Include the abi stable system stdlib in our rpath.
list(APPEND RPATH_LIST "/usr/lib/swift")

elseif(LIBSWIFT_BUILD_MODE STREQUAL "BOOTSTRAPPING")
# Pick up the built libswiftCompatibility<n>.a libraries
_link_built_compatibility_libs(${executable})

# At build time link against the built swift libraries from the
# previous bootstrapping stage.
get_bootstrapping_swift_lib_dir(bs_lib_dir "${bootstrapping}")
target_link_directories(${executable} PRIVATE ${bs_lib_dir})

# At runtime link against the built swift libraries from the current
# bootstrapping stage.
list(APPEND RPATH_LIST "@executable_path/../lib/swift/${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_LIB_SUBDIR}")
else()
message(FATAL_ERROR "Unknown LIBSWIFT_BUILD_MODE '${LIBSWIFT_BUILD_MODE}'")
endif()

# Workaround to make lldb happy: we have to explicitly add all libswift modules
# to the linker command line.
set(libswift_ast_path_flags "-Wl")
get_property(modules GLOBAL PROPERTY "libswift_modules")
foreach(module ${modules})
get_target_property(module_file "LibSwift${module}" "module_file")
string(APPEND libswift_ast_path_flags ",-add_ast_path,${module_file}")
endforeach()

set_property(TARGET ${executable} APPEND_STRING PROPERTY
LINK_FLAGS ${libswift_ast_path_flags})

# Workaround for a linker crash related to autolinking: rdar://77839981
set_property(TARGET ${executable} APPEND_STRING PROPERTY
LINK_FLAGS " -lobjc ")

else() # ASHT_HAS_LIBSWIFT AND LIBSWIFT_BUILD_MODE

# TODO: do we really need this? Do any tools which don't link libswift include other swift code?

# Add in the SDK directory for the host platform.
#
# NOTE: We do this /after/ target_link_directorying TOOLCHAIN_LIB_DIR to
# ensure that we first find libraries from the toolchain, rather than from
# the SDK. The reason why this is important is that when we perform a
# stage2 build, this path is into the stage1 build. This is not a pure SDK
# and also contains compatibility libraries. We need to make sure that the
# compiler sees the actual toolchain's compatibility libraries first
# before the just built compability libraries or build errors occur.
# the SDK.
target_link_directories(${executable} PRIVATE
${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_ARCH_${SWIFT_HOST_VARIANT_ARCH}_PATH}/usr/lib/swift)

if (ASHT_HAS_LIBSWIFT AND SWIFT_TOOLS_ENABLE_LIBSWIFT)
# Workaround to make lldb happy: we have to explicitly add all libswift modules
# to the linker command line.
set(libswift_ast_path_flags "-Wl")
get_property(modules GLOBAL PROPERTY "libswift_modules")
foreach(module ${modules})
get_target_property(module_file "LibSwift${module}" "module_file")
string(APPEND libswift_ast_path_flags ",-add_ast_path,${module_file}")
endforeach()

set_property(TARGET ${executable} APPEND_STRING PROPERTY
LINK_FLAGS ${libswift_ast_path_flags})

# Workaround for a linker crash related to autolinking: rdar://77839981
set_property(TARGET ${executable} APPEND_STRING PROPERTY
LINK_FLAGS " -lobjc ")
endif()
endif()
# We also want to be able to find libraries from the base toolchain
# directory. This is so swiftc can rely on its own host side dylibs that may
# contain swift content.
list(APPEND RPATH_LIST "@executable_path/../lib")

# Lists of rpaths that we are going to add to our executables.
#
# Please add each rpath separately below to the list, explaining why you are
# adding it.
set(RPATH_LIST)

# We also want to be able to find libraries from the base toolchain
# directory. This is so swiftc can rely on its own host side dylibs that may
# contain swift content.
list(APPEND RPATH_LIST "@executable_path/../lib")

# Also include the abi stable system stdlib in our rpath.
list(APPEND RPATH_LIST "/usr/lib/swift")
# Also include the abi stable system stdlib in our rpath.
list(APPEND RPATH_LIST "/usr/lib/swift")
endif()

set_target_properties(${executable} PROPERTIES
BUILD_WITH_INSTALL_RPATH YES
INSTALL_RPATH "${RPATH_LIST}")

elseif(SWIFT_HOST_VARIANT_SDK STREQUAL "LINUX")
if (ASHT_HAS_LIBSWIFT AND SWIFT_TOOLS_ENABLE_LIBSWIFT)
elseif(SWIFT_HOST_VARIANT_SDK STREQUAL "LINUX" AND ASHT_HAS_LIBSWIFT AND LIBSWIFT_BUILD_MODE)
if(LIBSWIFT_BUILD_MODE STREQUAL "HOSTTOOLS")
# At build time and and run time, link against the swift libraries in the
# installed host toolchain.
get_filename_component(swift_bin_dir ${CMAKE_Swift_COMPILER} DIRECTORY)
get_filename_component(swift_bin_dir ${SWIFT_EXEC_FOR_LIBSWIFT} DIRECTORY)
get_filename_component(swift_dir ${swift_bin_dir} DIRECTORY)
set(host_lib_dir "${swift_dir}/lib/swift/linux")

Expand All @@ -914,14 +977,36 @@ function(add_swift_host_tool executable)
set_target_properties(${executable} PROPERTIES
BUILD_WITH_INSTALL_RPATH YES
INSTALL_RPATH "${host_lib_dir}")

elseif(LIBSWIFT_BUILD_MODE STREQUAL "BOOTSTRAPPING")
# At build time link against the built swift libraries from the
# previous bootstrapping stage.
get_bootstrapping_swift_lib_dir(bs_lib_dir "${bootstrapping}")
target_link_directories(${executable} PRIVATE ${bs_lib_dir})

# At runtime link against the built swift libraries from the current
# bootstrapping stage.
set_target_properties(${executable} PROPERTIES
BUILD_WITH_INSTALL_RPATH YES
INSTALL_RPATH "$ORIGIN/../lib/swift/${SWIFT_SDK_LINUX_LIB_SUBDIR}")

elseif(LIBSWIFT_BUILD_MODE STREQUAL "BOOTSTRAPPING-WITH-HOSTLIBS")
message(FATAL_ERROR "LIBSWIFT_BUILD_MODE 'BOOTSTRAPPING-WITH-HOSTLIBS' not supported on Linux")
else()
message(FATAL_ERROR "Unknown LIBSWIFT_BUILD_MODE '${LIBSWIFT_BUILD_MODE}'")
endif()
endif()

llvm_update_compile_flags(${executable})
swift_common_llvm_config(${executable} ${ASHT_LLVM_LINK_COMPONENTS})

get_bootstrapping_path(out_bin_dir
${SWIFT_RUNTIME_OUTPUT_INTDIR} "${ASHT_BOOTSTRAPPING}")
get_bootstrapping_path(out_lib_dir
${SWIFT_LIBRARY_OUTPUT_INTDIR} "${ASHT_BOOTSTRAPPING}")
set_output_directory(${executable}
BINARY_DIR ${SWIFT_RUNTIME_OUTPUT_INTDIR}
LIBRARY_DIR ${SWIFT_LIBRARY_OUTPUT_INTDIR})
BINARY_DIR ${out_bin_dir}
LIBRARY_DIR ${out_lib_dir})

if(SWIFT_HOST_VARIANT_SDK STREQUAL WINDOWS)
swift_windows_include_for_arch(${SWIFT_HOST_VARIANT_ARCH}
Expand All @@ -940,13 +1025,15 @@ function(add_swift_host_tool executable)
endif()
endif()

add_dependencies(${ASHT_SWIFT_COMPONENT} ${executable})
swift_install_in_component(TARGETS ${executable}
RUNTIME
DESTINATION bin
COMPONENT ${ASHT_SWIFT_COMPONENT})
if(NOT ${ASHT_SWIFT_COMPONENT} STREQUAL "no_component")
add_dependencies(${ASHT_SWIFT_COMPONENT} ${executable})
swift_install_in_component(TARGETS ${executable}
RUNTIME
DESTINATION bin
COMPONENT ${ASHT_SWIFT_COMPONENT})

swift_is_installing_component(${ASHT_SWIFT_COMPONENT} is_installing)
swift_is_installing_component(${ASHT_SWIFT_COMPONENT} is_installing)
endif()

if(NOT is_installing)
set_property(GLOBAL APPEND PROPERTY SWIFT_BUILDTREE_EXPORTS ${executable})
Expand Down
Loading