@@ -185,6 +185,18 @@ package.targets.append(contentsOf: [
185185] )
186186#endif
187187
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+
188200extension Array where Element == PackageDescription . SwiftSetting {
189201 /// Settings intended to be applied to every Swift target in this package.
190202 /// Analogous to project-level build settings in an Xcode project.
@@ -208,17 +220,18 @@ extension Array where Element == PackageDescription.SwiftSetting {
208220 // (via CMake). Enabling it is dependent on acceptance of the @section
209221 // proposal via Swift Evolution.
210222 . enableExperimentalFeature( " SymbolLinkageMarkers " ) ,
223+ . enableExperimentalFeature( " RawLayout " , . whenStaticallyLinked) ,
211224
212225 // When building as a package, the macro plugin always builds as an
213226 // executable rather than a library.
214227 . define( " SWT_NO_LIBRARY_MACRO_PLUGINS " ) ,
215228
216- . define( " SWT_TARGET_OS_APPLE " , . when ( platforms : [ . macOS , . iOS , . macCatalyst , . watchOS , . tvOS , . visionOS ] ) ) ,
229+ . define( " SWT_TARGET_OS_APPLE " , . whenApple ) ,
217230
218231 . define( " SWT_NO_EXIT_TESTS " , . when( platforms: [ . iOS, . watchOS, . tvOS, . visionOS, . wasi, . android] ) ) ,
219232 . define( " SWT_NO_PROCESS_SPAWNING " , . when( platforms: [ . iOS, . watchOS, . tvOS, . visionOS, . wasi, . android] ) ) ,
220233 . 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 ) ,
222235 . define( " SWT_NO_PIPES " , . when( platforms: [ . wasi] ) ) ,
223236 ]
224237
@@ -256,7 +269,7 @@ extension Array where Element == PackageDescription.SwiftSetting {
256269 if buildingForDevelopment {
257270 var condition : BuildSettingCondition ?
258271 if applePlatformsOnly {
259- condition = . when ( platforms : [ . macOS , . iOS , . macCatalyst , . watchOS , . tvOS , . visionOS ] )
272+ condition = . whenApple
260273 }
261274 result. append ( . unsafeFlags( [ " -enable-library-evolution " ] , condition) )
262275 }
@@ -275,7 +288,7 @@ extension Array where Element == PackageDescription.CXXSetting {
275288 . define( " SWT_NO_EXIT_TESTS " , . when( platforms: [ . iOS, . watchOS, . tvOS, . visionOS, . wasi, . android] ) ) ,
276289 . define( " SWT_NO_PROCESS_SPAWNING " , . when( platforms: [ . iOS, . watchOS, . tvOS, . visionOS, . wasi, . android] ) ) ,
277290 . 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 ) ,
279292 . define( " SWT_NO_PIPES " , . when( platforms: [ . wasi] ) ) ,
280293 ]
281294
0 commit comments