File tree Expand file tree Collapse file tree 8 files changed +19
-4
lines changed Expand file tree Collapse file tree 8 files changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,10 @@ option(SWIFT_STDLIB_SINGLE_THREADED_RUNTIME
25
25
"Build the standard libraries assuming that they will be used in an environment with only a single thread."
26
26
FALSE )
27
27
28
+ option (SWIFT_STDLIB_OS_VERSIONING
29
+ "Build stdlib with availability based on OS versions (Darwin only)."
30
+ TRUE )
31
+
28
32
#
29
33
# End of user-configurable options.
30
34
#
Original file line number Diff line number Diff line change @@ -313,6 +313,10 @@ function(_add_target_variant_c_compile_flags)
313
313
list (APPEND result "-DSWIFT_STDLIB_SINGLE_THREADED_RUNTIME" )
314
314
endif ()
315
315
316
+ if (SWIFT_STDLIB_OS_VERSIONING )
317
+ list (APPEND result "-DSWIFT_RUNTIME_OS_VERSIONING" )
318
+ endif ()
319
+
316
320
set ("${CFLAGS_RESULT_VAR_NAME} " "${result} " PARENT_SCOPE )
317
321
endfunction ()
318
322
Original file line number Diff line number Diff line change @@ -264,6 +264,10 @@ function(_add_target_variant_swift_compile_flags
264
264
list (APPEND result "-D" "SWIFT_ENABLE_EXPERIMENTAL_DIFFERENTIABLE_PROGRAMMING" )
265
265
endif ()
266
266
267
+ if (SWIFT_STDLIB_OS_VERSIONING )
268
+ list (APPEND result "-D" "SWIFT_RUNTIME_OS_VERSIONING" )
269
+ endif ()
270
+
267
271
set ("${result_var_name} " "${result} " PARENT_SCOPE )
268
272
endfunction ()
269
273
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ public func _stdlib_isOSVersionAtLeast(
24
24
_ minor: Builtin . Word ,
25
25
_ patch: Builtin . Word
26
26
) -> Builtin . Int1 {
27
- #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
27
+ #if ( os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && SWIFT_RUNTIME_OS_VERSIONING
28
28
if Int ( major) == 9999 {
29
29
return true . _value
30
30
}
@@ -43,7 +43,7 @@ public func _stdlib_isOSVersionAtLeast(
43
43
#endif
44
44
}
45
45
46
- #if os(macOS)
46
+ #if os(macOS) && SWIFT_RUNTIME_OS_VERSIONING
47
47
// This is a magic entry point known to the compiler. It is called in
48
48
// generated code for API availability checking.
49
49
@_semantics ( " availability.osversion " )
Original file line number Diff line number Diff line change 15
15
#include " ../SwiftShims/FoundationShims.h"
16
16
#include < stdlib.h>
17
17
18
- #if defined(__APPLE__) && defined(__MACH__)
18
+ #if defined(__APPLE__) && defined(__MACH__) && defined(SWIFT_RUNTIME_OS_VERSIONING)
19
19
20
20
#if SWIFT_CLASS_IS_SWIFT_MASK_GLOBAL_VARIABLE
21
21
static unsigned long long computeIsSwiftMask () {
Original file line number Diff line number Diff line change 16
16
17
17
#include " swift/Runtime/Config.h"
18
18
19
- #if SWIFT_OBJC_INTEROP
19
+ #if SWIFT_OBJC_INTEROP && defined(SWIFT_RUNTIME_OS_VERSIONING)
20
20
#include " swift/Basic/Lazy.h"
21
21
#include " swift/Runtime/Debug.h"
22
22
#include < TargetConditionals.h>
Original file line number Diff line number Diff line change @@ -2455,6 +2455,7 @@ swift-objc-interop=0
2455
2455
swift-enable-compatibility-overrides =0
2456
2456
swift-runtime-macho-no-dyld =1
2457
2457
swift-stdlib-single-threaded-runtime =1
2458
+ swift-stdlib-os-versioning =0
2458
2459
2459
2460
[preset: stdlib_S_standalone_minimal_macho_x86_64,build]
2460
2461
mixin-preset =
Original file line number Diff line number Diff line change @@ -196,6 +196,7 @@ KNOWN_SETTINGS=(
196
196
swift-enable-compatibility-overrides " 1" " whether to support back-deploying compatibility fixes for newer apps running on older runtimes"
197
197
swift-runtime-macho-no-dyld " 0" " whether to build stdlib assuming the runtime environment does not support dynamic modules"
198
198
swift-stdlib-single-threaded-runtime " 0" " whether to build stdlib as a single-threaded runtime only"
199
+ swift-stdlib-os-versioning " 1" " whether to build stdlib with availability based on OS versions (Darwin only)"
199
200
200
201
# # FREESTANDING Stdlib Options
201
202
swift-freestanding-sdk " " " which SDK to use when building the FREESTANDING stdlib"
@@ -1776,6 +1777,7 @@ for host in "${ALL_HOSTS[@]}"; do
1776
1777
-DSWIFT_STDLIB_SINGLE_THREADED_RUNTIME:BOOL=$( true_false " ${SWIFT_STDLIB_SINGLE_THREADED_RUNTIME} " )
1777
1778
-DSWIFT_ENABLE_RUNTIME_FUNCTION_COUNTERS:BOOL=$( true_false " ${SWIFT_ENABLE_RUNTIME_FUNCTION_COUNTERS} " )
1778
1779
-DSWIFT_RUNTIME_MACHO_NO_DYLD:BOOL=$( true_false " ${SWIFT_RUNTIME_MACHO_NO_DYLD} " )
1780
+ -DSWIFT_STDLIB_OS_VERSIONING:BOOL=$( true_false " ${SWIFT_STDLIB_OS_VERSIONING} " )
1779
1781
-DSWIFT_NATIVE_LLVM_TOOLS_PATH:STRING=" ${native_llvm_tools_path} "
1780
1782
-DSWIFT_NATIVE_CLANG_TOOLS_PATH:STRING=" ${native_clang_tools_path} "
1781
1783
-DSWIFT_NATIVE_SWIFT_TOOLS_PATH:STRING=" ${native_swift_tools_path} "
You can’t perform that action at this time.
0 commit comments