From ee240da67b08b53b61d54306773a1d9f26c9aea3 Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Wed, 28 Dec 2022 20:50:58 -0800 Subject: [PATCH 1/3] build: bring CMake build up to date Add CMake based build support for the missing components as the Windows build depends on this still. This allows us to work towards enabling the swift package collection and registry functionality. --- CMakeLists.txt | 4 ++ Sources/CMakeLists.txt | 14 ++++- Sources/Commands/CMakeLists.txt | 1 + Sources/CoreCommands/CMakeLists.txt | 1 + .../CMakeLists.txt | 29 ++++++++++ Sources/PackageCollections/CMakeLists.txt | 55 +++++++++++++++++++ .../PackageCollectionsModel/CMakeLists.txt | 24 ++++++++ .../PackageCollectionsSigning/CMakeLists.txt | 54 ++++++++++++++++++ .../CMakeLists.txt | 19 +++++++ Sources/PackageCollectionsTool/CMakeLists.txt | 29 ++++++++++ Sources/PackageMetadata/CMakeLists.txt | 30 ++++++++++ Sources/PackageRegistryTool/CMakeLists.txt | 34 ++++++++++++ Sources/Workspace/CMakeLists.txt | 1 + Sources/XCBuildSupport/CMakeLists.txt | 1 + .../CMakeLists.txt | 17 ++++++ .../swift-package-collection/CMakeLists.txt | 18 ++++++ Sources/swift-package-manager/CMakeLists.txt | 21 +++++++ Sources/swift-package-registry/CMakeLists.txt | 18 ++++++ 18 files changed, 369 insertions(+), 1 deletion(-) create mode 100644 Sources/CrossCompilationDestinationsTool/CMakeLists.txt create mode 100644 Sources/PackageCollections/CMakeLists.txt create mode 100644 Sources/PackageCollectionsModel/CMakeLists.txt create mode 100644 Sources/PackageCollectionsSigning/CMakeLists.txt create mode 100644 Sources/PackageCollectionsSigningLibc/CMakeLists.txt create mode 100644 Sources/PackageCollectionsTool/CMakeLists.txt create mode 100644 Sources/PackageMetadata/CMakeLists.txt create mode 100644 Sources/PackageRegistryTool/CMakeLists.txt create mode 100644 Sources/swift-experimental-destination/CMakeLists.txt create mode 100644 Sources/swift-package-collection/CMakeLists.txt create mode 100644 Sources/swift-package-manager/CMakeLists.txt create mode 100644 Sources/swift-package-registry/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 3d0db5ce519..406e1d9308d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,6 +46,9 @@ if(FIND_PM_DEPS) find_package(SwiftSystem CONFIG REQUIRED) find_package(TSC CONFIG REQUIRED) + set(THREADS_PREFER_PTHREAD_FLAG TRUE) + find_package(Threads REQUIRED) + find_package(LLBuild CONFIG) if(NOT LLBuild_FOUND) find_package(LLBuild REQUIRED) @@ -54,6 +57,7 @@ if(FIND_PM_DEPS) find_package(ArgumentParser CONFIG REQUIRED) find_package(SwiftDriver CONFIG REQUIRED) find_package(SwiftCollections CONFIG REQUIRED) + find_package(SwiftCrypto CONFIG REQUIRED) endif() find_package(dispatch QUIET) diff --git a/Sources/CMakeLists.txt b/Sources/CMakeLists.txt index e92adf2ab3d..8fe397ad75a 100644 --- a/Sources/CMakeLists.txt +++ b/Sources/CMakeLists.txt @@ -11,21 +11,33 @@ add_subdirectory(Basics) add_subdirectory(Build) add_subdirectory(Commands) add_subdirectory(CoreCommands) +add_subdirectory(CrossCompilationDestinationsTool) add_subdirectory(DriverSupport) add_subdirectory(LLBuildManifest) +add_subdirectory(PackageCollections) +add_subdirectory(PackageCollectionsModel) +add_subdirectory(packageCollectionsSigning) +add_subdirectory(PackageCollectionsSigningLibc) +add_subdirectory(PackageCollectionsTool) add_subdirectory(PackageDescription) add_subdirectory(PackageFingerprint) add_subdirectory(PackageGraph) add_subdirectory(PackageLoading) +add_subdirectory(PackageMetadata) add_subdirectory(PackageModel) add_subdirectory(PackagePlugin) add_subdirectory(PackageRegistry) +add_subdirectory(PackageRegistryTool) +add_subdirectory(SourceControl) add_subdirectory(SPMBuildCore) add_subdirectory(SPMLLBuild) -add_subdirectory(SourceControl) add_subdirectory(swift-bootstrap) add_subdirectory(swift-build) +add_subdirectory(swift-experimental-destination) add_subdirectory(swift-package) +add_subdirectory(swift-package-collection) +add_subdirectory(swift-package-manager) +add_subdirectory(swift-package-registry) add_subdirectory(swift-run) add_subdirectory(swift-test) add_subdirectory(Workspace) diff --git a/Sources/Commands/CMakeLists.txt b/Sources/Commands/CMakeLists.txt index 06453788734..555b06bdf6b 100644 --- a/Sources/Commands/CMakeLists.txt +++ b/Sources/Commands/CMakeLists.txt @@ -69,3 +69,4 @@ install(TARGETS Commands LIBRARY DESTINATION lib RUNTIME DESTINATION bin) endif() +set_property(GLOBAL APPEND PROPERTY SwiftPM_EXPORTS Commands) diff --git a/Sources/CoreCommands/CMakeLists.txt b/Sources/CoreCommands/CMakeLists.txt index 6e347e46e11..79be74d6ff0 100644 --- a/Sources/CoreCommands/CMakeLists.txt +++ b/Sources/CoreCommands/CMakeLists.txt @@ -34,3 +34,4 @@ install(TARGETS CoreCommands LIBRARY DESTINATION lib RUNTIME DESTINATION bin) endif() +set_property(GLOBAL APPEND PROPERTY SwiftPM_EXPORTS CoreCommands) diff --git a/Sources/CrossCompilationDestinationsTool/CMakeLists.txt b/Sources/CrossCompilationDestinationsTool/CMakeLists.txt new file mode 100644 index 00000000000..61be3a0b202 --- /dev/null +++ b/Sources/CrossCompilationDestinationsTool/CMakeLists.txt @@ -0,0 +1,29 @@ +# This source file is part of the Swift open source project +# +# Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors +# Licensed under Apache License v2.0 with Runtime Library Exception +# +# See http://swift.org/LICENSE.txt for license information +# See http://swift.org/CONTRIBUTORS.txt for Swift project authors + +add_library(CrossCompilationDestinationsTool + ListDestinations.swift + SwiftDestinationCommand.swift) +# NOTE(compnerd) workaround for CMake not setting up include flags yet +set_target_properties(CrossCompilationDestinationsTool PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY}) +target_link_libraries(CrossCompilationDestinationsTool PUBLIC + ArgumentParser + Basics + CoreCommands + SPMBuildCore + PackageModel + TSCBasic) + +if(USE_CMAKE_INSTALL) + install(TARGETS CrossCompilationDestinationsTool + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib + RUNTIME DESTINATION bin) +endif() +set_property(GLOBAL APPEND PROPERTY SwiftPM_EXPORTS CrossCompilationDestinationsTool) diff --git a/Sources/PackageCollections/CMakeLists.txt b/Sources/PackageCollections/CMakeLists.txt new file mode 100644 index 00000000000..45a4a298472 --- /dev/null +++ b/Sources/PackageCollections/CMakeLists.txt @@ -0,0 +1,55 @@ +# This source file is part of the Swift open source project +# +# Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors +# Licensed under Apache License v2.0 with Runtime Library Exception +# +# See http://swift.org/LICENSE.txt for license information +# See http://swift.org/CONTRIBUTORS.txt for Swift project authors + +add_library(PackageCollections + API.swift + Model/Collection.swift + Model/CVE.swift + Model/License.swift + Model/PackageList.swift + Model/PackageTypes.swift + Model/Search.swift + Model/TargetListResult.swift + PackageCollections+CertificatePolicy.swift + PackageCollections+Configuration.swift + PackageCollections+Storage.swift + PackageCollections+Validation.swift + PackageCollections.swift + PackageIndex+Configuration.swift + PackageIndex.swift + PackageIndexAndCollections.swift + Providers/GitHubPackageMetadataProvider.swift + Providers/JSONPackageCollectionProvider.swift + Providers/PackageCollectionProvider.swift + Providers/PackageMetadataProvider.swift + Storage/FilepackageCollectionsSourcesStorage.swift + Storage/PackageCollectionsSourcesStorage.swift + Storage/PackageCollectionsStorage.swift + Storage/SQLitePackageCollectionsStorage.swift + Storage/Trie.swift + Utility.swift) +# NOTE(compnerd) workaround for CMake not setting up include flags yet +set_target_properties(PackageCollections PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY}) +target_link_libraries(PackageCollections PUBLIC + $<$>:dispatch> + $<$>:Foundation> + Basics + PackageCollectionsModel + PackageCollectionsSigning + PackageModel + SourceControl + TSCBasic) + +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) diff --git a/Sources/PackageCollectionsModel/CMakeLists.txt b/Sources/PackageCollectionsModel/CMakeLists.txt new file mode 100644 index 00000000000..3e089062f9a --- /dev/null +++ b/Sources/PackageCollectionsModel/CMakeLists.txt @@ -0,0 +1,24 @@ +# This source file is part of the Swift open source project +# +# Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors +# Licensed under Apache License v2.0 with Runtime Library Exception +# +# See http://swift.org/LICENSE.txt for license information +# See http://swift.org/CONTRIBUTORS.txt for Swift project authors + +add_library(PackageCollectionsModel + PackageCollectionModel+v1.swift + PackageCollectionModel.swift) +# NOTE(compnerd) workaround for CMake not setting up include flags yet +set_target_properties(PackageCollectionsModel PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY}) +target_link_libraries(PackageCollectionsModel PUBLIC + $<$>:Foundation>) + +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) diff --git a/Sources/PackageCollectionsSigning/CMakeLists.txt b/Sources/PackageCollectionsSigning/CMakeLists.txt new file mode 100644 index 00000000000..e751423def5 --- /dev/null +++ b/Sources/PackageCollectionsSigning/CMakeLists.txt @@ -0,0 +1,54 @@ +# This source file is part of the Swift open source project +# +# Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors +# Licensed under Apache License v2.0 with Runtime Library Exception +# +# See http://swift.org/LICENSE.txt for license information +# See http://swift.org/CONTRIBUTORS.txt for Swift project authors + +add_library(PackageCollectionsSigning + Certificate/Certificate.swift + Certificate/CertificatePolicy.swift + Key/ASN1/ASN1.swift + Key/ASN1/ASN1Error.swift + Key/ASN1/PEMDocument.swift + Key/ASN1/SEC1PrivateKey.swift + Key/ASN1/SubjectPublickeyInfo.swift + Key/ASN1/Types/ASN1BitString.swift + Key/ASN1/Types/ASN1Identifier.swift + Key/ASN1/Types/ASN1Integer.swift + Key/ASN1/Types/ASN1ObjectIdentifier.swift + Key/ASN1/Types/ASN1OctetString.swift + Key/BoringSSLKey.swift + Key/Key+EC.swift + Key/Key+RSA.swift + Key/Key.swift + PackageCollectionSigning.swift + Signing/BoringSSLSigning.swift + Signing/Signature.swift + Signing/Signing+ECKey.swift + Signing/Signing+RSAKey.swift + Signing/Signing.swift + Utilities/Base64URL.swift + Utilities/Utilities.swift) +# NOTE(compnerd) workaround for CMake not setting up include flags yet +set_target_properties(PackageCollectionsSigning PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_Swift_MODULE_DIRECTORY};${PROJECT_SOURCE_DIR}/Sources/PackageCollectionsSigningLibc/include") +target_link_libraries(PackageCollectionsSigning PUBLIC + $<$>:dispatch> + $<$>:Foundation> + Basics + CCryptoBoringSSL + Crypto + PackageCollectionsModel + TSCBasic) +target_link_libraries(PackageCollectionsSigning PRIVATE + PackageCollectionsSigningLibc) + +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) diff --git a/Sources/PackageCollectionsSigningLibc/CMakeLists.txt b/Sources/PackageCollectionsSigningLibc/CMakeLists.txt new file mode 100644 index 00000000000..24bcf3bfd62 --- /dev/null +++ b/Sources/PackageCollectionsSigningLibc/CMakeLists.txt @@ -0,0 +1,19 @@ +# This source file is part of the Swift open source project +# +# Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors +# Licensed under Apache License v2.0 with Runtime Library Exception +# +# See http://swift.org/LICENSE.txt for license information +# See http://swift.org/CONTRIBUTORS.txt for Swift project authors + +add_library(PackageCollectionsSigningLibc STATIC + asn1/a_d2i_fp.c + asn1/a_i2d_fp.c + ocsp_asn.c + ocsp_cl.c + ocsp_lib.c + ocsp_vfy.c) +target_include_directories(PackageCollectionsSigningLibc PUBLIC + include) +target_link_libraries(PackageCollectionsSigningLibc PRIVATE + CCryptoBoringSSL) diff --git a/Sources/PackageCollectionsTool/CMakeLists.txt b/Sources/PackageCollectionsTool/CMakeLists.txt new file mode 100644 index 00000000000..3276a2152aa --- /dev/null +++ b/Sources/PackageCollectionsTool/CMakeLists.txt @@ -0,0 +1,29 @@ +# This source file is part of the Swift open source project +# +# Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors +# Licensed under Apache License v2.0 with Runtime Library Exception +# +# See http://swift.org/LICENSE.txt for license information +# See http://swift.org/CONTRIBUTORS.txt for Swift project authors + +add_library(PackageCollectionsTool + SwiftPackageCollectionsTool.swift) +# NOTE(compnerd) workaround for CMake not setting up include flags yet +set_target_properties(PackageCollectionsTool PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY}) +target_link_libraries(PackageCollectionsTool PUBLIC + $<$>:Foundation> + ArgumentParser + Basics + Commands + llbuild + llbuildSwift + PackageCollections) + +if(USE_CMAKE_INSTALL) + install(TARGETS PackageCollectionsTool + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib + RUNTIME DESTINATION bin) +endif() +set_property(GLOBAL APPEND PROPERTY SwiftPM_EXPORTS PackageCollectionsTool) diff --git a/Sources/PackageMetadata/CMakeLists.txt b/Sources/PackageMetadata/CMakeLists.txt new file mode 100644 index 00000000000..34c1f8d5ff3 --- /dev/null +++ b/Sources/PackageMetadata/CMakeLists.txt @@ -0,0 +1,30 @@ +# This source file is part of the Swift open source project +# +# Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors +# Licensed under Apache License v2.0 with Runtime Library Exception +# +# See http://swift.org/LICENSE.txt for license information +# See http://swift.org/CONTRIBUTORS.txt for Swift project authors + +add_library(PackageMetadata + PackageMetadata.swift) +# NOTE(compnerd) workaround for CMake not setting up include flags yet +set_target_properties(PackageMetadata PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY}) +target_link_libraries(PackageMetadata PUBLIC + $<$>:dispatch> + $<$>:Foundation> + Basics + PackageCollections + PackageModel + PackageRegistry + SourceControl + TSCBasic) + +if(USE_CMAKE_INSTALL) + install(TARGETS PackageMetadata + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib + RUNTIME DESTINATION bin) +endif() +set_property(GLOBAL APPEND PROPERTY SwiftPM_EXPORTS PackageMetadata) diff --git a/Sources/PackageRegistryTool/CMakeLists.txt b/Sources/PackageRegistryTool/CMakeLists.txt new file mode 100644 index 00000000000..018b4a3f435 --- /dev/null +++ b/Sources/PackageRegistryTool/CMakeLists.txt @@ -0,0 +1,34 @@ +# This source file is part of the Swift open source project +# +# Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors +# Licensed under Apache License v2.0 with Runtime Library Exception +# +# See http://swift.org/LICENSE.txt for license information +# See http://swift.org/CONTRIBUTORS.txt for Swift project authors + +add_library(PackageRegistryTool + SwiftPackageRegistryTool.swift) +# NOTE(compnerd) workaround for CMake not setting up include flags yet +set_target_properties(PackageRegistryTool PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY}) +target_link_libraries(PackageRegistryTool PUBLIC + $<$>:Foundation> + Basics + Commands + CoreCommands + PackageGraph + PackageLoading + PackageModel + PackageRegistry + SourceControl + SPMBuildCore + Workspace + TSCBasic) + +if(USE_CMAKE_INSTALL) + install(TARGETS PackageRegistryTool + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib + RUNTIME DESTINATION bin) +endif() +set_property(GLOBAL APPEND PROPERTY SwiftPM_EXPORTS PackageRegistryTool) diff --git a/Sources/Workspace/CMakeLists.txt b/Sources/Workspace/CMakeLists.txt index 352ff7fd9de..fd1b08018ef 100644 --- a/Sources/Workspace/CMakeLists.txt +++ b/Sources/Workspace/CMakeLists.txt @@ -46,3 +46,4 @@ install(TARGETS Workspace LIBRARY DESTINATION lib RUNTIME DESTINATION bin) endif() +set_property(GLOBAL APPEND PROPERTY SwiftPM_EXPORTS Workspace) diff --git a/Sources/XCBuildSupport/CMakeLists.txt b/Sources/XCBuildSupport/CMakeLists.txt index 178e0bc1ba7..0e7feee7282 100644 --- a/Sources/XCBuildSupport/CMakeLists.txt +++ b/Sources/XCBuildSupport/CMakeLists.txt @@ -22,3 +22,4 @@ target_link_libraries(XCBuildSupport PUBLIC set_target_properties(XCBuildSupport PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY}) +set_property(GLOBAL APPEND PROPERTY SwiftPM_EXPORTS XCBuildSupport) diff --git a/Sources/swift-experimental-destination/CMakeLists.txt b/Sources/swift-experimental-destination/CMakeLists.txt new file mode 100644 index 00000000000..4d50f429cdb --- /dev/null +++ b/Sources/swift-experimental-destination/CMakeLists.txt @@ -0,0 +1,17 @@ +# This source file is part of the Swift open source project +# +# Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors +# Licensed under Apache License v2.0 with Runtime Library Exception +# +# See http://swift.org/LICENSE.txt for license information +# See http://swift.org/CONTRIBUTORS.txt for Swift project authors + +add_executable(swift-experimental-destination + main.swift) +target_link_libraries(swift-experimental-destination PRIVATE + CrossCompilationDestinationsTool) + +if(USE_CMAKE_INSTALL) +install(TARGETS swift-experimental-destination + RUNTIME DESTINATION bin) +endif() diff --git a/Sources/swift-package-collection/CMakeLists.txt b/Sources/swift-package-collection/CMakeLists.txt new file mode 100644 index 00000000000..0b94575d7ec --- /dev/null +++ b/Sources/swift-package-collection/CMakeLists.txt @@ -0,0 +1,18 @@ +# This source file is part of the Swift open source project +# +# Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors +# Licensed under Apache License v2.0 with Runtime Library Exception +# +# See http://swift.org/LICENSE.txt for license information +# See http://swift.org/CONTRIBUTORS.txt for Swift project authors + +add_executable(swift-package-collection + main.swift) +target_link_libraries(swift-package-collection PRIVATE + Commands + PackageCollectionsTool) + +if(USE_CMAKE_INSTALL) +install(TARGETS swift-package-collection + RUNTIME DESTINATION bin) +endif() diff --git a/Sources/swift-package-manager/CMakeLists.txt b/Sources/swift-package-manager/CMakeLists.txt new file mode 100644 index 00000000000..35d259e7dc8 --- /dev/null +++ b/Sources/swift-package-manager/CMakeLists.txt @@ -0,0 +1,21 @@ +# This source file is part of the Swift open source project +# +# Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors +# Licensed under Apache License v2.0 with Runtime Library Exception +# +# See http://swift.org/LICENSE.txt for license information +# See http://swift.org/CONTRIBUTORS.txt for Swift project authors + +add_executable(swift-package-manager + main.swift) +target_link_libraries(swift-package-manager PRIVATE + Commands + CrossCompilationDestinationsTool + PackageCollectionsTool + PackageRegistryTool + TSCBasic) + +if(USE_CMAKE_INSTALL) +install(TARGETS swift-package-manager + RUNTIME DESTINATION bin) +endif() diff --git a/Sources/swift-package-registry/CMakeLists.txt b/Sources/swift-package-registry/CMakeLists.txt new file mode 100644 index 00000000000..2018251da25 --- /dev/null +++ b/Sources/swift-package-registry/CMakeLists.txt @@ -0,0 +1,18 @@ +# This source file is part of the Swift open source project +# +# Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors +# Licensed under Apache License v2.0 with Runtime Library Exception +# +# See http://swift.org/LICENSE.txt for license information +# See http://swift.org/CONTRIBUTORS.txt for Swift project authors + +add_executable(swift-package-registry + main.swift) +target_link_libraries(swift-package-registry PRIVATE + Commands + PackageRegistryTool) + +if(USE_CMAKE_INSTALL) +install(TARGETS swift-package-registry + RUNTIME DESTINATION bin) +endif() From 0f08760b25915a3d2be22dc2924f180a482f3219 Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Fri, 30 Dec 2022 10:43:57 -0800 Subject: [PATCH 2/3] build: simplify the package collection dependency graph Convert the `PackageCollectionsModel` and `PackageCollectionsSigning` modules static. `PackageCollectionsModel` is used only by `PackageCollectionsSigning` and `PackageCollections` and `PackageCollectionsSigning` is only used by `PackageCollections`. We can collapse the two modules down, statically linking it into `PackageCollections` at no cost. This reduces the packaging complexity as we have fewer libraries to redistribute with the toolchain. --- Sources/PackageCollections/CMakeLists.txt | 8 ++++++-- Sources/PackageCollectionsModel/CMakeLists.txt | 10 +--------- Sources/PackageCollectionsSigning/CMakeLists.txt | 10 +--------- 3 files changed, 8 insertions(+), 20 deletions(-) diff --git a/Sources/PackageCollections/CMakeLists.txt b/Sources/PackageCollections/CMakeLists.txt index 45a4a298472..e960f51c8a2 100644 --- a/Sources/PackageCollections/CMakeLists.txt +++ b/Sources/PackageCollections/CMakeLists.txt @@ -40,11 +40,15 @@ target_link_libraries(PackageCollections PUBLIC $<$>:dispatch> $<$>:Foundation> Basics - PackageCollectionsModel - PackageCollectionsSigning PackageModel SourceControl TSCBasic) +target_link_libraries(PackageCollections PRIVATE + PackageCollectionsModel + PackageCollectionsSigning) +target_link_libraries(PackageCollections PUBLIC + Crypto + CCryptoBoringSSL) if(USE_CMAKE_INSTALL) install(TARGETS PackageCollections diff --git a/Sources/PackageCollectionsModel/CMakeLists.txt b/Sources/PackageCollectionsModel/CMakeLists.txt index 3e089062f9a..85f1e1d4863 100644 --- a/Sources/PackageCollectionsModel/CMakeLists.txt +++ b/Sources/PackageCollectionsModel/CMakeLists.txt @@ -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+v1.swift PackageCollectionModel.swift) # NOTE(compnerd) workaround for CMake not setting up include flags yet @@ -14,11 +14,3 @@ set_target_properties(PackageCollectionsModel PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY}) target_link_libraries(PackageCollectionsModel PUBLIC $<$>:Foundation>) - -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) diff --git a/Sources/PackageCollectionsSigning/CMakeLists.txt b/Sources/PackageCollectionsSigning/CMakeLists.txt index e751423def5..00afd23c0c7 100644 --- a/Sources/PackageCollectionsSigning/CMakeLists.txt +++ b/Sources/PackageCollectionsSigning/CMakeLists.txt @@ -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 @@ -44,11 +44,3 @@ target_link_libraries(PackageCollectionsSigning PUBLIC TSCBasic) target_link_libraries(PackageCollectionsSigning PRIVATE PackageCollectionsSigningLibc) - -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) From f8242065429f506f154536e3ccd1dbfbd9b7b0aa Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Sun, 1 Jan 2023 09:19:18 -0800 Subject: [PATCH 3/3] build: convert Tool libraries into static libraries These are used by two consumers: - unified swift-package-manager multi-call binary - single purpose tools Since the single purpose tools and the multi-call binary are serving the same purpose and will never be shipped at the same time, these libraries can be fully internalised without increasing the size of the package. In effect we reduce the distribution set without increasing size. --- .../CrossCompilationDestinationsTool/CMakeLists.txt | 10 +--------- Sources/PackageCollectionsTool/CMakeLists.txt | 10 +--------- Sources/PackageRegistryTool/CMakeLists.txt | 10 +--------- 3 files changed, 3 insertions(+), 27 deletions(-) diff --git a/Sources/CrossCompilationDestinationsTool/CMakeLists.txt b/Sources/CrossCompilationDestinationsTool/CMakeLists.txt index 61be3a0b202..6eb72dbf0ba 100644 --- a/Sources/CrossCompilationDestinationsTool/CMakeLists.txt +++ b/Sources/CrossCompilationDestinationsTool/CMakeLists.txt @@ -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(CrossCompilationDestinationsTool +add_library(CrossCompilationDestinationsTool STATIC ListDestinations.swift SwiftDestinationCommand.swift) # NOTE(compnerd) workaround for CMake not setting up include flags yet @@ -19,11 +19,3 @@ target_link_libraries(CrossCompilationDestinationsTool PUBLIC SPMBuildCore PackageModel TSCBasic) - -if(USE_CMAKE_INSTALL) - install(TARGETS CrossCompilationDestinationsTool - ARCHIVE DESTINATION lib - LIBRARY DESTINATION lib - RUNTIME DESTINATION bin) -endif() -set_property(GLOBAL APPEND PROPERTY SwiftPM_EXPORTS CrossCompilationDestinationsTool) diff --git a/Sources/PackageCollectionsTool/CMakeLists.txt b/Sources/PackageCollectionsTool/CMakeLists.txt index 3276a2152aa..d7f505760f9 100644 --- a/Sources/PackageCollectionsTool/CMakeLists.txt +++ b/Sources/PackageCollectionsTool/CMakeLists.txt @@ -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(PackageCollectionsTool +add_library(PackageCollectionsTool STATIC SwiftPackageCollectionsTool.swift) # NOTE(compnerd) workaround for CMake not setting up include flags yet set_target_properties(PackageCollectionsTool PROPERTIES @@ -19,11 +19,3 @@ target_link_libraries(PackageCollectionsTool PUBLIC llbuild llbuildSwift PackageCollections) - -if(USE_CMAKE_INSTALL) - install(TARGETS PackageCollectionsTool - ARCHIVE DESTINATION lib - LIBRARY DESTINATION lib - RUNTIME DESTINATION bin) -endif() -set_property(GLOBAL APPEND PROPERTY SwiftPM_EXPORTS PackageCollectionsTool) diff --git a/Sources/PackageRegistryTool/CMakeLists.txt b/Sources/PackageRegistryTool/CMakeLists.txt index 018b4a3f435..947e1b28365 100644 --- a/Sources/PackageRegistryTool/CMakeLists.txt +++ b/Sources/PackageRegistryTool/CMakeLists.txt @@ -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(PackageRegistryTool +add_library(PackageRegistryTool STATIC SwiftPackageRegistryTool.swift) # NOTE(compnerd) workaround for CMake not setting up include flags yet set_target_properties(PackageRegistryTool PROPERTIES @@ -24,11 +24,3 @@ target_link_libraries(PackageRegistryTool PUBLIC SPMBuildCore Workspace TSCBasic) - -if(USE_CMAKE_INSTALL) - install(TARGETS PackageRegistryTool - ARCHIVE DESTINATION lib - LIBRARY DESTINATION lib - RUNTIME DESTINATION bin) -endif() -set_property(GLOBAL APPEND PROPERTY SwiftPM_EXPORTS PackageRegistryTool)