From c8e36f66f504c93524af00542f78e792574e6ca9 Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Wed, 6 Sep 2023 19:31:19 -0700 Subject: [PATCH] build: fix the build of the toolchain This wires up the new macro properly into the build machinery to ensure that the `distribution` target properly builds and installs the dependencies. This fixes the missing `swift-plugin-server` on Windows. --- cmake/modules/AddPureSwift.cmake | 19 ++++++++++++++++--- tools/swift-plugin-server/CMakeLists.txt | 7 ++----- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/cmake/modules/AddPureSwift.cmake b/cmake/modules/AddPureSwift.cmake index 1d79a945cc982..6c79fdcf351ce 100644 --- a/cmake/modules/AddPureSwift.cmake +++ b/cmake/modules/AddPureSwift.cmake @@ -269,7 +269,8 @@ function(add_pure_swift_host_tool name) # Option handling set(options) - set(single_parameter_options) + set(single_parameter_options + SWIFT_COMPONENT) set(multiple_parameter_options DEPENDENCIES SWIFT_DEPENDENCIES) @@ -341,6 +342,18 @@ function(add_pure_swift_host_tool name) COMMAND "${CMAKE_COMMAND}" -E touch "${CMAKE_CURRENT_BINARY_DIR}/${name}.swiftmodule" COMMAND_EXPAND_LISTS COMMENT "Update mtime of executable outputs workaround") - # Export this target. - set_property(GLOBAL APPEND PROPERTY SWIFT_EXPORTS ${name}) + + if(NOT APSHT_SWIFT_COMPONENT STREQUAL no_component) + add_dependencies(${APSHT_SWIFT_COMPONENT} ${name}) + swift_install_in_component(TARGETS ${name} + COMPONENT ${APSHT_SWIFT_COMPONENT} + RUNTIME DESTINATION bin) + swift_is_installing_component(${APSHT_SWIFT_COMPONENT} is_installing) + endif() + + if(NOT is_installing) + set_property(GLOBAL APPEND PROPERTY SWIFT_BUILDTREE_EXPORTS ${name}) + else() + set_property(GLOBAL APPEND PROPERTY SWIFT_EXPORTS ${name}) + endif() endfunction() diff --git a/tools/swift-plugin-server/CMakeLists.txt b/tools/swift-plugin-server/CMakeLists.txt index 09332309b10c9..1d1b88b22bd8a 100644 --- a/tools/swift-plugin-server/CMakeLists.txt +++ b/tools/swift-plugin-server/CMakeLists.txt @@ -16,6 +16,8 @@ if (SWIFT_SWIFT_PARSER) DEPENDENCIES swiftDemangling $ + SWIFT_COMPONENT + compiler SWIFT_DEPENDENCIES SwiftSyntax::SwiftSyntaxMacros SwiftSyntax::SwiftSyntaxMacroExpansion @@ -25,9 +27,4 @@ if (SWIFT_SWIFT_PARSER) target_include_directories(swift-plugin-server PRIVATE Sources/CSwiftPluginServer/include ) - swift_install_in_component(TARGETS swift-plugin-server - RUNTIME - DESTINATION bin - COMPONENT compiler - ) endif()