Skip to content

[SR-1639][SourceKit] Link SwiftLang libraries to sourcekitd #2766

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
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
5 changes: 4 additions & 1 deletion tools/SourceKit/tools/sourcekitd/lib/API/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,8 @@ endif()

add_sourcekit_library(sourcekitdAPI
${sourcekitdAPI_sources}
DEPENDS SourceKitSupport
DEPENDS
SourceKitSupport SourceKitSwiftLang
# Clang dependencies, required by SourceKitSwiftLang
clangFormat clangToolingCore clangDriver
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if there's a way with CMake to link SourceKitSwiftLang such that its own dependencies don't need to be listed again here? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I wondered that as well. I was surprised I had to do this, to be honest. Maybe @llvm-beanz would know?

Copy link
Contributor

Choose a reason for hiding this comment

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

You shouldn't have to do this. CMake understands transitive dependencies between static archives, it should do the right thing.

I suspect this is caused by the way Swift builds out-of-tree with LLVM & Clang. My "stab in the dark" here is that it handles static libraries specified by full path differently than libraries that are specified by target.

I wonder if this could be fixed in a minimally invasive way by having Swift include the CMake Exports lists from Clang and LLVM. Then the LLVM and Clang targets would be exposed more cleanly in Swift's build.

Copy link
Contributor

Choose a reason for hiding this comment

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

We are already using the LLVM exports list. I am going to be looking into doing the Clang side of it in a bit. It is causing us problems on master-next.

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you elaborate on the problem? Including LLVMExports.cmake and ClangTargets.cmake should setup all the transitive dependencies correctly.

)