Skip to content

Commit c28f5af

Browse files
committed
build: selectively apply some static linking
Convert a few libraries to static linking. This results in a net size reduction for the toolchain as a whole while also reducing the distributed DLLs. PackageModelSyntax Conversion: ~~~ Before: 6621696 sourcekit-lsp.exe 3844608 Commands.dll 144384 PackageModelSyntax.dll ------- 10610688 After: 6712320 sourcekit-lsp.exe 3950592 Commands.dll -------- 10662912 ~~~ Savings: 52,224 bytes SwiftSDKCommand Conversion: ~~~ Before: 23552 swift-sdk.exe 267776 SwiftSDKCommand.dll ------ 291328 After: 265728 swift-sdk.exe ~~~ Savings: 25,600 bytes CoreCommands Conversion: ~~~ Before: 3844608 Commands.dll 1065472 CoreCommands.dll 265728 swift-sdk.exe ------- 5175808 After: 4202496 Commands.dll 649728 swift-sdk.exe ------- 4852224 ~~~ Savings: 323,584 bytes DriverSupport Conversion: ~~~ Before: 945152 Build.dll 4202496 Commands.dll 49152 DriverSupport.dll 649728 swift-sdk.exe ------- 5846528 After: 958976 Build.dll 4217856 Commands.dll 669184 swift-sdk.exe ------- 5846016 ~~~ Savings: 512 bytes Net Savings: 401,920 bytes
1 parent 4681cee commit c28f5af

File tree

3 files changed

+3
-19
lines changed

3 files changed

+3
-19
lines changed

Sources/CoreCommands/CMakeLists.txt

+1-6
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# See http://swift.org/LICENSE.txt for license information
77
# See http://swift.org/CONTRIBUTORS.txt for Swift project authors
88

9-
add_library(CoreCommands
9+
add_library(CoreCommands STATIC
1010
BuildSystemSupport.swift
1111
SwiftCommandState.swift
1212
SwiftCommandObservabilityHandler.swift
@@ -28,8 +28,3 @@ target_link_libraries(CoreCommands PRIVATE
2828
# NOTE(compnerd) workaround for CMake not setting up include flags yet
2929
set_target_properties(CoreCommands PROPERTIES
3030
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY})
31-
32-
install(TARGETS CoreCommands
33-
ARCHIVE DESTINATION lib
34-
LIBRARY DESTINATION lib
35-
RUNTIME DESTINATION bin)

Sources/DriverSupport/CMakeLists.txt

+1-7
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# See http://swift.org/LICENSE.txt for license information
77
# See http://swift.org/CONTRIBUTORS.txt for Swift project authors
88

9-
add_library(DriverSupport
9+
add_library(DriverSupport STATIC
1010
DriverSupportUtils.swift
1111
SPMSwiftDriverExecutor.swift)
1212
# NOTE(compnerd) workaround for CMake not setting up include flags yet
@@ -16,9 +16,3 @@ target_link_libraries(DriverSupport PUBLIC
1616
Basics
1717
PackageModel
1818
SwiftDriver)
19-
20-
install(TARGETS DriverSupport
21-
ARCHIVE DESTINATION lib
22-
LIBRARY DESTINATION lib
23-
RUNTIME DESTINATION bin)
24-
set_property(GLOBAL APPEND PROPERTY SwiftPM_EXPORTS DriverSupport)

Sources/SwiftSDKCommand/CMakeLists.txt

+1-6
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# See http://swift.org/LICENSE.txt for license information
77
# See http://swift.org/CONTRIBUTORS.txt for Swift project authors
88

9-
add_library(SwiftSDKCommand
9+
add_library(SwiftSDKCommand STATIC
1010
Configuration/ConfigurationSubcommand.swift
1111
Configuration/DeprecatedSwiftSDKConfigurationCommand.swift
1212
Configuration/ResetConfiguration.swift
@@ -27,8 +27,3 @@ target_link_libraries(SwiftSDKCommand PUBLIC
2727
# NOTE(compnerd) workaround for CMake not setting up include flags yet
2828
set_target_properties(SwiftSDKCommand PROPERTIES
2929
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY})
30-
31-
install(TARGETS SwiftSDKCommand
32-
ARCHIVE DESTINATION lib
33-
LIBRARY DESTINATION lib
34-
RUNTIME DESTINATION bin)

0 commit comments

Comments
 (0)