Skip to content

Commit e916e9e

Browse files
authored
[CMake] Give a dedicated component to compiler swift-syntax libraries (#76497)
* [CMake] Give a dedicated component to compiler swift-syntax libraries 'compiler-swift-syntax-lib' so projects statically link to compiler libraries (libAST etc) can use the required shared libraries. rdar://135923606 * Update cmake caches * Add back implicit `swift-syntax-lib` to `compiler` component for now Some clients doesn't specify `swift-syntax-lib`.
1 parent 4d920f0 commit e916e9e

File tree

5 files changed

+15
-4
lines changed

5 files changed

+15
-4
lines changed

cmake/caches/Linux-x86_64.cmake

+2
Original file line numberDiff line numberDiff line change
@@ -142,12 +142,14 @@ set(LLDB_TOOLS
142142
set(SWIFT_INSTALL_COMPONENTS
143143
autolink-driver
144144
compiler
145+
compiler-swift-syntax-lib
145146
clang-builtin-headers
146147
editor-integration
147148
tools
148149
sourcekit-inproc
149150
swift-remote-mirror
150151
swift-remote-mirror-headers
152+
swift-syntax-lib
151153
CACHE STRING "")
152154

153155
set(LLVM_DISTRIBUTION_COMPONENTS

cmake/caches/Windows-aarch64.cmake

+1
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ set(LLDB_TOOLS
149149
set(SWIFT_INSTALL_COMPONENTS
150150
autolink-driver
151151
compiler
152+
compiler-swift-syntax-lib
152153
clang-builtin-headers
153154
editor-integration
154155
tools

cmake/caches/Windows-x86_64.cmake

+1
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ set(LLDB_TOOLS
189189
set(SWIFT_INSTALL_COMPONENTS
190190
autolink-driver
191191
compiler
192+
compiler-swift-syntax-lib
192193
clang-builtin-headers
193194
editor-integration
194195
tools

cmake/modules/SwiftComponents.cmake

+8-1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
# * autolink-driver -- the Swift driver support tools
4949
# * back-deployment -- Swift back-deployment libraries
5050
# * compiler -- the Swift compiler and (on supported platforms) the REPL.
51+
# * compiler-swift-syntax-lib -- install swift-syntax libraries for the compiler.
5152
# * clang-builtin-headers -- install a copy of Clang builtin headers under
5253
# 'lib/swift/clang'. This is useful when Swift compiler is installed in
5354
# isolation.
@@ -70,7 +71,7 @@
7071
# * llvm-toolchain-dev-tools -- install LLVM development tools useful in a shared toolchain
7172
# * dev -- headers and libraries required to use Swift compiler as a library.
7273
set(_SWIFT_DEFINED_COMPONENTS
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")
74+
"autolink-driver;back-deployment;compiler;compiler-swift-syntax-lib;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")
7475

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

101+
# 'compiler' depends on 'compiler-swift-syntax-lib' component.
102+
if ("compiler" IN_LIST SWIFT_INSTALL_COMPONENTS AND
103+
NOT "compiler-swift-syntax-lib" IN_LIST SWIFT_INSTALL_COMPONENTS)
104+
list(APPEND SWIFT_INSTALL_COMPONENTS "compiler-swift-syntax-lib")
105+
endif()
100106
# 'compiler' depends on 'swift-syntax-lib' component.
107+
# FIXME: Remove this. Clients should specify the components explicitly.
101108
if ("compiler" IN_LIST SWIFT_INSTALL_COMPONENTS AND
102109
NOT "swift-syntax-lib" IN_LIST SWIFT_INSTALL_COMPONENTS)
103110
list(APPEND SWIFT_INSTALL_COMPONENTS "swift-syntax-lib")

lib/CompilerSwiftSyntax/CMakeLists.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,6 @@ foreach(lib ${compiler_swiftsyntax_libs})
5252
endforeach()
5353

5454
swift_install_in_component(TARGETS ${compiler_swiftsyntax_libs}
55-
ARCHIVE DESTINATION "lib${LLVM_LIBDIR_SUFFIX}/swift/host/compiler" COMPONENT compiler
56-
LIBRARY DESTINATION "lib${LLVM_LIBDIR_SUFFIX}/swift/host/compiler" COMPONENT compiler
57-
RUNTIME DESTINATION "bin" COMPONENT compiler)
55+
ARCHIVE DESTINATION "lib${LLVM_LIBDIR_SUFFIX}/swift/host/compiler" COMPONENT compiler-swift-syntax-lib
56+
LIBRARY DESTINATION "lib${LLVM_LIBDIR_SUFFIX}/swift/host/compiler" COMPONENT compiler-swift-syntax-lib
57+
RUNTIME DESTINATION "bin" COMPONENT compiler-swift-syntax-lib)

0 commit comments

Comments
 (0)