Skip to content

Commit 251a941

Browse files
committed
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.
1 parent 14d05cc commit 251a941

File tree

18 files changed

+368
-1
lines changed

18 files changed

+368
-1
lines changed

CMakeLists.txt

+4
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ if(FIND_PM_DEPS)
4646
find_package(SwiftSystem CONFIG REQUIRED)
4747
find_package(TSC CONFIG REQUIRED)
4848

49+
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
50+
find_package(Threads REQUIRED)
51+
4952
find_package(LLBuild CONFIG)
5053
if(NOT LLBuild_FOUND)
5154
find_package(LLBuild REQUIRED)
@@ -54,6 +57,7 @@ if(FIND_PM_DEPS)
5457
find_package(ArgumentParser CONFIG REQUIRED)
5558
find_package(SwiftDriver CONFIG REQUIRED)
5659
find_package(SwiftCollections CONFIG REQUIRED)
60+
find_package(SwiftCrypto CONFIG REQUIRED)
5761
endif()
5862

5963
find_package(dispatch QUIET)

Sources/CMakeLists.txt

+13-1
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,33 @@ add_subdirectory(Basics)
1111
add_subdirectory(Build)
1212
add_subdirectory(Commands)
1313
add_subdirectory(CoreCommands)
14+
add_subdirectory(CrossCompilationDestinationsTool)
1415
add_subdirectory(DriverSupport)
1516
add_subdirectory(LLBuildManifest)
17+
add_subdirectory(PackageCollections)
18+
add_subdirectory(PackageCollectionsModel)
19+
add_subdirectory(packageCollectionsSigning)
20+
add_subdirectory(PackageCollectionsSigningLibc)
21+
add_subdirectory(PackageCollectionsTool)
1622
add_subdirectory(PackageDescription)
1723
add_subdirectory(PackageFingerprint)
1824
add_subdirectory(PackageGraph)
1925
add_subdirectory(PackageLoading)
26+
add_subdirectory(PackageMetadata)
2027
add_subdirectory(PackageModel)
2128
add_subdirectory(PackagePlugin)
2229
add_subdirectory(PackageRegistry)
30+
add_subdirectory(PackageRegistryTool)
31+
add_subdirectory(SourceControl)
2332
add_subdirectory(SPMBuildCore)
2433
add_subdirectory(SPMLLBuild)
25-
add_subdirectory(SourceControl)
2634
add_subdirectory(swift-bootstrap)
2735
add_subdirectory(swift-build)
36+
add_subdirectory(swift-experimental-destination)
2837
add_subdirectory(swift-package)
38+
add_subdirectory(swift-package-collection)
39+
add_subdirectory(swift-package-manager)
40+
add_subdirectory(swift-package-registry)
2941
add_subdirectory(swift-run)
3042
add_subdirectory(swift-test)
3143
add_subdirectory(Workspace)

Sources/Commands/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,4 @@ install(TARGETS Commands
6969
LIBRARY DESTINATION lib
7070
RUNTIME DESTINATION bin)
7171
endif()
72+
set_property(GLOBAL APPEND PROPERTY SwiftPM_EXPORTS Commands)

Sources/CoreCommands/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,4 @@ install(TARGETS CoreCommands
3434
LIBRARY DESTINATION lib
3535
RUNTIME DESTINATION bin)
3636
endif()
37+
set_property(GLOBAL APPEND PROPERTY SwiftPM_EXPORTS CoreCommands)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# This source file is part of the Swift open source project
2+
#
3+
# Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
4+
# Licensed under Apache License v2.0 with Runtime Library Exception
5+
#
6+
# See http://swift.org/LICENSE.txt for license information
7+
# See http://swift.org/CONTRIBUTORS.txt for Swift project authors
8+
9+
add_library(CrossCompilationDestinationsTool
10+
ListDestinations.swift
11+
SwiftDestinationCommand.swift)
12+
# NOTE(compnerd) workaround for CMake not setting up include flags yet
13+
set_target_properties(CrossCompilationDestinationsTool PROPERTIES
14+
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY})
15+
target_link_libraries(CrossCompilationDestinationsTool PUBLIC
16+
ArgumentParser
17+
Basics
18+
CoreCommands
19+
SPMBuildCore
20+
PackageModel
21+
TSCBasic)
22+
23+
if(USE_CMAKE_INSTALL)
24+
install(TARGETS CrossCompilationDestinationsTool
25+
ARCHIVE DESTINATION lib
26+
LIBRARY DESTINATION lib
27+
RUNTIME DESTINATION bin)
28+
endif()
29+
set_property(GLOBAL APPEND PROPERTY SwiftPM_EXPORTS CrossCompilationDestinationsTool)
+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# This source file is part of the Swift open source project
2+
#
3+
# Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
4+
# Licensed under Apache License v2.0 with Runtime Library Exception
5+
#
6+
# See http://swift.org/LICENSE.txt for license information
7+
# See http://swift.org/CONTRIBUTORS.txt for Swift project authors
8+
9+
add_library(PackageCollections
10+
API.swift
11+
Model/Collection.swift
12+
Model/CVE.swift
13+
Model/License.swift
14+
Model/PackageList.swift
15+
Model/PackageTypes.swift
16+
Model/Search.swift
17+
Model/TargetListResult.swift
18+
PackageCollections+CertificatePolicy.swift
19+
PackageCollections+Configuration.swift
20+
PackageCollections+Storage.swift
21+
PackageCollections+Validation.swift
22+
PackageCollections.swift
23+
PackageIndex+Configuration.swift
24+
PackageIndex.swift
25+
PackageIndexAndCollections.swift
26+
Providers/GitHubPackageMetadataProvider.swift
27+
Providers/JSONPackageCollectionProvider.swift
28+
Providers/PackageCollectionProvider.swift
29+
Providers/PackageMetadataProvider.swift
30+
Storage/FilepackageCollectionsSourcesStorage.swift
31+
Storage/PackageCollectionsSourcesStorage.swift
32+
Storage/PackageCollectionsStorage.swift
33+
Storage/SQLitePackageCollectionsStorage.swift
34+
Storage/Trie.swift
35+
Utility.swift)
36+
# NOTE(compnerd) workaround for CMake not setting up include flags yet
37+
set_target_properties(PackageCollections PROPERTIES
38+
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY})
39+
target_link_libraries(PackageCollections PUBLIC
40+
$<$<NOT:$<PLATFORM_ID:Darwin>>:dispatch>
41+
$<$<NOT:$<PLATFORM_ID:Darwin>>:Foundation>
42+
Basics
43+
PackageCollectionsModel
44+
PackageCollectionsSigning
45+
PackageModel
46+
SourceControl
47+
TSCBasic)
48+
49+
if(USE_CMAKE_INSTALL)
50+
install(TARGETS PackageCollections
51+
ARCHIVE DESTINATION lib
52+
LIBRARY DESTINATION lib
53+
RUNTIME DESTINATION bin)
54+
endif()
55+
set_property(GLOBAL APPEND PROPERTY SwiftPM_EXPORTS PackageCollections)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# This source file is part of the Swift open source project
2+
#
3+
# Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
4+
# Licensed under Apache License v2.0 with Runtime Library Exception
5+
#
6+
# See http://swift.org/LICENSE.txt for license information
7+
# See http://swift.org/CONTRIBUTORS.txt for Swift project authors
8+
9+
add_library(PackageCollectionsModel
10+
PackageCollectionModel+v1.swift
11+
PackageCollectionModel.swift)
12+
# NOTE(compnerd) workaround for CMake not setting up include flags yet
13+
set_target_properties(PackageCollectionsModel PROPERTIES
14+
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY})
15+
target_link_libraries(PackageCollectionsModel PUBLIC
16+
$<$<NOT:$<PLATFORM_ID:Darwin>>:Foundation>)
17+
18+
if(USE_CMAKE_INSTALL)
19+
install(TARGETS PackageCollectionsModel
20+
ARCHIVE DESTINATION lib
21+
LIBRARY DESTINATION lib
22+
RUNTIME DESTINATION bin)
23+
endif()
24+
set_property(GLOBAL APPEND PROPERTY SwiftPM_EXPORTS PackageCollectionsModel)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# This source file is part of the Swift open source project
2+
#
3+
# Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
4+
# Licensed under Apache License v2.0 with Runtime Library Exception
5+
#
6+
# See http://swift.org/LICENSE.txt for license information
7+
# See http://swift.org/CONTRIBUTORS.txt for Swift project authors
8+
9+
add_library(PackageCollectionsSigning
10+
Certificate/Certificate.swift
11+
Certificate/CertificatePolicy.swift
12+
Key/ASN1/ASN1.swift
13+
Key/ASN1/ASN1Error.swift
14+
Key/ASN1/PEMDocument.swift
15+
Key/ASN1/SEC1PrivateKey.swift
16+
Key/ASN1/SubjectPublickeyInfo.swift
17+
Key/ASN1/Types/ASN1BitString.swift
18+
Key/ASN1/Types/ASN1Identifier.swift
19+
Key/ASN1/Types/ASN1Integer.swift
20+
Key/ASN1/Types/ASN1ObjectIdentifier.swift
21+
Key/ASN1/Types/ASN1OctetString.swift
22+
Key/BoringSSLKey.swift
23+
Key/Key+EC.swift
24+
Key/Key+RSA.swift
25+
Key/Key.swift
26+
PackageCollectionSigning.swift
27+
Signing/BoringSSLSigning.swift
28+
Signing/Signature.swift
29+
Signing/Signing+ECKey.swift
30+
Signing/Signing+RSAKey.swift
31+
Signing/Signing.swift
32+
Utilities/Base64URL.swift
33+
Utilities/Utilities.swift)
34+
# NOTE(compnerd) workaround for CMake not setting up include flags yet
35+
set_target_properties(PackageCollectionsSigning PROPERTIES
36+
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY})
37+
target_link_libraries(PackageCollectionsSigning PUBLIC
38+
$<$<NOT:$<PLATFORM_ID:Darwin>>:dispatch>
39+
$<$<NOT:$<PLATFORM_ID:Darwin>>:Foundation>
40+
Basics
41+
CCryptoBoringSSL
42+
Crypto
43+
PackageCollectionsSigningLibc
44+
TSCBasic)
45+
46+
if(USE_CMAKE_INSTALL)
47+
install(TARGETS PackageCollectionsSigning
48+
ARCHIVE DESTINATION lib
49+
LIBRARY DESTINATION lib
50+
RUNTIME DESTINATION bin)
51+
endif()
52+
set_property(GLOBAL APPEND PROPERTY SwiftPM_EXPORTS PackageCollectionsSigning)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# This source file is part of the Swift open source project
2+
#
3+
# Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
4+
# Licensed under Apache License v2.0 with Runtime Library Exception
5+
#
6+
# See http://swift.org/LICENSE.txt for license information
7+
# See http://swift.org/CONTRIBUTORS.txt for Swift project authors
8+
9+
add_library(PackageCollectionsSigningLibc STATIC
10+
asn1/a_d2i_fp.c
11+
asn1/a_i2d_fp.c
12+
ocsp_asn.c
13+
ocsp_cl.c
14+
ocsp_lib.c
15+
ocsp_vfy.c)
16+
target_include_directories(PackageCollectionsSigningLibc PUBLIC
17+
include)
18+
target_link_libraries(PackageCollectionsSigningLibc PRIVATE
19+
CCryptoBoringSSL)
20+
set_property(GLOBAL APPEND PROPERTY SwiftPM_EXPORTS PackageCollectionsSigningLibc)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# This source file is part of the Swift open source project
2+
#
3+
# Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
4+
# Licensed under Apache License v2.0 with Runtime Library Exception
5+
#
6+
# See http://swift.org/LICENSE.txt for license information
7+
# See http://swift.org/CONTRIBUTORS.txt for Swift project authors
8+
9+
add_library(PackageCollectionsTool
10+
SwiftPackageCollectionsTool.swift)
11+
# NOTE(compnerd) workaround for CMake not setting up include flags yet
12+
set_target_properties(PackageCollectionsTool PROPERTIES
13+
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY})
14+
target_link_libraries(PackageCollectionsTool PUBLIC
15+
$<$<NOT:$<PLATFORM_ID:Darwin>>:Foundation>
16+
ArgumentParser
17+
Basics
18+
Commands
19+
llbuild
20+
llbuildSwift
21+
PackageCollections)
22+
23+
if(USE_CMAKE_INSTALL)
24+
install(TARGETS PackageCollectionsTool
25+
ARCHIVE DESTINATION lib
26+
LIBRARY DESTINATION lib
27+
RUNTIME DESTINATION bin)
28+
endif()
29+
set_property(GLOBAL APPEND PROPERTY SwiftPM_EXPORTS PackageCollectionsTool)
+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# This source file is part of the Swift open source project
2+
#
3+
# Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
4+
# Licensed under Apache License v2.0 with Runtime Library Exception
5+
#
6+
# See http://swift.org/LICENSE.txt for license information
7+
# See http://swift.org/CONTRIBUTORS.txt for Swift project authors
8+
9+
add_library(PackageMetadata
10+
PackageMetadata.swift)
11+
# NOTE(compnerd) workaround for CMake not setting up include flags yet
12+
set_target_properties(PackageMetadata PROPERTIES
13+
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY})
14+
target_link_libraries(PackageMetadata PUBLIC
15+
$<$<NOT:$<PLATFORM_ID:Darwin>>:dispatch>
16+
$<$<NOT:$<PLATFORM_ID:Darwin>>:Foundation>
17+
Basics
18+
PackageCollections
19+
PackageModel
20+
PackageRegistry
21+
SourceControl
22+
TSCBasic)
23+
24+
if(USE_CMAKE_INSTALL)
25+
install(TARGETS PackageMetadata
26+
ARCHIVE DESTINATION lib
27+
LIBRARY DESTINATION lib
28+
RUNTIME DESTINATION bin)
29+
endif()
30+
set_property(GLOBAL APPEND PROPERTY SwiftPM_EXPORTS PackageMetadata)
+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# This source file is part of the Swift open source project
2+
#
3+
# Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
4+
# Licensed under Apache License v2.0 with Runtime Library Exception
5+
#
6+
# See http://swift.org/LICENSE.txt for license information
7+
# See http://swift.org/CONTRIBUTORS.txt for Swift project authors
8+
9+
add_library(PackageRegistryTool
10+
SwiftPackageRegistryTool.swift)
11+
# NOTE(compnerd) workaround for CMake not setting up include flags yet
12+
set_target_properties(PackageRegistryTool PROPERTIES
13+
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY})
14+
target_link_libraries(PackageRegistryTool PUBLIC
15+
$<$<NOT:$<PLATFORM_ID:Darwin>>:Foundation>
16+
Basics
17+
Commands
18+
CoreCommands
19+
PackageGraph
20+
PackageLoading
21+
PackageModel
22+
PackageRegistry
23+
SourceControl
24+
SPMBuildCore
25+
Workspace
26+
TSCBasic)
27+
28+
if(USE_CMAKE_INSTALL)
29+
install(TARGETS PackageRegistryTool
30+
ARCHIVE DESTINATION lib
31+
LIBRARY DESTINATION lib
32+
RUNTIME DESTINATION bin)
33+
endif()
34+
set_property(GLOBAL APPEND PROPERTY SwiftPM_EXPORTS PackageRegistryTool)

Sources/Workspace/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,4 @@ install(TARGETS Workspace
4646
LIBRARY DESTINATION lib
4747
RUNTIME DESTINATION bin)
4848
endif()
49+
set_property(GLOBAL APPEND PROPERTY SwiftPM_EXPORTS Workspace)

Sources/XCBuildSupport/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@ target_link_libraries(XCBuildSupport PUBLIC
2222

2323
set_target_properties(XCBuildSupport PROPERTIES
2424
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY})
25+
set_property(GLOBAL APPEND PROPERTY SwiftPM_EXPORTS XCBuildSupport)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# This source file is part of the Swift open source project
2+
#
3+
# Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
4+
# Licensed under Apache License v2.0 with Runtime Library Exception
5+
#
6+
# See http://swift.org/LICENSE.txt for license information
7+
# See http://swift.org/CONTRIBUTORS.txt for Swift project authors
8+
9+
add_executable(swift-experimental-destination
10+
main.swift)
11+
target_link_libraries(swift-experimental-destination PRIVATE
12+
CrossCompilationDestinationsTool)
13+
14+
if(USE_CMAKE_INSTALL)
15+
install(TARGETS swift-experimental-destination
16+
RUNTIME DESTINATION bin)
17+
endif()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# This source file is part of the Swift open source project
2+
#
3+
# Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
4+
# Licensed under Apache License v2.0 with Runtime Library Exception
5+
#
6+
# See http://swift.org/LICENSE.txt for license information
7+
# See http://swift.org/CONTRIBUTORS.txt for Swift project authors
8+
9+
add_executable(swift-package-collection
10+
main.swift)
11+
target_link_libraries(swift-package-collection PRIVATE
12+
Commands
13+
PackageCollectionsTool)
14+
15+
if(USE_CMAKE_INSTALL)
16+
install(TARGETS swift-package-collection
17+
RUNTIME DESTINATION bin)
18+
endif()

0 commit comments

Comments
 (0)