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..6eb72dbf0ba --- /dev/null +++ b/Sources/CrossCompilationDestinationsTool/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_library(CrossCompilationDestinationsTool STATIC + 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) diff --git a/Sources/PackageCollections/CMakeLists.txt b/Sources/PackageCollections/CMakeLists.txt new file mode 100644 index 00000000000..e960f51c8a2 --- /dev/null +++ b/Sources/PackageCollections/CMakeLists.txt @@ -0,0 +1,59 @@ +# 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 + PackageModel + SourceControl + TSCBasic) +target_link_libraries(PackageCollections PRIVATE + PackageCollectionsModel + PackageCollectionsSigning) +target_link_libraries(PackageCollections PUBLIC + Crypto + CCryptoBoringSSL) + +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..85f1e1d4863 --- /dev/null +++ b/Sources/PackageCollectionsModel/CMakeLists.txt @@ -0,0 +1,16 @@ +# 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 STATIC + 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>) diff --git a/Sources/PackageCollectionsSigning/CMakeLists.txt b/Sources/PackageCollectionsSigning/CMakeLists.txt new file mode 100644 index 00000000000..00afd23c0c7 --- /dev/null +++ b/Sources/PackageCollectionsSigning/CMakeLists.txt @@ -0,0 +1,46 @@ +# 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 STATIC + 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) 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..d7f505760f9 --- /dev/null +++ b/Sources/PackageCollectionsTool/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_library(PackageCollectionsTool STATIC + 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) 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..947e1b28365 --- /dev/null +++ b/Sources/PackageRegistryTool/CMakeLists.txt @@ -0,0 +1,26 @@ +# 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 STATIC + 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) 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()