Skip to content

Commit a9ffa77

Browse files

Some content is hidden

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

45 files changed

+37102
-1215
lines changed
 

‎Package.swift

+32-25
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,15 @@
33

44
import PackageDescription
55

6-
let buildSettings: [CSetting] = [
6+
let coreFoundationBuildSettings: [CSetting] = [
77
.headerSearchPath("internalInclude"),
88
.define("DEBUG", .when(configuration: .debug)),
99
.define("CF_BUILDING_CF"),
10-
.define("DEPLOYMENT_RUNTIME_SWIFT"),
1110
.define("DEPLOYMENT_ENABLE_LIBDISPATCH"),
11+
.define("DEPLOYMENT_RUNTIME_SWIFT"),
1212
.define("HAVE_STRUCT_TIMESPEC"),
1313
.define("SWIFT_CORELIBS_FOUNDATION_HAS_THREADS"),
1414
.define("_GNU_SOURCE", .when(platforms: [.linux, .android])),
15-
.define("CF_CHARACTERSET_UNICODE_DATA_L", to: "\"\(Context.packageDirectory)/Sources/CoreFoundation/CFUnicodeData-L.mapping\""),
16-
.define("CF_CHARACTERSET_UNICODE_DATA_B", to: "\"\(Context.packageDirectory)/Sources/CoreFoundation/CFUnicodeData-B.mapping\""),
17-
.define("CF_CHARACTERSET_UNICHAR_DB", to: "\"\(Context.packageDirectory)/Sources/CoreFoundation/CFUniCharPropertyDatabase.data\""),
18-
.define("CF_CHARACTERSET_BITMAP", to: "\"\(Context.packageDirectory)/Sources/CoreFoundation/CFCharacterSetBitmaps.bitmap\""),
1915
.unsafeFlags([
2016
"-Wno-shorten-64-to-32",
2117
"-Wno-deprecated-declarations",
@@ -29,6 +25,8 @@ let buildSettings: [CSetting] = [
2925
"-fdollars-in-identifiers",
3026
"-fno-common",
3127
"-fcf-runtime-abi=swift",
28+
"-include",
29+
"\(Context.packageDirectory)/Sources/CoreFoundation/internalInclude/CoreFoundation_Prefix.h",
3230
// /EHsc for Windows
3331
]),
3432
.unsafeFlags(["-I/usr/lib/swift"], .when(platforms: [.linux, .android])) // dispatch
@@ -40,7 +38,6 @@ let interfaceBuildSettings: [CSetting] = [
4038
.headerSearchPath("../CoreFoundation/include"),
4139
.define("DEBUG", .when(configuration: .debug)),
4240
.define("CF_BUILDING_CF"),
43-
.define("DEPLOYMENT_RUNTIME_SWIFT"),
4441
.define("DEPLOYMENT_ENABLE_LIBDISPATCH"),
4542
.define("HAVE_STRUCT_TIMESPEC"),
4643
.define("SWIFT_CORELIBS_FOUNDATION_HAS_THREADS"),
@@ -63,9 +60,15 @@ let interfaceBuildSettings: [CSetting] = [
6360
.unsafeFlags(["-I/usr/lib/swift"], .when(platforms: [.linux, .android])) // dispatch
6461
]
6562

63+
let swiftBuildSettings: [SwiftSetting] = [
64+
.define("DEPLOYMENT_RUNTIME_SWIFT"),
65+
.define("SWIFT_CORELIBS_FOUNDATION_HAS_THREADS"),
66+
]
67+
6668
let package = Package(
6769
name: "swift-corelibs-foundation",
68-
platforms: [.macOS("13.3"), .iOS("16.4"), .tvOS("16.4"), .watchOS("9.4")],
70+
// Deployment target note: This package only builds for non-Darwin targets.
71+
platforms: [.macOS("99.9")],
6972
products: [
7073
.library(name: "Foundation", targets: ["Foundation"]),
7174
.library(name: "FoundationXML", targets: ["FoundationXML"]),
@@ -75,7 +78,8 @@ let package = Package(
7578
dependencies: [
7679
.package(
7780
url: "https://github.com/apple/swift-foundation-icu",
78-
from: "0.0.5"),
81+
from: "0.0.5"
82+
),
7983
.package(
8084
url: "https://github.com/apple/swift-foundation",
8185
revision: "e991656bd02af48530811f1871b3351961b75d29"
@@ -90,37 +94,37 @@ let package = Package(
9094
"_CoreFoundation"
9195
],
9296
path: "Sources/Foundation",
93-
swiftSettings: [.define("DEPLOYMENT_RUNTIME_SWIFT"), .define("SWIFT_CORELIBS_FOUNDATION_HAS_THREADS")]
97+
swiftSettings: swiftBuildSettings
9498
),
9599
.target(
96100
name: "FoundationXML",
97101
dependencies: [
98102
.product(name: "FoundationEssentials", package: "swift-foundation"),
99-
"Foundation",
103+
.targetItem(name: "Foundation", condition: nil),
100104
"_CoreFoundation",
101105
"_CFXMLInterface"
102106
],
103107
path: "Sources/FoundationXML",
104-
swiftSettings: [.define("DEPLOYMENT_RUNTIME_SWIFT"), .define("SWIFT_CORELIBS_FOUNDATION_HAS_THREADS")]
108+
swiftSettings: swiftBuildSettings
105109
),
106110
.target(
107111
name: "FoundationNetworking",
108112
dependencies: [
109113
.product(name: "FoundationEssentials", package: "swift-foundation"),
110-
"Foundation",
114+
.targetItem(name: "Foundation", condition: nil),
111115
"_CoreFoundation",
112116
"_CFURLSessionInterface"
113117
],
114118
path: "Sources/FoundationNetworking",
115-
swiftSettings: [.define("DEPLOYMENT_RUNTIME_SWIFT"), .define("SWIFT_CORELIBS_FOUNDATION_HAS_THREADS")]
119+
swiftSettings:swiftBuildSettings
116120
),
117121
.target(
118122
name: "_CoreFoundation",
119123
dependencies: [
120124
.product(name: "FoundationICU", package: "swift-foundation-icu"),
121125
],
122126
path: "Sources/CoreFoundation",
123-
cSettings: buildSettings
127+
cSettings: coreFoundationBuildSettings
124128
),
125129
.target(
126130
name: "_CFXMLInterface",
@@ -158,33 +162,36 @@ let package = Package(
158162
),
159163
.executableTarget(
160164
name: "plutil",
161-
dependencies: ["Foundation"]
165+
dependencies: [
166+
.targetItem(name: "Foundation", condition: nil)
167+
]
162168
),
163169
.executableTarget(
164170
name: "xdgTestHelper",
165171
dependencies: [
166-
"Foundation",
167-
"FoundationNetworking"
172+
.targetItem(name: "Foundation", condition: nil),
173+
.targetItem(name: "FoundationXML", condition: nil),
174+
.targetItem(name: "FoundationNetworking", condition: nil)
168175
]
169176
),
170177
.target(
171178
// swift-corelibs-foundation has a copy of XCTest's sources so:
172179
// (1) we do not depend on the toolchain's XCTest, which depends on toolchain's Foundation, which we cannot pull in at the same time as a Foundation package
173180
// (2) we do not depend on a swift-corelibs-xctest Swift package, which depends on Foundation, which causes a circular dependency in swiftpm
174181
// We believe Foundation is the only project that needs to take this rather drastic measure.
175-
name: "XCTest",
182+
name: "XCTest",
176183
dependencies: [
177-
"Foundation"
178-
],
184+
.targetItem(name: "Foundation", condition: nil)
185+
],
179186
path: "Sources/XCTest"
180187
),
181188
.testTarget(
182189
name: "TestFoundation",
183190
dependencies: [
184-
"Foundation",
185-
"FoundationXML",
186-
"FoundationNetworking",
187-
"XCTest",
191+
.targetItem(name: "Foundation", condition: nil),
192+
.targetItem(name: "FoundationXML", condition: nil),
193+
.targetItem(name: "FoundationNetworking", condition: nil),
194+
.targetItem(name: "XCTest", condition: .when(platforms: [.linux])),
188195
"xdgTestHelper"
189196
],
190197
resources: [

0 commit comments

Comments
 (0)
Please sign in to comment.