@@ -70,6 +70,12 @@ 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
+ . define( " _WASI_EMULATED_PROCESS_CLOCKS " , . when( platforms: [ . wasi] ) ) ,
77
+ ]
78
+
73
79
let package = Package (
74
80
name: " FoundationPreview " ,
75
81
platforms: [ . macOS( " 13.3 " ) , . iOS( " 16.4 " ) , . tvOS( " 16.4 " ) , . watchOS( " 9.4 " ) ] ,
@@ -88,18 +94,24 @@ let package = Package(
88
94
" FoundationEssentials " ,
89
95
" FoundationInternationalization " ,
90
96
] ,
91
- path: " Sources/Foundation " ) ,
97
+ path: " Sources/Foundation " ,
98
+ cSettings: wasiLibcCSettings) ,
92
99
93
100
// _FoundationCShims (Internal)
94
101
. target( name: " _FoundationCShims " ,
95
102
cSettings: [ . define( " _CRT_SECURE_NO_WARNINGS " ,
96
103
. when( platforms: [ . windows] ) ) ] ) ,
97
104
98
105
// TestSupport (Internal)
99
- . target( name: " TestSupport " , dependencies: [
100
- " FoundationEssentials " ,
101
- " FoundationInternationalization " ,
102
- ] , swiftSettings: availabilityMacros + concurrencyChecking) ,
106
+ . target(
107
+ name: " TestSupport " ,
108
+ dependencies: [
109
+ " FoundationEssentials " ,
110
+ " FoundationInternationalization " ,
111
+ ] ,
112
+ cSettings: wasiLibcCSettings,
113
+ swiftSettings: availabilityMacros + concurrencyChecking
114
+ ) ,
103
115
104
116
// FoundationEssentials
105
117
. target(
@@ -130,7 +142,7 @@ let package = Package(
130
142
] ,
131
143
cSettings: [
132
144
. define( " _GNU_SOURCE " , . when( platforms: [ . linux] ) )
133
- ] ,
145
+ ] + wasiLibcCSettings ,
134
146
swiftSettings: [
135
147
. enableExperimentalFeature( " VariadicGenerics " ) ,
136
148
. enableExperimentalFeature( " AccessLevelOnImport " )
@@ -166,6 +178,7 @@ let package = Package(
166
178
" CMakeLists.txt " ,
167
179
" Predicate/CMakeLists.txt "
168
180
] ,
181
+ cSettings: wasiLibcCSettings,
169
182
swiftSettings: [
170
183
. enableExperimentalFeature( " AccessLevelOnImport " )
171
184
] + availabilityMacros + concurrencyChecking
0 commit comments