Skip to content
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

build: bring CMake build up to date #6007

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
14 changes: 13 additions & 1 deletion Sources/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions Sources/Commands/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,4 @@ install(TARGETS Commands
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin)
endif()
set_property(GLOBAL APPEND PROPERTY SwiftPM_EXPORTS Commands)
1 change: 1 addition & 0 deletions Sources/CoreCommands/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@ install(TARGETS CoreCommands
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin)
endif()
set_property(GLOBAL APPEND PROPERTY SwiftPM_EXPORTS CoreCommands)
21 changes: 21 additions & 0 deletions Sources/CrossCompilationDestinationsTool/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
59 changes: 59 additions & 0 deletions Sources/PackageCollections/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
$<$<NOT:$<PLATFORM_ID:Darwin>>:dispatch>
$<$<NOT:$<PLATFORM_ID:Darwin>>: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)
16 changes: 16 additions & 0 deletions Sources/PackageCollectionsModel/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
$<$<NOT:$<PLATFORM_ID:Darwin>>:Foundation>)
46 changes: 46 additions & 0 deletions Sources/PackageCollectionsSigning/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
$<$<NOT:$<PLATFORM_ID:Darwin>>:dispatch>
$<$<NOT:$<PLATFORM_ID:Darwin>>:Foundation>
Basics
CCryptoBoringSSL
Crypto
PackageCollectionsModel
TSCBasic)
target_link_libraries(PackageCollectionsSigning PRIVATE
PackageCollectionsSigningLibc)
19 changes: 19 additions & 0 deletions Sources/PackageCollectionsSigningLibc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
21 changes: 21 additions & 0 deletions Sources/PackageCollectionsTool/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
$<$<NOT:$<PLATFORM_ID:Darwin>>:Foundation>
ArgumentParser
Basics
Commands
llbuild
llbuildSwift
PackageCollections)
30 changes: 30 additions & 0 deletions Sources/PackageMetadata/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
$<$<NOT:$<PLATFORM_ID:Darwin>>:dispatch>
$<$<NOT:$<PLATFORM_ID:Darwin>>: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)
26 changes: 26 additions & 0 deletions Sources/PackageRegistryTool/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
$<$<NOT:$<PLATFORM_ID:Darwin>>:Foundation>
Basics
Commands
CoreCommands
PackageGraph
PackageLoading
PackageModel
PackageRegistry
SourceControl
SPMBuildCore
Workspace
TSCBasic)
1 change: 1 addition & 0 deletions Sources/Workspace/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,4 @@ install(TARGETS Workspace
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin)
endif()
set_property(GLOBAL APPEND PROPERTY SwiftPM_EXPORTS Workspace)
1 change: 1 addition & 0 deletions Sources/XCBuildSupport/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
17 changes: 17 additions & 0 deletions Sources/swift-experimental-destination/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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()
18 changes: 18 additions & 0 deletions Sources/swift-package-collection/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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()
21 changes: 21 additions & 0 deletions Sources/swift-package-manager/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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()
18 changes: 18 additions & 0 deletions Sources/swift-package-registry/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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()