Skip to content

Commit

Permalink
fix(patch): Fix issues with broken build when visionOS is unknown (#261)
Browse files Browse the repository at this point in the history
Fix issues with broken build when visionOS is unknown
  • Loading branch information
hassila authored Aug 13, 2024
1 parent a214635 commit c781564
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ let package = Package(

let macOSSPIBuild: Bool // Disables jemalloc for macOS SPI builds as the infrastructure doesn't have jemalloc there

#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) || os(visionOS)
#if canImport(Darwin)
if let spiBuildEnvironment = ProcessInfo.processInfo.environment["SPI_BUILD"], spiBuildEnvironment == "1" {
macOSSPIBuild = true
print("Building for SPI@macOS, disabling Jemalloc")
Expand Down
4 changes: 2 additions & 2 deletions Sources/Benchmark/BenchmarkClock.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ extension BenchmarkClock: Clock {

/// The minimum non-zero resolution between any two calls to `now`.
public var minimumResolution: Swift.Duration {
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) || os(visionOS)
#if canImport(Darwin)
return Duration.nanoseconds(1)
#elseif os(Linux)
var resolution = timespec()
Expand All @@ -83,7 +83,7 @@ extension BenchmarkClock: Clock {

/// The current continuous instant.
public static var now: BenchmarkClock.Instant {
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) || os(visionOS)
#if canImport(Darwin)
let nanos = clock_gettime_nsec_np(CLOCK_UPTIME_RAW) // to get ns resolution on macOS

let seconds: UInt64 = nanos / 1_000_000_000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// http://www.apache.org/licenses/LICENSE-2.0
//

#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) || os(visionOS)
#if canImport(Darwin)

import CDarwinOperatingSystemStats
import Darwin
Expand Down Expand Up @@ -228,7 +228,7 @@
}

func metricSupported(_ metric: BenchmarkMetric) -> Bool {
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) || os(visionOS)
#if canImport(Darwin)
switch metric {
case .readSyscalls:
return false
Expand Down

0 comments on commit c781564

Please sign in to comment.