Skip to content

Commit 11c756c

Browse files
Support compiling against Musl (#145)
1 parent 4733b6e commit 11c756c

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

IntegrationTests/allocation-counter-tests-framework/template/scaffolding.swift

+6-2
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,14 @@
2828

2929
import AtomicCounter
3030
import Foundation
31-
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
31+
#if canImport(Darwin)
3232
import Darwin
33-
#else
33+
#elseif canImport(Glibc)
3434
import Glibc
35+
#elseif canImport(Musl)
36+
import Musl
37+
#else
38+
#error("Unsupported runtime")
3539
#endif
3640

3741
func waitForThreadsToQuiesce(shouldReachZero: Bool) {

Sources/Instrumentation/Locks.swift

+6-2
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,14 @@
2626
//
2727
//===----------------------------------------------------------------------===//
2828

29-
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
29+
#if canImport(Darwin)
3030
import Darwin
31-
#else
31+
#elseif canImport(Glibc)
3232
import Glibc
33+
#elseif canImport(Musl)
34+
import Musl
35+
#else
36+
#error("Unsupported runtime")
3337
#endif
3438

3539
/// A threading lock based on `libpthread` instead of `libdispatch`.

Sources/Tracing/TracingTime.swift

+6-2
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,14 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
#if os(Linux)
15+
#if canImport(Darwin)
16+
import Darwin
17+
#elseif canImport(Glibc)
1618
import Glibc
19+
#elseif canImport(Musl)
20+
import Musl
1721
#else
18-
import Darwin
22+
#error("Unsupported runtime")
1923
#endif
2024

2125
@_exported import Instrumentation

0 commit comments

Comments
 (0)