Skip to content

build: complete the CMake based build #8834

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

Open
wants to merge 1 commit 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
5 changes: 5 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,7 @@ let package = Package(
dependencies: [],
exclude: [
"Formats/v1.md",
"CMakeLists.txt",
],
swiftSettings: commonExperimentalFeatures + [
.unsafeFlags(["-static"]),
Expand All @@ -437,6 +438,7 @@ let package = Package(
"PackageModel",
"SourceControl",
],
exclude: ["CMakeLists.txt"],
swiftSettings: swift6CompatibleExperimentalFeatures + [
.unsafeFlags(["-static"]),
]
Expand All @@ -450,6 +452,7 @@ let package = Package(
"Basics",
"PackageCollectionsModel",
],
exclude: ["CMakeLists.txt"],
swiftSettings: commonExperimentalFeatures + [
.unsafeFlags(["-static"]),
]
Expand Down Expand Up @@ -682,6 +685,7 @@ let package = Package(
"SPMBuildCore",
"Workspace",
],
exclude: ["CMakeLists.txt"],
swiftSettings: commonExperimentalFeatures + [
.unsafeFlags(["-static"]),
]
Expand All @@ -694,6 +698,7 @@ let package = Package(
"Basics",
.product(name: "Crypto", package: "swift-crypto"),
],
exclude: ["CMakeLists.txt"],
swiftSettings: [
.enableExperimentalFeature("StrictConcurrency=complete"),
.unsafeFlags(["-static"]),
Expand Down
1 change: 1 addition & 0 deletions Sources/Basics/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ add_library(Basics
FileSystem/RelativePath.swift
FileSystem/TemporaryFile.swift
FileSystem/TSCAdapters.swift
FileSystem/VirtualFileSystem.swift
FileSystem/VFSOverlay.swift
Graph/AdjacencyMatrix.swift
Graph/DirectedGraph.swift
Expand Down
6 changes: 6 additions & 0 deletions Sources/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ add_subdirectory(CompilerPluginSupport)
add_subdirectory(CoreCommands)
add_subdirectory(DriverSupport)
add_subdirectory(LLBuildManifest)
add_subdirectory(PackageCollections)
add_subdirectory(PackageCollectionsModel)
add_subdirectory(PackageCollectionsSigning)
add_subdirectory(PackageDescription)
add_subdirectory(PackageFingerprint)
add_subdirectory(PackageGraph)
Expand All @@ -25,7 +28,9 @@ add_subdirectory(PackageModel)
add_subdirectory(PackageModelSyntax)
add_subdirectory(PackagePlugin)
add_subdirectory(PackageRegistry)
add_subdirectory(PackageRegistryCommand)
add_subdirectory(PackageSigning)
add_subdirectory(QueryEngine)
add_subdirectory(SourceControl)
add_subdirectory(SourceKitLSPAPI)
add_subdirectory(SPMBuildCore)
Expand All @@ -43,3 +48,4 @@ add_subdirectory(SwiftSDKCommand)
add_subdirectory(Workspace)
add_subdirectory(XCBuildSupport)
add_subdirectory(SwiftBuildSupport)
add_subdirectory(tsan_utils)
61 changes: 61 additions & 0 deletions Sources/PackageCollections/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# This source file is part of the Swift open source project
#
# Copyright (c) 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/CVE.swift
Model/Collection.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
Basics
PackageCollectionsModel
PackageCollectionsSigning
PackageModel
SourceControl
TSCBasic
TSCUtility)
if(NOT APPLE)
if(Foundation_FOUND)
target_link_directories(PackageCollections PRIVATE
$<TARGET_LINKER_FILE_DIR:Fooundation>)
endif()
if(dispatch_FOUND)
target_link_directories(PackageCollections PRIVATE
$<TARGET_LINKER_FILE_DIR:Dispatch>)
endif()
endif()

install(TARGETS PackageCollections
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin)
25 changes: 25 additions & 0 deletions Sources/PackageCollectionsModel/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# This source file is part of the Swift open source project
#
# Copyright (c) 2014 - 2024 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})
if(NOT APPLE)
if(Foundation_FOUND)
target_link_directories(PackageCollectionsModel PRIVATE
$<TARGET_LINKER_FILE_DIR:Fooundation>)
endif()
endif()

install(TARGETS PackageCollectionsModel
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin)
41 changes: 41 additions & 0 deletions Sources/PackageCollectionsSigning/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# This source file is part of the Swift open source project
#
# Copyright (c) 2014 - 2024 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
CertificatePolicy.swift
PackageCollectionSigning.swift
Signature.swift
Utilities/Base64URL.swift
Utilities/Utilities.swift
X509Extensions.swift
embedded_resources.swift)
# NOTE(compnerd) workaround for CMake not setting up include flags yet
set_target_properties(PackageCollectionsSigning PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY})
target_link_libraries(PackageCollectionsSigning PUBLIC
Basics
PackageCollectionsModel
Crypto
_CryptoExtras
SwiftASN1
X509)
if(NOT APPLE)
if(Foundation_FOUND)
target_link_directories(PackageCollectionsSigning PRIVATE
$<TARGET_LINKER_FILE_DIR:Fooundation>)
endif()
if(dispatch_FOUND)
target_link_directories(PackageCollectionsSigning PRIVATE
$<TARGET_LINKER_FILE_DIR:dispatch>)
endif()
endif()

install(TARGETS PackageCollectionsSigning
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin)
39 changes: 39 additions & 0 deletions Sources/PackageRegistryCommand/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# This source file is part of the Swift open source project
#
# Copyright (c) 2014 - 2024 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(PackageRegistryCommand
PackageRegistryCommand+Auth.swift
PackageRegistryCommand+Publish.swift
PackageRegistryCommand.swift)
# NOTE(compnerd) workaround for CMake not setting up include flags yet
set_target_properties(PackageRegistryCommand PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY})
target_link_libraries(PackageRegistryCommand PUBLIC
Basics
Commands
CoreCommands
PackageFingerprint
PackageModel
PackageRegistry
PackageSigning
Workspace
ArgumentParser
TSCBasic
TSCUtility
X509)
if(NOT APPLE)
if(Foundation_FOUND)
target_link_directories(PackageRegistryCommand PRIVATE
$<TARGET_LINKER_FILE_DIR:Fooundation>)
endif()
endif()

install(TARGETS PackageRegistryCommand
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin)
32 changes: 32 additions & 0 deletions Sources/QueryEngine/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# This source file is part of the Swift open source project
#
# Copyright (c) 2014 - 2024 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(QueryEngine
CacheKey.swift
FileCacheRecord.swift
Query.swift
QueryEngine.swift)
# NOTE(compnerd) workaround for CMake not setting up include flags yet
set_target_properties(QueryEngine PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY})
target_link_libraries(QueryEngine PUBLIC
_AsyncFileSystem
Basics
Crypto
SwiftSystem::SystemPackage)
if(NOT APPLE)
if(Foundation_FOUND)
target_link_directories(QueryEngine PRIVATE
$<TARGET_LINKER_FILE_DIR:Foundation>)
endif()
endif()

install(TARGETS QueryEngine
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin)
12 changes: 12 additions & 0 deletions Sources/tsan_utils/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# This source file is part of the Swift open source project
#
# Copyright (c) 2014 - 2024 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(tsan_utils STATIC
tsan_utils.c)
target_include_directories(tsan_utils PUBLIC
include)