mirror of
https://github.com/apple/sourcekit-lsp.git
synced 2026-03-02 18:23:24 +01:00
This adjusts the sourcekit-lsp build to use static linking for the
internal libraries. It is not currently possible to build
SourceKitLSP.dll as that requires re-exporting the interfaces from the
consumed modules. However, this allows us to reduce the overall size of
the distribution of SourceKit-LSP by ~1 MiB and reduces the
distributed file set. The values here assume partial static linking of
swift-package-manager, which helps reduce the total size.
Before:
228,352 BuildServerProtocol.dll
1,773,056 LanguageServerProtocol.dll
114,688 LanguageServerProtocolJSONRPC.dll
49,152 LSPLogging.dll
262,656 SKCore.dll
54,784 SKSupport.dll
80,896 SKSwiftPMWorkspace.dll
150,528 SourceKitD.dll
645,632 SourceKitLSP.dll
70,144 sourcekit-lsp.exe
3,429,888 bytes
After:
2,416,640 sourcekit-lsp.exe
2,416,640 bytes
14 lines
527 B
CMake
14 lines
527 B
CMake
add_library(LanguageServerProtocolJSONRPC STATIC
|
|
DisableSigpipe.swift
|
|
JSONRPCConnection.swift
|
|
MessageCoding.swift
|
|
MessageSplitting.swift)
|
|
set_target_properties(LanguageServerProtocolJSONRPC PROPERTIES
|
|
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY})
|
|
target_link_libraries(LanguageServerProtocolJSONRPC PRIVATE
|
|
LanguageServerProtocol
|
|
LSPLogging)
|
|
target_link_libraries(LanguageServerProtocolJSONRPC PRIVATE
|
|
$<$<NOT:$<PLATFORM_ID:Darwin>>:swiftDispatch>
|
|
$<$<NOT:$<PLATFORM_ID:Darwin>>:Foundation>)
|