Skip to content

Commit 89b217a

Browse files
committed
[CMake] Introduce 'swift-syntax-lib' install component
So that swift-syntax host libraries can be installed independently.
1 parent 53053d1 commit 89b217a

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

cmake/modules/SwiftComponents.cmake

+8-1
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,12 @@
6565
# * toolchain-tools -- a subset of tools that we will install to the OSS toolchain.
6666
# * testsuite-tools -- extra tools required to run the Swift testsuite.
6767
# * static-mirror-lib -- Build the static mirror library used by SwiftStaticMirror.
68+
# * swift-syntax-lib -- install swift-syntax libraries
6869
# * toolchain-dev-tools -- install development tools useful in a shared toolchain
6970
# * llvm-toolchain-dev-tools -- install LLVM development tools useful in a shared toolchain
7071
# * dev -- headers and libraries required to use Swift compiler as a library.
7172
set(_SWIFT_DEFINED_COMPONENTS
72-
"autolink-driver;back-deployment;compiler;clang-builtin-headers;clang-resource-dir-symlink;clang-builtin-headers-in-clang-resource-dir;libexec;stdlib;stdlib-experimental;sdk-overlay;static-mirror-lib;editor-integration;tools;testsuite-tools;toolchain-tools;toolchain-dev-tools;llvm-toolchain-dev-tools;dev;license;sourcekit-xpc-service;sourcekit-inproc;swift-remote-mirror;swift-remote-mirror-headers")
73+
"autolink-driver;back-deployment;compiler;clang-builtin-headers;clang-resource-dir-symlink;clang-builtin-headers-in-clang-resource-dir;libexec;stdlib;stdlib-experimental;sdk-overlay;static-mirror-lib;swift-syntax-lib;editor-integration;tools;testsuite-tools;toolchain-tools;toolchain-dev-tools;llvm-toolchain-dev-tools;dev;license;sourcekit-xpc-service;sourcekit-inproc;swift-remote-mirror;swift-remote-mirror-headers")
7374

7475
# The default install components include all of the defined components, except
7576
# for the following exceptions.
@@ -96,6 +97,12 @@ macro(swift_configure_components)
9697
set(SWIFT_INSTALL_COMPONENTS "${_SWIFT_DEFAULT_COMPONENTS}" CACHE STRING
9798
"A semicolon-separated list of components to install from the set ${_SWIFT_DEFINED_COMPONENTS}")
9899

100+
# 'compiler' depends on 'swift-syntax-lib' component.
101+
if ("compiler" IN_LIST SWIFT_INSTALL_COMPONENTS AND
102+
NOT "swift-syntax-lib" IN_LIST SWIFT_INSTALL_COMPONENTS)
103+
list(APPEND SWIFT_INSTALL_COMPONENTS "swift-syntax-lib")
104+
endif()
105+
99106
foreach(component ${_SWIFT_DEFINED_COMPONENTS})
100107
add_custom_target(${component})
101108
add_llvm_install_targets(install-${component}

lib/CMakeLists.txt

+8-4
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,17 @@ if (SWIFT_BUILD_SWIFT_SYNTAX)
2727
SwiftCompilerPluginMessageHandling
2828
)
2929

30+
# Install shared runtime libraries
3031
if(CMAKE_SYSTEM_NAME MATCHES Windows)
3132
swift_install_in_component(TARGETS ${SWIFT_SYNTAX_MODULES}
33+
RUNTIME
3234
DESTINATION "bin"
33-
COMPONENT compiler)
35+
COMPONENT swift-syntax-lib)
3436
else()
3537
swift_install_in_component(TARGETS ${SWIFT_SYNTAX_MODULES}
38+
LIBRARY
3639
DESTINATION "lib${LLVM_LIBDIR_SUFFIX}/swift/host"
37-
COMPONENT compiler)
40+
COMPONENT swift-syntax-lib)
3841
endif()
3942

4043
# Install import libraries in Windows.
@@ -50,15 +53,16 @@ if (SWIFT_BUILD_SWIFT_SYNTAX)
5053
OUTPUT_VARIABLE SWIFT_SYNTAX_IMPORT_LIBRARIES)
5154
swift_install_in_component(PROGRAMS "${SWIFT_SYNTAX_IMPORT_LIBRARIES}"
5255
DESTINATION lib
53-
COMPONENT compiler)
56+
COMPONENT swift-syntax-lib)
5457
endif()
5558

59+
# Install Swift module interface files.
5660
foreach(module ${SWIFT_SYNTAX_MODULES})
5761
set(module_dir "${module}.swiftmodule")
5862
set(module_file "${SWIFT_HOST_LIBRARIES_DEST_DIR}/${module_dir}/${SWIFT_HOST_MODULE_TRIPLE}.swiftinterface")
5963
swift_install_in_component(FILES "${module_file}"
6064
DESTINATION "lib${LLVM_LIBDIR_SUFFIX}/swift/host/${module_dir}"
61-
COMPONENT compiler)
65+
COMPONENT swift-syntax-lib)
6266
endforeach()
6367
endif()
6468

0 commit comments

Comments
 (0)