@@ -185,6 +185,18 @@ package.targets.append(contentsOf: [
185
185
] )
186
186
#endif
187
187
188
+ extension BuildSettingCondition {
189
+ /// A build setting condition matching all Apple platforms.
190
+ static var whenApple : Self {
191
+ . when( platforms: [ . macOS, . iOS, . macCatalyst, . watchOS, . tvOS, . visionOS] )
192
+ }
193
+
194
+ /// A build setting condition matching platforms that use static linkage.
195
+ static var whenStaticallyLinked : Self {
196
+ . when( platforms: [ . wasi] )
197
+ }
198
+ }
199
+
188
200
extension Array where Element == PackageDescription . SwiftSetting {
189
201
/// Settings intended to be applied to every Swift target in this package.
190
202
/// Analogous to project-level build settings in an Xcode project.
@@ -208,17 +220,18 @@ extension Array where Element == PackageDescription.SwiftSetting {
208
220
// (via CMake). Enabling it is dependent on acceptance of the @section
209
221
// proposal via Swift Evolution.
210
222
. enableExperimentalFeature( " SymbolLinkageMarkers " ) ,
223
+ . enableExperimentalFeature( " RawLayout " , . whenStaticallyLinked) ,
211
224
212
225
// When building as a package, the macro plugin always builds as an
213
226
// executable rather than a library.
214
227
. define( " SWT_NO_LIBRARY_MACRO_PLUGINS " ) ,
215
228
216
- . define( " SWT_TARGET_OS_APPLE " , . when ( platforms : [ . macOS , . iOS , . macCatalyst , . watchOS , . tvOS , . visionOS ] ) ) ,
229
+ . define( " SWT_TARGET_OS_APPLE " , . whenApple ) ,
217
230
218
231
. define( " SWT_NO_EXIT_TESTS " , . when( platforms: [ . iOS, . watchOS, . tvOS, . visionOS, . wasi, . android] ) ) ,
219
232
. define( " SWT_NO_PROCESS_SPAWNING " , . when( platforms: [ . iOS, . watchOS, . tvOS, . visionOS, . wasi, . android] ) ) ,
220
233
. define( " SWT_NO_SNAPSHOT_TYPES " , . when( platforms: [ . linux, . custom( " freebsd " ) , . openbsd, . windows, . wasi, . android] ) ) ,
221
- . define( " SWT_NO_DYNAMIC_LINKING " , . when ( platforms : [ . wasi ] ) ) ,
234
+ . define( " SWT_NO_DYNAMIC_LINKING " , . whenStaticallyLinked ) ,
222
235
. define( " SWT_NO_PIPES " , . when( platforms: [ . wasi] ) ) ,
223
236
]
224
237
@@ -256,7 +269,7 @@ extension Array where Element == PackageDescription.SwiftSetting {
256
269
if buildingForDevelopment {
257
270
var condition : BuildSettingCondition ?
258
271
if applePlatformsOnly {
259
- condition = . when ( platforms : [ . macOS , . iOS , . macCatalyst , . watchOS , . tvOS , . visionOS ] )
272
+ condition = . whenApple
260
273
}
261
274
result. append ( . unsafeFlags( [ " -enable-library-evolution " ] , condition) )
262
275
}
@@ -275,7 +288,7 @@ extension Array where Element == PackageDescription.CXXSetting {
275
288
. define( " SWT_NO_EXIT_TESTS " , . when( platforms: [ . iOS, . watchOS, . tvOS, . visionOS, . wasi, . android] ) ) ,
276
289
. define( " SWT_NO_PROCESS_SPAWNING " , . when( platforms: [ . iOS, . watchOS, . tvOS, . visionOS, . wasi, . android] ) ) ,
277
290
. define( " SWT_NO_SNAPSHOT_TYPES " , . when( platforms: [ . linux, . custom( " freebsd " ) , . openbsd, . windows, . wasi, . android] ) ) ,
278
- . define( " SWT_NO_DYNAMIC_LINKING " , . when ( platforms : [ . wasi ] ) ) ,
291
+ . define( " SWT_NO_DYNAMIC_LINKING " , . whenStaticallyLinked ) ,
279
292
. define( " SWT_NO_PIPES " , . when( platforms: [ . wasi] ) ) ,
280
293
]
281
294
0 commit comments