Skip to content

Commit 7abf25e

Browse files
Update swift-system to 1.3.0 to get visionOS support
1.3.0 is the version that adds visionOS support and swiftlang/swift project uses this version.
1 parent ad0862a commit 7abf25e

File tree

13 files changed

+42
-27
lines changed

13 files changed

+42
-27
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ if(NOT SwiftSystem_FOUND)
5050
message("-- Vending SwiftSystem")
5151
FetchContent_Declare(SwiftSystem
5252
GIT_REPOSITORY https://github.com/apple/swift-system
53-
GIT_TAG 1.1.1
53+
GIT_TAG 1.3.0
5454
)
5555
FetchContent_MakeAvailable(SwiftSystem)
5656
endif()

Package.swift

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ import PackageDescription
44

55
import class Foundation.ProcessInfo
66

7+
let DarwinPlatforms: [Platform]
8+
#if swift(<5.9)
9+
DarwinPlatforms = [.macOS, .iOS, .watchOS, .tvOS]
10+
#else
11+
DarwinPlatforms = [.macOS, .iOS, .watchOS, .tvOS, .visionOS]
12+
#endif
13+
714
let package = Package(
815
name: "WasmKit",
916
platforms: [.macOS(.v10_13), .iOS(.v12)],
@@ -73,7 +80,10 @@ let package = Package(
7380
dependencies: [
7481
.product(name: "SystemPackage", package: "swift-system")
7582
],
76-
exclude: ["CMakeLists.txt"]
83+
exclude: ["CMakeLists.txt"],
84+
swiftSettings: [
85+
.define("SYSTEM_PACKAGE_DARWIN", .when(platforms: DarwinPlatforms)),
86+
]
7787
),
7888

7989
.executableTarget(
@@ -101,7 +111,7 @@ let package = Package(
101111
if ProcessInfo.processInfo.environment["SWIFTCI_USE_LOCAL_DEPS"] == nil {
102112
package.dependencies += [
103113
.package(url: "https://github.com/apple/swift-argument-parser", from: "1.2.2"),
104-
.package(url: "https://github.com/apple/swift-system", .upToNextMinor(from: "1.2.1")),
114+
.package(url: "https://github.com/apple/swift-system", .upToNextMinor(from: "1.3.0")),
105115
]
106116
} else {
107117
package.dependencies += [

Sources/SystemExtras/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,10 @@ add_wasmkit_library(SystemExtras
99
Syscalls.swift
1010
)
1111

12+
set(SWIFT_SYSTEM_APPLE_PLATFORMS "Darwin" "iOS" "watchOS" "tvOS" "visionOS")
13+
if(CMAKE_SYSTEM_NAME IN_LIST SWIFT_SYSTEM_APPLE_PLATFORMS)
14+
target_compile_definitions(SystemExtras PRIVATE SYSTEM_PACKAGE_DARWIN)
15+
endif()
16+
1217
target_link_wasmkit_libraries(SystemExtras PUBLIC
1318
SystemPackage)

Sources/SystemExtras/Clock.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
1+
#if SYSTEM_PACKAGE_DARWIN
22
import Darwin
33
#elseif os(Linux) || os(FreeBSD) || os(Android)
44
import CSystem
@@ -30,12 +30,12 @@ extension Clock {
3030
public static var boottime: Clock { Clock(rawValue: CLOCK_BOOTTIME) }
3131
#endif
3232

33-
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
33+
#if SYSTEM_PACKAGE_DARWIN
3434
@_alwaysEmitIntoClient
3535
public static var rawMonotonic: Clock { Clock(rawValue: _CLOCK_MONOTONIC_RAW) }
3636
#endif
3737

38-
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) || os(Linux) || os(OpenBSD) || os(FreeBSD) || os(WASI)
38+
#if SYSTEM_PACKAGE_DARWIN || os(Linux) || os(OpenBSD) || os(FreeBSD) || os(WASI)
3939
@_alwaysEmitIntoClient
4040
public static var monotonic: Clock { Clock(rawValue: _CLOCK_MONOTONIC) }
4141
#endif
@@ -45,7 +45,7 @@ extension Clock {
4545
public static var uptime: Clock { Clock(rawValue: _CLOCK_UPTIME) }
4646
#endif
4747

48-
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
48+
#if SYSTEM_PACKAGE_DARWIN
4949
@_alwaysEmitIntoClient
5050
public static var rawUptime: Clock { Clock(rawValue: _CLOCK_UPTIME_RAW) }
5151
#endif

Sources/SystemExtras/Constants.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
1+
#if SYSTEM_PACKAGE_DARWIN
22
import Darwin
33
#elseif os(Linux) || os(FreeBSD) || os(Android)
44
import CSystem
@@ -22,7 +22,7 @@ internal var _AT_SYMLINK_FOLLOW: CInt { AT_SYMLINK_FOLLOW }
2222
@_alwaysEmitIntoClient
2323
internal var _AT_REMOVEDIR: CInt { AT_REMOVEDIR }
2424
#endif
25-
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
25+
#if SYSTEM_PACKAGE_DARWIN
2626
@_alwaysEmitIntoClient
2727
internal var _AT_REALDEV: CInt { AT_REALDEV }
2828
@_alwaysEmitIntoClient
@@ -117,16 +117,16 @@ internal var _S_IFSOCK: CInterop.Mode { S_IFSOCK }
117117
@_alwaysEmitIntoClient
118118
internal var _CLOCK_BOOTTIME: CInterop.ClockId { CLOCK_BOOTTIME }
119119
#endif
120-
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
120+
#if SYSTEM_PACKAGE_DARWIN
121121
@_alwaysEmitIntoClient
122122
internal var _CLOCK_MONOTONIC_RAW: CInterop.ClockId { CLOCK_MONOTONIC_RAW }
123123
#endif
124-
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) || os(Linux) || os(OpenBSD) || os(FreeBSD) || os(WASI)
124+
#if SYSTEM_PACKAGE_DARWIN || os(Linux) || os(OpenBSD) || os(FreeBSD) || os(WASI)
125125
@_alwaysEmitIntoClient
126126
internal var _CLOCK_MONOTONIC: CInterop.ClockId { CLOCK_MONOTONIC }
127127
#endif
128128

129-
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
129+
#if SYSTEM_PACKAGE_DARWIN
130130
@_alwaysEmitIntoClient
131131
internal var _CLOCK_UPTIME_RAW: CInterop.ClockId { CLOCK_UPTIME_RAW }
132132
#endif

Sources/SystemExtras/FileAtOperations.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
1+
#if SYSTEM_PACKAGE_DARWIN
22
import Darwin
33
#elseif os(Linux) || os(FreeBSD) || os(Android)
44
import Glibc

Sources/SystemExtras/FileOperations.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
1+
#if SYSTEM_PACKAGE_DARWIN
22
import Darwin
33
#elseif os(Linux) || os(FreeBSD) || os(Android)
44
import Glibc
@@ -12,7 +12,7 @@ import WinSDK
1212
import SystemPackage
1313

1414
extension FileDescriptor {
15-
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
15+
#if SYSTEM_PACKAGE_DARWIN
1616

1717
/// Announces an intention to read specific region of file data.
1818
///
@@ -266,7 +266,7 @@ extension FileDescriptor {
266266

267267
@_alwaysEmitIntoClient
268268
public var accessTime: Clock.TimeSpec {
269-
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
269+
#if SYSTEM_PACKAGE_DARWIN
270270
Clock.TimeSpec(rawValue: self.rawValue.st_atimespec)
271271
#else
272272
Clock.TimeSpec(rawValue: self.rawValue.st_atim)
@@ -275,7 +275,7 @@ extension FileDescriptor {
275275

276276
@_alwaysEmitIntoClient
277277
public var modificationTime: Clock.TimeSpec {
278-
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
278+
#if SYSTEM_PACKAGE_DARWIN
279279
Clock.TimeSpec(rawValue: self.rawValue.st_mtimespec)
280280
#else
281281
Clock.TimeSpec(rawValue: self.rawValue.st_mtim)
@@ -284,7 +284,7 @@ extension FileDescriptor {
284284

285285
@_alwaysEmitIntoClient
286286
public var creationTime: Clock.TimeSpec {
287-
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
287+
#if SYSTEM_PACKAGE_DARWIN
288288
Clock.TimeSpec(rawValue: self.rawValue.st_ctimespec)
289289
#else
290290
Clock.TimeSpec(rawValue: self.rawValue.st_ctim)

Sources/SystemExtras/Syscalls.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
1+
#if SYSTEM_PACKAGE_DARWIN
22
import Darwin
33
#elseif os(Linux) || os(FreeBSD) || os(Android)
44
import Glibc
@@ -98,7 +98,7 @@ internal func system_symlinkat(
9898
}
9999

100100
extension CInterop {
101-
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
101+
#if SYSTEM_PACKAGE_DARWIN
102102
public typealias DirP = UnsafeMutablePointer<DIR>
103103
#elseif os(Linux)
104104
public typealias DirP = OpaquePointer

Sources/SystemExtras/Vendor/Exports.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
// TODO: Should CSystem just include all the header files we need?
1414

15-
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
15+
#if SYSTEM_PACKAGE_DARWIN
1616
import Darwin
1717
#elseif os(Linux) || os(FreeBSD) || os(Android)
1818
import CSystem
@@ -30,7 +30,7 @@ internal typealias _COffT = off_t
3030

3131
// MARK: syscalls and variables
3232

33-
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
33+
#if SYSTEM_PACKAGE_DARWIN
3434
internal var system_errno: CInt {
3535
get { Darwin.errno }
3636
set { Darwin.errno = newValue }

Sources/WASI/Clock.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public protocol MonotonicClock {
9494
private var underlying: SystemExtras.Clock {
9595
#if os(Linux)
9696
return .monotonic
97-
#elseif os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
97+
#elseif os(macOS) || os(iOS) || os(watchOS) || os(tvOS) || os(visionOS)
9898
return .rawUptime
9999
#elseif os(WASI)
100100
return .monotonic
@@ -127,7 +127,7 @@ public protocol MonotonicClock {
127127
private var underlying: SystemExtras.Clock {
128128
#if os(Linux)
129129
return .boottime
130-
#elseif os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
130+
#elseif os(macOS) || os(iOS) || os(watchOS) || os(tvOS) || os(visionOS)
131131
return .rawMonotonic
132132
#elseif os(OpenBSD) || os(FreeBSD) || os(WASI)
133133
return .monotonic

0 commit comments

Comments
 (0)