Skip to content

Commit ecf318f

Browse files
[CMake] [Darwin] Don't build the SDK overlays by default on Apple platforms
The Apple SDKs have been providing the Darwin overlay since macOS 10.14.4, iOS 12.2, et al. More recently the SDK version has diverged from the Swift version making them incompatible. Stop building the overlay from Swift. rdar://115192929
1 parent fa72680 commit ecf318f

File tree

6 files changed

+20
-7
lines changed

6 files changed

+20
-7
lines changed

CMakeLists.txt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,10 +244,17 @@ option(SWIFT_BUILD_CLANG_OVERLAYS
244244
"Build Swift overlays for the clang builtin modules"
245245
TRUE)
246246

247+
# The SDK overlay is provided by the SDK itself on Darwin platforms.
248+
if(SWIFT_HOST_VARIANT_SDK IN_LIST SWIFT_DARWIN_PLATFORMS)
249+
set(SWIFT_BUILD_DYNAMIC_SDK_OVERLAY_default FALSE)
250+
else()
251+
set(SWIFT_BUILD_DYNAMIC_SDK_OVERLAY_default TRUE)
252+
endif()
253+
247254
option(SWIFT_BUILD_DYNAMIC_SDK_OVERLAY
248255
"Build dynamic variants of the Swift SDK overlay"
249-
TRUE)
250-
256+
"${SWIFT_BUILD_DYNAMIC_SDK_OVERLAY_default}")
257+
251258
option(SWIFT_BUILD_STATIC_SDK_OVERLAY
252259
"Build static variants of the Swift SDK overlay"
253260
FALSE)

benchmark/cmake/modules/AddSwiftBenchmarkSuite.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -716,7 +716,7 @@ function(swift_benchmark_compile)
716716

717717
if(NOT SWIFT_BENCHMARK_BUILT_STANDALONE)
718718
set(stdlib_dependencies "swift-frontend" "swiftCore-${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_LIB_SUBDIR}")
719-
if(SWIFT_HOST_VARIANT_SDK IN_LIST SWIFT_DARWIN_PLATFORMS)
719+
if((SWIFT_HOST_VARIANT_SDK IN_LIST SWIFT_DARWIN_PLATFORMS) AND ${SWIFT_BUILD_SDK_OVERLAY})
720720
list(APPEND stdlib_dependencies "swiftDarwin-${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_LIB_SUBDIR}")
721721
endif()
722722
foreach(stdlib_dependency ${UNIVERSAL_LIBRARY_NAMES_${SWIFT_BENCHMARK_COMPILE_PLATFORM}})

cmake/modules/DarwinSDKs.cmake

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,11 @@ if(swift_build_freestanding AND (SWIFT_FREESTANDING_FLAVOR STREQUAL "apple"))
3838
configure_target_variant(FREESTANDING-R "FREESTANDING Release" FREESTANDING R "Release")
3939
configure_target_variant(FREESTANDING-S "FREESTANDING MinSizeRelease" FREESTANDING S "MinSizeRelease")
4040

41-
set(SWIFT_FREESTANDING_TEST_DEPENDENCIES "Darwin")
41+
if(${SWIFT_BUILD_SDK_OVERLAY})
42+
set(SWIFT_FREESTANDING_TEST_DEPENDENCIES "Darwin")
43+
else()
44+
set(SWIFT_FREESTANDING_TEST_DEPENDENCIES "")
45+
endif()
4246
endif()
4347

4448
# Compatible cross-compile SDKS for Darwin OSes: IOS, IOS_SIMULATOR, TVOS,

stdlib/public/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ if(SWIFT_BUILD_REMOTE_MIRROR)
315315
add_subdirectory(SwiftRemoteMirror)
316316
endif()
317317

318-
if(SWIFT_BUILD_SDK_OVERLAY OR SWIFT_BUILD_TEST_SUPPORT_MODULES)
318+
if(SWIFT_BUILD_SDK_OVERLAY OR (SWIFT_BUILD_TEST_SUPPORT_MODULES AND SWIFT_BUILD_DYNAMIC_SDK_OVERLAY_default))
319319
add_subdirectory(Platform)
320320
endif()
321321

utils/build_swift/build_swift/driver_arguments.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
import multiprocessing
1010
import os
11+
import platform
1112

1213
import android.adb.commands
1314

@@ -1136,7 +1137,7 @@ def create_argument_parser():
11361137
help='build static variants of the Swift standard library')
11371138

11381139
option('--build-swift-dynamic-sdk-overlay', toggle_true,
1139-
default=True,
1140+
default=platform.system() != "Darwin",
11401141
help='build dynamic variants of the Swift SDK overlay')
11411142

11421143
option('--build-swift-static-sdk-overlay', toggle_true,

utils/build_swift/tests/expected_options.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99

1010
import multiprocessing
11+
import platform
1112

1213
from build_swift import argparse
1314
from build_swift import defaults
@@ -79,7 +80,7 @@
7980
'build_runtime_with_host_compiler': False,
8081
'build_stdlib_deployment_targets': ['all'],
8182
'build_subdir': None,
82-
'build_swift_dynamic_sdk_overlay': True,
83+
'build_swift_dynamic_sdk_overlay': platform.system() != "Darwin",
8384
'build_swift_dynamic_stdlib': True,
8485
'build_swift_inspect': False,
8586
'build_swift_private_stdlib': True,

0 commit comments

Comments
 (0)