Skip to content

Commit 8176d11

Browse files
[Build] Repair WASI build with SwiftPM
1 parent f0a3631 commit 8176d11

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

Package.swift

+15-6
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,12 @@ let coreFoundationBuildSettings: [CSetting] = [
3939
.headerSearchPath("internalInclude"),
4040
.define("DEBUG", .when(configuration: .debug)),
4141
.define("CF_BUILDING_CF"),
42-
.define("DEPLOYMENT_ENABLE_LIBDISPATCH"),
42+
.define("DEPLOYMENT_ENABLE_LIBDISPATCH", .when(platforms: platformsWithThreads)),
4343
.define("DEPLOYMENT_RUNTIME_SWIFT"),
4444
.define("HAVE_STRUCT_TIMESPEC"),
4545
.define("SWIFT_CORELIBS_FOUNDATION_HAS_THREADS", .when(platforms: platformsWithThreads)),
4646
.define("_GNU_SOURCE", .when(platforms: [.linux, .android])),
4747
.define("_WASI_EMULATED_SIGNAL", .when(platforms: [.wasi])),
48-
.define("HAVE_STRLCPY", .when(platforms: [.wasi])),
49-
.define("HAVE_STRLCAT", .when(platforms: [.wasi])),
5048
.unsafeFlags([
5149
"-Wno-shorten-64-to-32",
5250
"-Wno-deprecated-declarations",
@@ -78,8 +76,6 @@ let interfaceBuildSettings: [CSetting] = [
7876
.define("SWIFT_CORELIBS_FOUNDATION_HAS_THREADS", .when(platforms: platformsWithThreads)),
7977
.define("_GNU_SOURCE", .when(platforms: [.linux, .android])),
8078
.define("_WASI_EMULATED_SIGNAL", .when(platforms: [.wasi])),
81-
.define("HAVE_STRLCPY", .when(platforms: [.wasi])),
82-
.define("HAVE_STRLCAT", .when(platforms: [.wasi])),
8379
.unsafeFlags([
8480
"-Wno-shorten-64-to-32",
8581
"-Wno-deprecated-declarations",
@@ -161,7 +157,8 @@ let package = Package(
161157
.product(name: "FoundationEssentials", package: "swift-foundation"),
162158
"Foundation",
163159
"CoreFoundation",
164-
"_CFXMLInterface"
160+
"_CFXMLInterface",
161+
.target(name: "BlocksRuntime", condition: .when(platforms: [.wasi])),
165162
],
166163
path: "Sources/FoundationXML",
167164
exclude: [
@@ -187,6 +184,7 @@ let package = Package(
187184
name: "CoreFoundation",
188185
dependencies: [
189186
.product(name: "_FoundationICU", package: "swift-foundation-icu"),
187+
.target(name: "BlocksRuntime", condition: .when(platforms: [.wasi])),
190188
],
191189
path: "Sources/CoreFoundation",
192190
exclude: [
@@ -195,6 +193,17 @@ let package = Package(
195193
],
196194
cSettings: coreFoundationBuildSettings
197195
),
196+
.target(
197+
name: "BlocksRuntime",
198+
path: "Sources/CoreFoundation/BlockRuntime",
199+
exclude: [
200+
"CMakeLists.txt"
201+
],
202+
cSettings: [
203+
// For CFTargetConditionals.h
204+
.headerSearchPath("../include"),
205+
]
206+
),
198207
.target(
199208
name: "_CFXMLInterface",
200209
dependencies: [

0 commit comments

Comments
 (0)