1010#
1111#===----------------------------------------------------------------------===#
1212
13- add_swift_target_library(swiftSynchronization ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_STDLIB
14- # List of files here:
13+ set (swift_synchronization_sources
1514 Atomic.swift
1615 AtomicBool.swift
1716 AtomicFloats.swift
@@ -21,23 +20,67 @@ add_swift_target_library(swiftSynchronization ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES
2120 AtomicPointers.swift
2221 AtomicRepresentable.swift
2322 WordPair.swift
23+ )
24+ set (swift_synchronization_gyb_sources
25+ AtomicIntegers.swift.gyb
26+ AtomicStorage.swift.gyb
27+ )
28+ set (swift_synchronization_swift_compile_flags
29+ ${SWIFT_STANDARD_LIBRARY_SWIFT_FLAGS}
30+ "-enable-builtin-module"
31+ "-enable-experimental-feature" "RawLayout"
32+ "-enable-experimental-feature" "StaticExclusiveOnly"
33+ )
2434
25- GYB_SOURCES
26- AtomicIntegers.swift.gyb
27- AtomicStorage.swift.gyb
28-
29- SWIFT_COMPILE_FLAGS
30- ${SWIFT_STANDARD_LIBRARY_SWIFT_FLAGS}
31- "-enable-builtin-module"
32- "-enable-experimental-feature" "RawLayout"
33- "-enable-experimental-feature" "StaticExclusiveOnly"
34-
35+ add_swift_target_library(swiftSynchronization ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_STDLIB
36+ ${swift_synchronization_sources}
37+ GYB_SOURCES ${swift_synchronization_gyb_sources}
38+ SWIFT_COMPILE_FLAGS ${swift_synchronization_swift_compile_flags}
3539 LINK_FLAGS
3640 "${SWIFT_RUNTIME_SWIFT_LINK_FLAGS} "
37-
3841 INSTALL_IN_COMPONENT
3942 stdlib
40-
4143 MACCATALYST_BUILD_FLAVOR
4244 "zippered"
4345)
46+
47+ # Embedded Synchronization - embedded libraries are built as .swiftmodule only,
48+ # i.e. there is no .o or .a file produced (no binary code is actually produced)
49+ # and only users of a library are going to actually compile any needed code.
50+ if (SWIFT_SHOULD_BUILD_EMBEDDED_STDLIB)
51+ add_custom_target (embedded-synchronization ALL )
52+
53+ foreach (entry ${EMBEDDED_STDLIB_TARGET_TRIPLES} )
54+ string (REGEX REPLACE "[ \t ]+" ";" list "${entry} " )
55+ list (GET list 0 arch)
56+ list (GET list 1 mod)
57+ list (GET list 2 triple)
58+
59+ set (SWIFT_SDK_embedded_ARCH_${arch} _MODULE "${mod} " )
60+ set (SWIFT_SDK_embedded_LIB_SUBDIR "embedded" )
61+ set (SWIFT_SDK_embedded_ARCH_${arch} _TRIPLE "${triple} " )
62+ set (SWIFT_SDK_embedded_PATH ${SWIFT_SDK_OSX_PATH} )
63+ set (SWIFT_SDK_embedded_ARCH_${arch} _PATH ${SWIFT_SDK_OSX_PATH} )
64+ set (SWIFT_SDK_embedded_USE_ISYSROOT TRUE )
65+ add_swift_target_library_single(
66+ embedded-synchronization-${mod}
67+ swiftSynchronization
68+ ONLY_SWIFTMODULE
69+ IS_FRAGILE
70+
71+ ${swift_synchronization_sources}
72+ GYB_SOURCES ${swift_synchronization_gyb_sources}
73+
74+ SWIFT_COMPILE_FLAGS
75+ ${swift_synchronization_swift_compile_flags}
76+ -Xcc -D__MACH__ -Xcc -D__APPLE__ -Xcc -ffreestanding -enable-experimental-feature Embedded
77+
78+ MODULE_DIR "${CMAKE_BINARY_DIR} /lib/swift/embedded"
79+ SDK "embedded"
80+ ARCHITECTURE "${arch} "
81+ DEPENDS embedded-stdlib-${mod}
82+ INSTALL_IN_COMPONENT stdlib
83+ )
84+ add_dependencies (embedded-synchronization embedded-synchronization-${mod} )
85+ endforeach ()
86+ endif ()
0 commit comments