Skip to content

build: statically link a subset of libraries #4182

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 1 commit into from
Mar 2, 2022
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
8 changes: 1 addition & 7 deletions Sources/LLBuildManifest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# See http://swift.org/LICENSE.txt for license information
# See http://swift.org/CONTRIBUTORS.txt for Swift project authors

add_library(LLBuildManifest
add_library(LLBuildManifest STATIC
BuildManifest.swift
Command.swift
ManifestWriter.swift
Expand All @@ -22,10 +22,4 @@ target_link_libraries(LLBuildManifest PUBLIC
set_target_properties(LLBuildManifest PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY})

if(USE_CMAKE_INSTALL)
install(TARGETS LLBuildManifest
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin)
endif()
set_property(GLOBAL APPEND PROPERTY SwiftPM_EXPORTS LLBuildManifest)
8 changes: 1 addition & 7 deletions Sources/PackageCollections/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# See http://swift.org/LICENSE.txt for license information
# See http://swift.org/CONTRIBUTORS.txt for Swift project authors

add_library(PackageCollections
add_library(PackageCollections STATIC
Model/Collection.swift
Model/CVE.swift
Model/License.swift
Expand Down Expand Up @@ -46,10 +46,4 @@ target_link_libraries(PackageCollections PUBLIC
set_target_properties(PackageCollections PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY})

if(USE_CMAKE_INSTALL)
install(TARGETS PackageCollections
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin)
endif()
set_property(GLOBAL APPEND PROPERTY SwiftPM_EXPORTS PackageCollections)
8 changes: 1 addition & 7 deletions Sources/PackageCollectionsModel/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# See http://swift.org/LICENSE.txt for license information
# See http://swift.org/CONTRIBUTORS.txt for Swift project authors

add_library(PackageCollectionsModel
add_library(PackageCollectionsModel STATIC
PackageCollectionModel.swift
PackageCollectionModel+v1.swift)
target_link_libraries(PackageCollectionsModel PUBLIC
Expand All @@ -15,10 +15,4 @@ target_link_libraries(PackageCollectionsModel PUBLIC
set_target_properties(PackageCollectionsModel PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY})

if(USE_CMAKE_INSTALL)
install(TARGETS PackageCollectionsModel
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin)
endif()
set_property(GLOBAL APPEND PROPERTY SwiftPM_EXPORTS PackageCollectionsModel)
8 changes: 1 addition & 7 deletions Sources/PackageCollectionsSigning/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# See http://swift.org/LICENSE.txt for license information
# See http://swift.org/CONTRIBUTORS.txt for Swift project authors

add_library(PackageCollectionsSigning
add_library(PackageCollectionsSigning STATIC
Certificate/Certificate.swift
Certificate/CertificatePolicy.swift
Key/ASN1/ASN1.swift
Expand Down Expand Up @@ -50,10 +50,4 @@ set_target_properties(PackageCollectionsSigning PROPERTIES
target_link_options(PackageCollectionsSigning PRIVATE
"$<$<PLATFORM_ID:Darwin>:SHELL:-Xlinker -framework -Xlinker Security>")

if(USE_CMAKE_INSTALL)
install(TARGETS PackageCollectionsSigning
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin)
endif()
set_property(GLOBAL APPEND PROPERTY SwiftPM_EXPORTS PackageCollectionsSigning)
8 changes: 1 addition & 7 deletions Sources/PackageFingerprint/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# See http://swift.org/LICENSE.txt for license information
# See http://swift.org/CONTRIBUTORS.txt for Swift project authors

add_library(PackageFingerprint
add_library(PackageFingerprint STATIC
FilePackageFingerprintStorage.swift
Model.swift
PackageFingerprintStorage.swift)
Expand All @@ -19,10 +19,4 @@ target_link_libraries(PackageFingerprint PUBLIC
set_target_properties(PackageFingerprint PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY})

if(USE_CMAKE_INSTALL)
install(TARGETS PackageFingerprint
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin)
endif()
set_property(GLOBAL APPEND PROPERTY SwiftPM_EXPORTS PackageFingerprint)
8 changes: 1 addition & 7 deletions Sources/PackageRegistry/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# See http://swift.org/LICENSE.txt for license information
# See http://swift.org/CONTRIBUTORS.txt for Swift project authors

add_library(PackageRegistry
add_library(PackageRegistry STATIC
Registry.swift
RegistryConfiguration.swift
RegistryClient.swift
Expand All @@ -22,10 +22,4 @@ target_link_libraries(PackageRegistry PUBLIC
set_target_properties(PackageRegistry PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY})

if(USE_CMAKE_INSTALL)
install(TARGETS PackageRegistry
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin)
endif()
set_property(GLOBAL APPEND PROPERTY SwiftPM_EXPORTS PackageRegistry)
8 changes: 1 addition & 7 deletions Sources/SPMLLBuild/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# See http://swift.org/LICENSE.txt for license information
# See http://swift.org/CONTRIBUTORS.txt for Swift project authors

add_library(SPMLLBuild
add_library(SPMLLBuild STATIC
llbuild.swift)
# NOTE(compnerd) workaround for CMake not setting up include flags yet
set_target_properties(SPMLLBuild PROPERTIES
Expand All @@ -18,10 +18,4 @@ target_link_libraries(SPMLLBuild PUBLIC
Basics
llbuildSwift)

if(USE_CMAKE_INSTALL)
install(TARGETS SPMLLBuild
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin)
endif()
set_property(GLOBAL APPEND PROPERTY SwiftPM_EXPORTS SPMLLBuild)
9 changes: 1 addition & 8 deletions Sources/SourceControl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@
# See http://swift.org/LICENSE.txt for license information
# See http://swift.org/CONTRIBUTORS.txt for Swift project authors

add_library(SourceControl
add_library(SourceControl STATIC
GitRepository.swift
Repository.swift
RepositoryManager.swift)

target_link_libraries(SourceControl PUBLIC
Basics
PackageModel
Expand All @@ -22,10 +21,4 @@ target_link_libraries(SourceControl PUBLIC
set_target_properties(SourceControl PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY})

if(USE_CMAKE_INSTALL)
install(TARGETS SourceControl
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin)
endif()
set_property(GLOBAL APPEND PROPERTY SwiftPM_EXPORTS SourceControl)
12 changes: 2 additions & 10 deletions Sources/XCBuildSupport/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@
# See http://swift.org/LICENSE.txt for license information
# See http://swift.org/CONTRIBUTORS.txt for Swift project authors

add_library(XCBuildSupport
add_library(XCBuildSupport STATIC
PIF.swift
PIFBuilder.swift
XCBuildDelegate.swift
XCBuildMessage.swift
XCBuildOutputParser.swift
XcodeBuildSystem.swift
)
XcodeBuildSystem.swift)
target_link_libraries(XCBuildSupport PUBLIC
Build
TSCBasic
Expand All @@ -23,10 +22,3 @@ target_link_libraries(XCBuildSupport PUBLIC

set_target_properties(XCBuildSupport PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY})

if(USE_CMAKE_INSTALL)
install(TARGETS XCBuildSupport
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin)
endif()
8 changes: 1 addition & 7 deletions Sources/Xcodeproj/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# See http://swift.org/LICENSE.txt for license information
# See http://swift.org/CONTRIBUTORS.txt for Swift project authors

add_library(Xcodeproj
add_library(Xcodeproj STATIC
generate.swift
pbxproj.swift
PropertyList.swift
Expand All @@ -22,9 +22,3 @@ target_link_libraries(Xcodeproj PUBLIC
set_target_properties(Xcodeproj PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY})

if(USE_CMAKE_INSTALL)
install(TARGETS Xcodeproj
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin)
endif()