Skip to content
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
57 changes: 30 additions & 27 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -185,20 +185,6 @@ let package = Package(
),
],
targets: [
// The `PackageDescription` target provides the API that is available
// to `Package.swift` manifests. Here we build a debug version of the
// library; the bootstrap scripts build the deployable version.
.target(
name: "PackageDescription",
exclude: ["CMakeLists.txt"],
swiftSettings: commonExperimentalFeatures + [
.define("USE_IMPL_ONLY_IMPORTS"),
.unsafeFlags(["-package-description-version", "999.0"]),
.unsafeFlags(["-enable-library-evolution"]),
],
linkerSettings: packageLibraryLinkSettings
),

// The `AppleProductTypes` target provides additional product types
// to `Package.swift` manifests. Here we build a debug version of the
// library; the bootstrap scripts build the deployable version.
Expand All @@ -214,19 +200,6 @@ let package = Package(
.unsafeFlags(["-Xfrontend", "-module-link-name", "-Xfrontend", "AppleProductTypes"])
]),

// The `PackagePlugin` target provides the API that is available to
// plugin scripts. Here we build a debug version of the library; the
// bootstrap scripts build the deployable version.
.target(
name: "PackagePlugin",
exclude: ["CMakeLists.txt"],
swiftSettings: commonExperimentalFeatures + [
.unsafeFlags(["-package-description-version", "999.0"]),
.unsafeFlags(["-enable-library-evolution"]),
],
linkerSettings: packageLibraryLinkSettings
),

.target(
name: "SourceKitLSPAPI",
dependencies: [
Expand Down Expand Up @@ -776,11 +749,41 @@ let package = Package(
]
),

// The `PackageDescription` target provides the API that is available
// to `Package.swift` manifests. Here we build a debug version of the
// library; the bootstrap scripts build the deployable version.
.target(
name: "PackageDescription",
path: "Sources/Runtime/PackageDescription",
exclude: ["CMakeLists.txt"],
swiftSettings: commonExperimentalFeatures + [
.define("USE_IMPL_ONLY_IMPORTS"),
.unsafeFlags(["-package-description-version", "999.0"]),
.unsafeFlags(["-enable-library-evolution"]),
],
linkerSettings: packageLibraryLinkSettings
),

// The `PackagePlugin` target provides the API that is available to
// plugin scripts. Here we build a debug version of the library; the
// bootstrap scripts build the deployable version.
.target(
name: "PackagePlugin",
path: "Sources/Runtime/PackagePlugin",
exclude: ["CMakeLists.txt"],
swiftSettings: commonExperimentalFeatures + [
.unsafeFlags(["-package-description-version", "999.0"]),
.unsafeFlags(["-enable-library-evolution"]),
],
linkerSettings: packageLibraryLinkSettings
),

// MARK: Support for Swift macros, should eventually move to a plugin-based solution

.target(
name: "CompilerPluginSupport",
dependencies: ["PackageDescription"],
path: "Sources/Runtime/CompilerPluginSupport",
exclude: ["CMakeLists.txt"],
swiftSettings: commonExperimentalFeatures + [
.unsafeFlags(["-package-description-version", "999.0"]),
Expand Down
3 changes: 0 additions & 3 deletions Sources/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,16 @@ add_subdirectory(Basics)
add_subdirectory(BinarySymbols)
add_subdirectory(Build)
add_subdirectory(Commands)
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)
add_subdirectory(PackageLoading)
add_subdirectory(PackageModel)
add_subdirectory(PackagePlugin)
add_subdirectory(PackageRegistry)
add_subdirectory(PackageRegistryCommand)
add_subdirectory(PackageSigning)
Expand Down
50 changes: 0 additions & 50 deletions Sources/CompilerPluginSupport/CMakeLists.txt

This file was deleted.

65 changes: 0 additions & 65 deletions Sources/PackageDescription/CMakeLists.txt

This file was deleted.

1 change: 0 additions & 1 deletion Sources/PackageDescription/ContextModel.swift

This file was deleted.

73 changes: 0 additions & 73 deletions Sources/PackagePlugin/CMakeLists.txt

This file was deleted.

43 changes: 43 additions & 0 deletions Sources/Runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# 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

cmake_minimum_required(VERSION 3.29)

if(POLICY CMP0157 AND CMAKE_Swift_COMPILER_USE_OLD_DRIVER)
cmake_policy(SET CMP0157 OLD)
endif()

project(SwiftPMRuntime
LANGUAGES Swift)

# TODO(compnerd) C is being enabled as a workaround for `GNUInstallDirs` not
# being aware of Swift-only projects. Remove this once that is updated and we
# have updated to a newer CMake minimum version.
enable_language(C)
include(GNUInstallDirs)

set(CMAKE_INSTALL_NAME_DIR "@rpath")
set(CMAKE_INSTALL_RPATH "$ORIGIN/../../$<LOWER_CASE:${CMAKE_SYSTEM_NAME}>")
set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreadedDLL)
set(CMAKE_POSITION_INDEPENDENT_CODE ${BUILD_SHARED_LIBS})
set(CMAKE_Swift_LANGUAGE_VERSION 5)
set(CMAKE_Swift_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY MultiThreadedDLL)

set(SwiftPMRuntime_ENABLE_LIBRARY_EVOLUTION YES)
add_compile_options(-enable-library-evolution)

add_compile_options(-package-description-version 999.0)

list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)
include(PlatformInfo)
include(EmitSwiftInterface)
include(InstallSwiftInterface)

add_subdirectory(PackageDescription)
add_subdirectory(CompilerPluginSupport)
add_subdirectory(PackagePlugin)
29 changes: 29 additions & 0 deletions Sources/Runtime/CompilerPluginSupport/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# This source file is part of the Swift open source project
#
# Copyright (c) 2023 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(CompilerPluginSupport SHARED
TargetExtensions.swift)

target_link_libraries(CompilerPluginSupport PRIVATE
PackageDescription)

if(APPLE)
target_link_options(CompilerPluginSupport PRIVATE
"SHELL:-Xlinker -install_name -Xlinker @rpath/CompilerPluginSupport.dylib")
else()
target_link_libraries(CompilerPluginSupport PRIVATE
Foundation)
endif()

install(TARGETS CompilerPluginSupport
DESTINATION ${CMAKE_INSTALL_LIBDIR}/swift/pm/ManifestAPI)

set(SwiftPMRuntime_INSTALL_SWIFTMODULEDIR
${CMAKE_INSTALL_LIBDIR}/swift/pm/ManifestAPI)
emit_swift_interface(CompilerPluginSupport)
install_swift_interface(CompilerPluginSupport)
Loading