Skip to content

Commit 15345ef

Browse files
[CMake][Darwin] Remove support for building the SDK overlays on Apple platforms
The SDK overlays have been provided in the Apple SDKs for many years, and the interface and implementation has diverged in more recent years such that trying to build the Swift version no longer works. Remove all of the dead code. rdar://151889154
1 parent a91dc9e commit 15345ef

File tree

21 files changed

+38
-948
lines changed

21 files changed

+38
-948
lines changed

benchmark/cmake/modules/AddSwiftBenchmarkSuite.cmake

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -716,9 +716,6 @@ 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) AND SWIFT_BUILD_SDK_OVERLAY)
720-
list(APPEND stdlib_dependencies "swiftDarwin-${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_LIB_SUBDIR}")
721-
endif()
722719
foreach(stdlib_dependency ${UNIVERSAL_LIBRARY_NAMES_${SWIFT_BENCHMARK_COMPILE_PLATFORM}})
723720
string(FIND "${stdlib_dependency}" "Unittest" find_output)
724721
if("${find_output}" STREQUAL "-1")

cmake/modules/DarwinSDKs.cmake

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,7 @@ 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-
if(SWIFT_BUILD_SDK_OVERLAY)
42-
set(SWIFT_FREESTANDING_TEST_DEPENDENCIES "Darwin")
43-
else()
44-
set(SWIFT_FREESTANDING_TEST_DEPENDENCIES "")
45-
endif()
41+
set(SWIFT_FREESTANDING_TEST_DEPENDENCIES "")
4642
endif()
4743

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

stdlib/private/OSLog/CMakeLists.txt

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
set(swift_oslog_darwin_dependencies "")
2-
if(SWIFT_BUILD_SDK_OVERLAY)
3-
list(APPEND swift_oslog_darwin_dependencies "Darwin")
4-
endif()
52
if (SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY)
63
list(APPEND swift_oslog_darwin_dependencies "_Concurrency")
74
endif()
@@ -12,10 +9,8 @@ if((SWIFT_BUILD_CLANG_OVERLAYS
129
OR SWIFT_BUILD_TEST_SUPPORT_MODULES)
1310
AND (NOT DEFINED SWIFT_BUILD_CLANG_OVERLAYS_SKIP_BUILTIN_FLOAT
1411
OR NOT SWIFT_BUILD_CLANG_OVERLAYS_SKIP_BUILTIN_FLOAT))
15-
# We need to make this dependency explicit because this library
16-
# imports Darwin and Darwin re-exports _Builtin_float,
17-
# but in most configurations we pull Darwin from the SDK,
18-
# meaning we specify no Darwin dependency in the build system
12+
# This library imports Darwin from the SDK, which re-exports
13+
# _Builtin_float which is part of this build.
1914
list(APPEND swift_oslog_darwin_dependencies _Builtin_float)
2015
endif()
2116

stdlib/private/StdlibUnittest/CMakeLists.txt

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
1-
if(SWIFT_BUILD_SDK_OVERLAY)
2-
set(swift_stdlib_unittest_darwin_dependencies Darwin)
3-
else()
41
set(swift_stdlib_unittest_darwin_dependencies)
5-
endif()
62

73
if((SWIFT_BUILD_CLANG_OVERLAYS
84
OR SWIFT_BUILD_TEST_SUPPORT_MODULES)
95
AND (NOT DEFINED SWIFT_BUILD_CLANG_OVERLAYS_SKIP_BUILTIN_FLOAT
106
OR NOT SWIFT_BUILD_CLANG_OVERLAYS_SKIP_BUILTIN_FLOAT))
11-
# We need to make this dependency explicit because this library
12-
# imports Darwin and Darwin re-exports _Builtin_float,
13-
# but in most configurations we pull Darwin from the SDK,
14-
# meaning we specify no Darwin dependency in the build system
7+
# This library imports Darwin from the SDK, which re-exports
8+
# _Builtin_float which is part of this build.
159
list(APPEND swift_stdlib_unittest_darwin_dependencies _Builtin_float)
1610
endif()
1711

stdlib/private/SwiftPrivate/CMakeLists.txt

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,14 @@ set(swift_swiftprivate_compile_flags
22
"-parse-stdlib"
33
"-Xfrontend" "-disable-access-control")
44

5-
if(SWIFT_BUILD_SDK_OVERLAY)
6-
set(swift_swiftprivate_darwin_dependencies Darwin)
7-
else()
85
set(swift_swiftprivate_darwin_dependencies)
9-
endif()
106

117
if((SWIFT_BUILD_CLANG_OVERLAYS
128
OR SWIFT_BUILD_TEST_SUPPORT_MODULES)
139
AND (NOT DEFINED SWIFT_BUILD_CLANG_OVERLAYS_SKIP_BUILTIN_FLOAT
1410
OR NOT SWIFT_BUILD_CLANG_OVERLAYS_SKIP_BUILTIN_FLOAT))
15-
# We need to make this dependency explicit because this library
16-
# imports Darwin and Darwin re-exports _Builtin_float,
17-
# but in most configurations we pull Darwin from the SDK,
18-
# meaning we specify no Darwin dependency in the build system
11+
# This library imports Darwin from the SDK, which re-exports
12+
# _Builtin_float which is part of this build.
1913
list(APPEND swift_swiftprivate_darwin_dependencies _Builtin_float)
2014
endif()
2115

stdlib/private/SwiftPrivateLibcExtras/CMakeLists.txt

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,14 @@ else()
1414
set(swift_private_libc_extras_incorporate_object_libraries "swiftCommandLineSupport")
1515
endif()
1616

17-
if(SWIFT_BUILD_SDK_OVERLAY)
18-
set(swift_private_libc_extras_darwin_dependencies Darwin)
19-
else()
2017
set(swift_private_libc_extras_darwin_dependencies)
21-
endif()
2218

2319
if((SWIFT_BUILD_CLANG_OVERLAYS
2420
OR SWIFT_BUILD_TEST_SUPPORT_MODULES)
2521
AND (NOT DEFINED SWIFT_BUILD_CLANG_OVERLAYS_SKIP_BUILTIN_FLOAT
2622
OR NOT SWIFT_BUILD_CLANG_OVERLAYS_SKIP_BUILTIN_FLOAT))
27-
# We need to make this dependency explicit because this library
28-
# imports Darwin and Darwin re-exports _Builtin_float,
29-
# but in most configurations we pull Darwin from the SDK,
30-
# meaning we specify no Darwin dependency in the build system
23+
# This library imports Darwin from the SDK, which re-exports
24+
# _Builtin_float which is part of this build.
3125
list(APPEND swift_private_libc_extras_darwin_dependencies _Builtin_float)
3226
endif()
3327

stdlib/private/SwiftPrivateThreadExtras/CMakeLists.txt

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
1-
if(SWIFT_BUILD_SDK_OVERLAY)
2-
set(swift_private_thread_extras_darwin_dependencies Darwin)
3-
else()
41
set(swift_private_thread_extras_darwin_dependencies)
5-
endif()
62

73
if((SWIFT_BUILD_CLANG_OVERLAYS
84
OR SWIFT_BUILD_TEST_SUPPORT_MODULES)
95
AND (NOT DEFINED SWIFT_BUILD_CLANG_OVERLAYS_SKIP_BUILTIN_FLOAT
106
OR NOT SWIFT_BUILD_CLANG_OVERLAYS_SKIP_BUILTIN_FLOAT))
11-
# We need to make this dependency explicit because this library
12-
# imports Darwin and Darwin re-exports _Builtin_float,
13-
# but in most configurations we pull Darwin from the SDK,
14-
# meaning we specify no Darwin dependency in the build system
7+
# This library imports Darwin from the SDK, which re-exports
8+
# _Builtin_float which is part of this build.
159
list(APPEND swift_private_thread_extras_darwin_dependencies _Builtin_float)
1610
endif()
1711

stdlib/private/SwiftReflectionTest/CMakeLists.txt

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
1-
if(SWIFT_BUILD_SDK_OVERLAY)
2-
set(swift_reflection_test_darwin_dependencies Darwin)
3-
else()
41
set(swift_reflection_test_darwin_dependencies)
5-
endif()
62

73
if((SWIFT_BUILD_CLANG_OVERLAYS
84
OR SWIFT_BUILD_TEST_SUPPORT_MODULES)
95
AND (NOT DEFINED SWIFT_BUILD_CLANG_OVERLAYS_SKIP_BUILTIN_FLOAT
106
OR NOT SWIFT_BUILD_CLANG_OVERLAYS_SKIP_BUILTIN_FLOAT))
11-
# We need to make this dependency explicit because this library
12-
# imports Darwin and Darwin re-exports _Builtin_float,
13-
# but in most configurations we pull Darwin from the SDK,
14-
# meaning we specify no Darwin dependency in the build system
7+
# This library imports Darwin from the SDK, which re-exports
8+
# _Builtin_float which is part of this build.
159
list(APPEND swift_reflection_test_darwin_dependencies _Builtin_float)
1610
endif()
1711

stdlib/public/Cxx/std/CMakeLists.txt

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,6 @@ add_dependencies(sdk-overlay CxxStdlib-apinotes)
1919
add_dependencies(compiler CxxStdlib-apinotes)
2020

2121

22-
# Swift compiler currently assumes that the Darwin overlay is a dependency of
23-
# CxxStdlib, and fails to build CxxStdlib if Darwin.swiftmodule in build dir
24-
# is built with a different (older) version of the compiler. To workaround this,
25-
# declare the Darwin overlay as a dependency of CxxStdlib.
26-
set(swift_cxxstdlib_darwin_dependencies)
27-
if(SWIFT_BUILD_STDLIB AND SWIFT_BUILD_SDK_OVERLAY)
28-
set(swift_cxxstdlib_darwin_dependencies Darwin)
29-
endif()
30-
3122
set(swift_cxxstdlib_dependencies)
3223
if(NOT DEFINED SWIFT_BUILD_CLANG_OVERLAYS_SKIP_BUILTIN_FLOAT OR NOT SWIFT_BUILD_CLANG_OVERLAYS_SKIP_BUILTIN_FLOAT)
3324
set(swift_cxxstdlib_dependencies _Builtin_float)
@@ -44,12 +35,6 @@ add_swift_target_library(swiftCxxStdlib STATIC NO_LINK_NAME IS_STDLIB IS_SWIFT_O
4435
String.swift
4536

4637
SWIFT_MODULE_DEPENDS Cxx ${swift_cxxstdlib_dependencies}
47-
SWIFT_MODULE_DEPENDS_IOS ${swift_cxxstdlib_darwin_dependencies}
48-
SWIFT_MODULE_DEPENDS_OSX ${swift_cxxstdlib_darwin_dependencies}
49-
SWIFT_MODULE_DEPENDS_TVOS ${swift_cxxstdlib_darwin_dependencies}
50-
SWIFT_MODULE_DEPENDS_WATCHOS ${swift_cxxstdlib_darwin_dependencies}
51-
SWIFT_MODULE_DEPENDS_XROS ${swift_cxxstdlib_darwin_dependencies}
52-
SWIFT_MODULE_DEPENDS_MACCATALYST ${swift_cxxstdlib_darwin_dependencies}
5338
SWIFT_MODULE_DEPENDS_ANDROID Android
5439

5540
SWIFT_COMPILE_FLAGS ${SWIFT_RUNTIME_SWIFT_COMPILE_FLAGS} ${SWIFT_STANDARD_LIBRARY_SWIFT_FLAGS}

stdlib/public/Differentiation/CMakeLists.txt

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,6 @@ else()
1616
set(swiftDifferentiationSIMDFiles)
1717
endif()
1818

19-
if(SWIFT_BUILD_SDK_OVERLAY)
20-
set(swiftDifferentiationDarwinDependencies Darwin)
21-
else()
22-
set(swiftDifferentiationDarwinDependencies)
23-
endif()
24-
2519
add_swift_target_library(swift_Differentiation ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_STDLIB
2620
Differentiable.swift
2721
DifferentialOperators.swift
@@ -37,11 +31,6 @@ add_swift_target_library(swift_Differentiation ${SWIFT_STDLIB_LIBRARY_BUILD_TYPE
3731
TgmathDerivatives.swift.gyb
3832
${swiftDifferentiationSIMDFiles}
3933

40-
SWIFT_MODULE_DEPENDS_OSX ${swiftDifferentiationDarwinDependencies}
41-
SWIFT_MODULE_DEPENDS_IOS ${swiftDifferentiationDarwinDependencies}
42-
SWIFT_MODULE_DEPENDS_TVOS ${swiftDifferentiationDarwinDependencies}
43-
SWIFT_MODULE_DEPENDS_WATCHOS ${swiftDifferentiationDarwinDependencies}
44-
SWIFT_MODULE_DEPENDS_XROS ${swiftDifferentiationDarwinDependencies}
4534
SWIFT_MODULE_DEPENDS_ANDROID Android
4635
SWIFT_MODULE_DEPENDS_LINUX Glibc
4736
SWIFT_MODULE_DEPENDS_LINUX_STATIC Musl

stdlib/public/Distributed/CMakeLists.txt

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,14 @@
1010
#
1111
#===----------------------------------------------------------------------===#
1212

13-
if(SWIFT_BUILD_SDK_OVERLAY)
14-
set(swift_distributed_darwin_dependencies Darwin)
15-
else()
1613
set(swift_distributed_darwin_dependencies)
17-
endif()
1814

1915
if((SWIFT_BUILD_CLANG_OVERLAYS
2016
OR SWIFT_BUILD_TEST_SUPPORT_MODULES)
2117
AND (NOT DEFINED SWIFT_BUILD_CLANG_OVERLAYS_SKIP_BUILTIN_FLOAT
2218
OR NOT SWIFT_BUILD_CLANG_OVERLAYS_SKIP_BUILTIN_FLOAT))
23-
# We need to make this dependency explicit because this library
24-
# imports Darwin and Darwin re-exports _Builtin_float,
25-
# but in most configurations we pull Darwin from the SDK,
26-
# meaning we specify no Darwin dependency in the build system
19+
# This library imports Darwin from the SDK, which re-exports
20+
# _Builtin_float which is part of this build.
2721
list(APPEND swift_distributed_darwin_dependencies _Builtin_float)
2822
endif()
2923

stdlib/public/Platform/CMakeLists.txt

Lines changed: 0 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -4,130 +4,11 @@ set(swift_platform_sources
44
set(swift_platform_gyb_sources
55
tgmath.swift.gyb)
66

7-
set(darwin_depends)
8-
if(NOT BUILD_STANDALONE)
9-
# This is overly conservative, but we have so few API notes files that
10-
# haven't migrated to the Swift repo that it's probably fine in practice.
11-
list(APPEND darwin_depends copy_apinotes)
12-
endif()
13-
147
set(swift_platform_compile_flags)
158
if(SWIFT_ENABLE_REFLECTION)
169
list(APPEND swift_platform_compile_flags "-DSWIFT_ENABLE_REFLECTION")
1710
endif()
1811

19-
set(swiftDarwin_target_sdks ALL_APPLE_PLATFORMS)
20-
if(SWIFT_FREESTANDING_FLAVOR STREQUAL "apple" AND NOT SWIFT_FREESTANDING_IS_DARWIN)
21-
set(swiftDarwin_target_sdks ALL_APPLE_PLATFORMS FREESTANDING)
22-
endif()
23-
24-
set(swiftDarwin_common_options
25-
IS_SDK_OVERLAY
26-
${swift_platform_sources}
27-
POSIXError.swift
28-
MachError.swift
29-
30-
"${SWIFT_SOURCE_DIR}/stdlib/linker-support/magic-symbols-for-install-name.c"
31-
32-
GYB_SOURCES
33-
${swift_platform_gyb_sources}
34-
Darwin.swift.gyb
35-
36-
SWIFT_COMPILE_FLAGS
37-
${SWIFT_RUNTIME_SWIFT_COMPILE_FLAGS}
38-
${SWIFT_STANDARD_LIBRARY_SWIFT_FLAGS}
39-
-Xfrontend -disable-objc-attr-requires-foundation-module
40-
${swift_platform_compile_flags}
41-
LINK_FLAGS "${SWIFT_RUNTIME_SWIFT_LINK_FLAGS}"
42-
DEPENDS ${darwin_depends})
43-
44-
45-
if(BOOTSTRAPPING_MODE STREQUAL "BOOTSTRAPPING" AND
46-
SWIFT_HOST_VARIANT_SDK IN_LIST SWIFT_DARWIN_PLATFORMS)
47-
48-
set(swiftDarwin_common_bootstrapping_options
49-
${swiftDarwin_common_options}
50-
SHARED
51-
IS_STDLIB
52-
SDK ${SWIFT_HOST_VARIANT_SDK}
53-
ARCHITECTURE ${SWIFT_HOST_VARIANT_ARCH}
54-
INSTALL_IN_COMPONENT "never_install")
55-
56-
set(b0_deps swiftCore-bootstrapping0)
57-
set(b1_deps swiftCore-bootstrapping1)
58-
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
59-
set(b0_deps ${b0_deps} swiftSwiftOnoneSupport-bootstrapping0)
60-
set(b1_deps ${b1_deps} swiftSwiftOnoneSupport-bootstrapping1)
61-
endif()
62-
63-
add_swift_target_library_single(swiftDarwin-bootstrapping0 swiftDarwin
64-
${swiftDarwin_common_bootstrapping_options}
65-
FILE_DEPENDS ${b0_deps}
66-
BOOTSTRAPPING 0)
67-
68-
add_swift_target_library_single(swiftDarwin-bootstrapping1 swiftDarwin
69-
${swiftDarwin_common_bootstrapping_options}
70-
FILE_DEPENDS ${b1_deps}
71-
BOOTSTRAPPING 1)
72-
endif()
73-
74-
add_swift_target_library(swiftDarwin ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES}
75-
${swiftDarwin_common_options}
76-
TARGET_SDKS "${swiftDarwin_target_sdks}"
77-
INSTALL_IN_COMPONENT sdk-overlay
78-
MACCATALYST_BUILD_FLAVOR "zippered"
79-
INSTALL_BINARY_SWIFTMODULE FALSE)
80-
81-
if(SWIFT_SHOULD_BUILD_EMBEDDED_STDLIB)
82-
set(SWIFT_ENABLE_REFLECTION OFF)
83-
84-
add_custom_target(embedded-darwin)
85-
add_dependencies(embedded-libraries embedded-darwin)
86-
foreach(entry ${EMBEDDED_STDLIB_TARGET_TRIPLES})
87-
string(REGEX REPLACE "[ \t]+" ";" list "${entry}")
88-
list(GET list 0 arch)
89-
list(GET list 1 mod)
90-
list(GET list 2 triple)
91-
92-
if(NOT "${mod}" MATCHES "-macos$")
93-
continue()
94-
endif()
95-
96-
set(SWIFT_SDK_embedded_ARCH_${arch}_MODULE "${mod}")
97-
set(SWIFT_SDK_embedded_LIB_SUBDIR "embedded")
98-
set(SWIFT_SDK_embedded_ARCH_${arch}_TRIPLE "${triple}")
99-
set(SWIFT_SDK_embedded_PATH ${SWIFT_SDK_OSX_PATH})
100-
set(SWIFT_SDK_embedded_ARCH_${arch}_PATH ${SWIFT_SDK_OSX_PATH})
101-
set(SWIFT_SDK_embedded_USE_ISYSROOT TRUE)
102-
add_swift_target_library_single(
103-
embedded-darwin-${mod}
104-
swiftDarwin
105-
ONLY_SWIFTMODULE
106-
IS_SDK_OVERLAY IS_FRAGILE
107-
108-
Platform.swift
109-
TiocConstants.swift
110-
POSIXError.swift
111-
MachError.swift
112-
113-
GYB_SOURCES
114-
tgmath.swift.gyb
115-
Darwin.swift.gyb
116-
117-
SWIFT_COMPILE_FLAGS
118-
-Xcc -ffreestanding -enable-experimental-feature Embedded
119-
C_COMPILE_FLAGS
120-
-ffreestanding
121-
MODULE_DIR "${CMAKE_BINARY_DIR}/lib/swift/embedded"
122-
SDK "embedded"
123-
ARCHITECTURE "${arch}"
124-
DEPENDS embedded-stdlib-${mod}
125-
INSTALL_IN_COMPONENT stdlib
126-
)
127-
add_dependencies(embedded-darwin embedded-darwin-${mod})
128-
endforeach()
129-
endif()
130-
13112
set(swiftGlibc_target_sdks CYGWIN FREEBSD OPENBSD LINUX HAIKU)
13213
if(SWIFT_FREESTANDING_FLAVOR STREQUAL "linux")
13314
set(swiftGlibc_target_sdks CYGWIN FREEBSD OPENBSD LINUX HAIKU FREESTANDING)

0 commit comments

Comments
 (0)