mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
cmake: add support for bootstrapping with swiftly
For hosts that have a swiftly-managed Swift compiler, we could not bootstrap using those tools, because of some hardcoded assumptions about where the `/lib` directory lives, relative to the `/bin` directory that contains the detected `swiftc`. This patch adds specific support for detecting when the `swiftc` is coming from a swiftly install and uses the correct paths. I've tested this patch on my Linux machine that has swiftly 1.0.1, with the Swift 6.1.2 toolchain.
This commit is contained in:
@@ -111,6 +111,19 @@ function(add_sourcekit_swift_runtime_link_flags target path HAS_SWIFT_MODULES)
|
||||
# installed host toolchain.
|
||||
get_filename_component(swift_bin_dir ${SWIFT_EXEC_FOR_SWIFT_MODULES} DIRECTORY)
|
||||
get_filename_component(swift_dir ${swift_bin_dir} DIRECTORY)
|
||||
|
||||
# Detect and handle swiftly-managed hosts.
|
||||
if(swift_bin_dir MATCHES ".*/swiftly/bin")
|
||||
execute_process(COMMAND swiftly use --print-location
|
||||
OUTPUT_VARIABLE swiftly_dir
|
||||
ERROR_VARIABLE err)
|
||||
if(err)
|
||||
message(SEND_ERROR "Failed to find swiftly Swift compiler")
|
||||
endif()
|
||||
string(STRIP "${swiftly_dir}" swiftly_dir)
|
||||
set(swift_dir "${swiftly_dir}/usr")
|
||||
endif()
|
||||
|
||||
set(host_lib_dir "${swift_dir}/lib/swift/${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_LIB_SUBDIR}")
|
||||
else()
|
||||
set(host_lib_dir "${SWIFTLIB_DIR}/${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_LIB_SUBDIR}")
|
||||
|
||||
Reference in New Issue
Block a user