@@ -70,6 +70,11 @@ var dependencies: [Package.Dependency] {
70
70
}
71
71
}
72
72
73
+ let wasiLibcCSettings : [ CSetting ] = [
74
+ . define( " _WASI_EMULATED_SIGNAL " , . when( platforms: [ . wasi] ) ) ,
75
+ . define( " _WASI_EMULATED_MMAN " , . when( platforms: [ . wasi] ) ) ,
76
+ ]
77
+
73
78
let package = Package (
74
79
name: " FoundationPreview " ,
75
80
platforms: [ . macOS( " 13.3 " ) , . iOS( " 16.4 " ) , . tvOS( " 16.4 " ) , . watchOS( " 9.4 " ) ] ,
@@ -88,18 +93,27 @@ let package = Package(
88
93
" FoundationEssentials " ,
89
94
" FoundationInternationalization " ,
90
95
] ,
91
- path: " Sources/Foundation " ) ,
96
+ path: " Sources/Foundation " ,
97
+ cSettings: wasiLibcCSettings) ,
92
98
93
99
// _FoundationCShims (Internal)
94
- . target( name: " _FoundationCShims " ,
95
- cSettings: [ . define( " _CRT_SECURE_NO_WARNINGS " ,
96
- . when( platforms: [ . windows] ) ) ] ) ,
100
+ . target(
101
+ name: " _FoundationCShims " ,
102
+ cSettings: [
103
+ . define( " _CRT_SECURE_NO_WARNINGS " , . when( platforms: [ . windows] ) )
104
+ ] + wasiLibcCSettings
105
+ ) ,
97
106
98
107
// TestSupport (Internal)
99
- . target( name: " TestSupport " , dependencies: [
100
- " FoundationEssentials " ,
101
- " FoundationInternationalization " ,
102
- ] , swiftSettings: availabilityMacros + concurrencyChecking) ,
108
+ . target(
109
+ name: " TestSupport " ,
110
+ dependencies: [
111
+ " FoundationEssentials " ,
112
+ " FoundationInternationalization " ,
113
+ ] ,
114
+ cSettings: wasiLibcCSettings,
115
+ swiftSettings: availabilityMacros + concurrencyChecking
116
+ ) ,
103
117
104
118
// FoundationEssentials
105
119
. target(
@@ -130,11 +144,14 @@ let package = Package(
130
144
] ,
131
145
cSettings: [
132
146
. define( " _GNU_SOURCE " , . when( platforms: [ . linux] ) )
133
- ] ,
147
+ ] + wasiLibcCSettings ,
134
148
swiftSettings: [
135
149
. enableExperimentalFeature( " VariadicGenerics " ) ,
136
150
. enableExperimentalFeature( " AccessLevelOnImport " )
137
- ] + availabilityMacros + concurrencyChecking
151
+ ] + availabilityMacros + concurrencyChecking,
152
+ linkerSettings: [
153
+ . linkedLibrary( " wasi-emulated-getpid " , . when( platforms: [ . wasi] ) ) ,
154
+ ]
138
155
) ,
139
156
. testTarget(
140
157
name: " FoundationEssentialsTests " ,
@@ -166,6 +183,7 @@ let package = Package(
166
183
" CMakeLists.txt " ,
167
184
" Predicate/CMakeLists.txt "
168
185
] ,
186
+ cSettings: wasiLibcCSettings,
169
187
swiftSettings: [
170
188
. enableExperimentalFeature( " AccessLevelOnImport " )
171
189
] + availabilityMacros + concurrencyChecking
0 commit comments