Skip to content

[CMake] Give a dedicated component to compiler swift-syntax libraries #76497

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
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions cmake/caches/Linux-x86_64.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,14 @@ set(LLDB_TOOLS
set(SWIFT_INSTALL_COMPONENTS
autolink-driver
compiler
compiler-swift-syntax-lib
clang-builtin-headers
editor-integration
tools
sourcekit-inproc
swift-remote-mirror
swift-remote-mirror-headers
swift-syntax-lib
CACHE STRING "")

set(LLVM_DISTRIBUTION_COMPONENTS
Expand Down
1 change: 1 addition & 0 deletions cmake/caches/Windows-aarch64.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ set(LLDB_TOOLS
set(SWIFT_INSTALL_COMPONENTS
autolink-driver
compiler
compiler-swift-syntax-lib
clang-builtin-headers
editor-integration
tools
Expand Down
1 change: 1 addition & 0 deletions cmake/caches/Windows-x86_64.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ set(LLDB_TOOLS
set(SWIFT_INSTALL_COMPONENTS
autolink-driver
compiler
compiler-swift-syntax-lib
clang-builtin-headers
editor-integration
tools
Expand Down
9 changes: 8 additions & 1 deletion cmake/modules/SwiftComponents.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
# * autolink-driver -- the Swift driver support tools
# * back-deployment -- Swift back-deployment libraries
# * compiler -- the Swift compiler and (on supported platforms) the REPL.
# * compiler-swift-syntax-lib -- install swift-syntax libraries for the compiler.
# * clang-builtin-headers -- install a copy of Clang builtin headers under
# 'lib/swift/clang'. This is useful when Swift compiler is installed in
# isolation.
Expand All @@ -70,7 +71,7 @@
# * llvm-toolchain-dev-tools -- install LLVM development tools useful in a shared toolchain
# * dev -- headers and libraries required to use Swift compiler as a library.
set(_SWIFT_DEFINED_COMPONENTS
"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")
"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")

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

# 'compiler' depends on 'compiler-swift-syntax-lib' component.
if ("compiler" IN_LIST SWIFT_INSTALL_COMPONENTS AND
NOT "compiler-swift-syntax-lib" IN_LIST SWIFT_INSTALL_COMPONENTS)
list(APPEND SWIFT_INSTALL_COMPONENTS "compiler-swift-syntax-lib")
endif()
# 'compiler' depends on 'swift-syntax-lib' component.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess theoretically this could have been removed when we did the split 😅?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I totally forgot about this.

# FIXME: Remove this. Clients should specify the components explicitly.
if ("compiler" IN_LIST SWIFT_INSTALL_COMPONENTS AND
NOT "swift-syntax-lib" IN_LIST SWIFT_INSTALL_COMPONENTS)
list(APPEND SWIFT_INSTALL_COMPONENTS "swift-syntax-lib")
Expand Down
6 changes: 3 additions & 3 deletions lib/CompilerSwiftSyntax/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,6 @@ foreach(lib ${compiler_swiftsyntax_libs})
endforeach()

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