Skip to content

Commit acae7c4

Browse files
committed
Runtime: extract a Runtime subdirectory for SPM
Re-organise the "runtime" components (i.e. the Package Manifest runtime) into a separate directory. Introduce a separate CMake project for the build of this runtime to allow building the SPM tool with one version of the Swift runtime and the SPM Manifest Runtime witih a separate Swift runtime.
1 parent 7046c68 commit acae7c4

File tree

154 files changed

+252
-194
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

154 files changed

+252
-194
lines changed

Sources/CMakeLists.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,16 @@ add_subdirectory(Basics)
1313
add_subdirectory(BinarySymbols)
1414
add_subdirectory(Build)
1515
add_subdirectory(Commands)
16-
add_subdirectory(CompilerPluginSupport)
1716
add_subdirectory(CoreCommands)
1817
add_subdirectory(DriverSupport)
1918
add_subdirectory(LLBuildManifest)
2019
add_subdirectory(PackageCollections)
2120
add_subdirectory(PackageCollectionsModel)
2221
add_subdirectory(PackageCollectionsSigning)
23-
add_subdirectory(PackageDescription)
2422
add_subdirectory(PackageFingerprint)
2523
add_subdirectory(PackageGraph)
2624
add_subdirectory(PackageLoading)
2725
add_subdirectory(PackageModel)
28-
add_subdirectory(PackagePlugin)
2926
add_subdirectory(PackageRegistry)
3027
add_subdirectory(PackageRegistryCommand)
3128
add_subdirectory(PackageSigning)
@@ -48,3 +45,5 @@ add_subdirectory(Workspace)
4845
add_subdirectory(XCBuildSupport)
4946
add_subdirectory(SwiftBuildSupport)
5047
add_subdirectory(tsan_utils)
48+
49+
add_subdirectory(Runtimes)

Sources/CompilerPluginSupport/CMakeLists.txt

Lines changed: 0 additions & 50 deletions
This file was deleted.

Sources/PackageDescription/CMakeLists.txt

Lines changed: 0 additions & 65 deletions
This file was deleted.

Sources/PackageDescription/ContextModel.swift

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
../PackageDescription/PackageDescriptionSerialization.swift
1+
S:/SourceCache/swift-project/swift-package-manager/Sources/Runtimes/PackageDescription/PackageDescriptionSerialization.swift

Sources/PackagePlugin/CMakeLists.txt

Lines changed: 0 additions & 73 deletions
This file was deleted.

Sources/Runtimes/CMakeLists.txt

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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+
cmake_minimum_required(VERSION 3.29)
10+
11+
if(POLICY CMP0157 AND CMAKE_Swift_COMPILER_USE_OLD_DRIVER)
12+
cmake_policy(SET CMP0157 OLD)
13+
endif()
14+
15+
project(SwiftPMRuntime
16+
LANGUAGES Swift)
17+
18+
# TODO(compnerd) C is being enabled as a workaround for `GNUInstallDirs` not
19+
# being aware of Swift-only projects. Remove this once that is updated and we
20+
# have updated to a newer CMake minimum version.
21+
enable_language(C)
22+
include(GNUInstallDirs)
23+
24+
set(CMAKE_INSTALL_NAME_DIR "@rpath")
25+
set(CMAKE_INSTALL_RPATH "$ORIGIN/../../$<LOWER_CASE:${CMAKE_SYSTEM_NAME}>")
26+
set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreadedDLL)
27+
set(CMAKE_POSITION_INDEPENDENT_CODE ${BUILD_SHARED_LIBS})
28+
set(CMAKE_Swift_LANGUAGE_VERSION 5)
29+
set(CMAKE_Swift_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY MultiThreadedDLL)
30+
31+
set(SwiftPMRuntime_ENABLE_LIBRARY_EVOLUTION YES)
32+
add_compile_options(-enable-library-evolution)
33+
34+
add_compile_options(-package-description-version 999.0)
35+
36+
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)
37+
include(PlatformInfo)
38+
include(EmitSwiftInterface)
39+
include(InstallSwiftInterface)
40+
41+
add_subdirectory(PackageDescription)
42+
add_subdirectory(CompilerPluginSupport)
43+
add_subdirectory(PackagePlugin)
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# This source file is part of the Swift open source project
2+
#
3+
# Copyright (c) 2023 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(CompilerPluginSupport
10+
TargetExtensions.swift)
11+
target_link_libraries(CompilerPluginSupport PRIVATE
12+
PackageDescription)
13+
14+
if(APPLE)
15+
target_link_options(CompilerPluginSupport PRIVATE
16+
"SHELL:-Xlinker -install_name -Xlinker @rpath/CompilerPluginSupport.dylib")
17+
else()
18+
target_link_libraries(CompilerPluginSupport PRIVATE
19+
Foundation)
20+
endif()
21+
22+
install(TARGETS CompilerPluginSupport
23+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/swift/pm/ManifestAPI)
24+
25+
set(SwiftPMRuntime_INSTALL_SWIFTMODULEDIR
26+
${CMAKE_INSTALL_LIBDIR}/swift/pm/ManifestAPI)
27+
emit_swift_interface(CompilerPluginSupport)
28+
install_swift_interface(CompilerPluginSupport)
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)