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