Skip to content

Commit a94050a

Browse files
committed
Merge pull request #74160 from hyp/eng/fix-android-synchro
[android] Fix Synchronization Android build
1 parent 422cf65 commit a94050a

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

stdlib/public/Synchronization/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ set(SWIFT_SYNCHRONIZATION_DARWIN_SOURCES
4646
Mutex/Mutex.swift
4747
)
4848

49-
# Linux sources
49+
# Linux and Android sources
5050

5151
set(SWIFT_SYNCHRONIZATION_LINUX_SOURCES
5252
Mutex/LinuxImpl.swift
@@ -115,6 +115,8 @@ add_swift_target_library(swiftSynchronization ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES
115115
${SWIFT_SYNCHRONIZATION_DARWIN_DEPENDENCIES}
116116
SWIFT_MODULE_DEPENDS_LINUX
117117
Glibc
118+
SWIFT_MODULE_DEPENDS_ANDROID
119+
Android
118120
SWIFT_MODULE_DEPENDS_WINDOWS
119121
WinSDK
120122

stdlib/public/Synchronization/Mutex/LinuxImpl.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
import _SynchronizationShims
14+
#if canImport(Android)
15+
import Android
16+
#else
1417
import Glibc
18+
#endif
1519

1620
extension Atomic where Value == UInt32 {
1721
// This returns 'false' on success and 'true' on error. Check 'errno' for the

0 commit comments

Comments
 (0)