Skip to content

Re-Add Synchronization Import on non-Darwin #742

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Sources/FoundationEssentials/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,13 @@ if(NOT BUILD_SHARED_LIBS)
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -public-autolink-library -Xfrontend _FoundationCShims>")
target_compile_options(FoundationEssentials PRIVATE
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -public-autolink-library -Xfrontend _FoundationCollections>")
target_compile_options(FoundationEssentials PRIVATE
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -public-autolink-library -Xfrontend swiftSynchronization>")
endif()

target_link_options(FoundationEssentials PRIVATE
"SHELL:-no-toolchain-stdlib-rpath")

set_target_properties(FoundationEssentials PROPERTIES
INSTALL_RPATH "$ORIGIN")
INSTALL_RPATH "$ORIGIN"
INSTALL_REMOVE_ENVIRONMENT_RPATH ON)

set_property(GLOBAL APPEND PROPERTY SWIFT_FOUNDATION_EXPORTS FoundationEssentials)
_swift_foundation_install_target(FoundationEssentials)
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
//
//===----------------------------------------------------------------------===//

#if FOUNDATION_FRAMEWORK
#if canImport(Synchronization) && (!canImport(Darwin) || FOUNDATION_FRAMEWORK)
internal import Synchronization
#endif

Expand Down Expand Up @@ -85,14 +85,14 @@ public struct PredicateError: Error, Hashable, CustomDebugStringConvertible {
extension PredicateExpressions {
public struct VariableID: Hashable, Codable, Sendable {
let id: UInt
#if FOUNDATION_FRAMEWORK
#if canImport(Synchronization) && (!canImport(Darwin) || FOUNDATION_FRAMEWORK)
private static let nextID = Atomic<UInt>(0)
#else
private static let nextID = LockedState(initialState: UInt(0))
#endif

init() {
#if FOUNDATION_FRAMEWORK
#if canImport(Synchronization) && (!canImport(Darwin) || FOUNDATION_FRAMEWORK)
self.id = Self.nextID.wrappingAdd(1, ordering: .relaxed).oldValue
#else
self.id = Self.nextID.withLock { value in
Expand Down
8 changes: 4 additions & 4 deletions Sources/FoundationInternationalization/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ if(NOT BUILD_SHARED_LIBS)
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -public-autolink-library -Xfrontend _FoundationCShims>")
target_compile_options(FoundationInternationalization PRIVATE
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -public-autolink-library -Xfrontend _FoundationICU>")
target_compile_options(FoundationEssentials PRIVATE
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -public-autolink-library -Xfrontend swiftSynchronization>")
endif()

target_link_options(FoundationInternationalization PRIVATE
"SHELL:-no-toolchain-stdlib-rpath")

set_target_properties(FoundationInternationalization PROPERTIES
INSTALL_RPATH "$ORIGIN")
INSTALL_RPATH "$ORIGIN"
INSTALL_REMOVE_ENVIRONMENT_RPATH ON)

set_property(GLOBAL APPEND PROPERTY SWIFT_FOUNDATION_EXPORTS FoundationInternationalization)
_swift_foundation_install_target(FoundationInternationalization)
6 changes: 2 additions & 4 deletions Sources/FoundationMacros/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,9 @@ target_link_libraries(FoundationMacros PUBLIC
SwiftSyntax::SwiftSyntaxBuilder
)

target_link_options(FoundationMacros PRIVATE
"SHELL:-no-toolchain-stdlib-rpath")

set_target_properties(FoundationMacros PROPERTIES
INSTALL_RPATH "$ORIGIN")
INSTALL_RPATH "$ORIGIN"
INSTALL_REMOVE_ENVIRONMENT_RPATH ON)

target_compile_options(FoundationMacros PRIVATE -parse-as-library)
target_compile_options(FoundationMacros PRIVATE
Expand Down