Skip to content

[CMake][Darwin] Remove support for building the SDK overlays on Apple platforms #81726

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
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
3 changes: 0 additions & 3 deletions benchmark/cmake/modules/AddSwiftBenchmarkSuite.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -716,9 +716,6 @@ function(swift_benchmark_compile)

if(NOT SWIFT_BENCHMARK_BUILT_STANDALONE)
set(stdlib_dependencies "swift-frontend" "swiftCore-${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_LIB_SUBDIR}")
if((SWIFT_HOST_VARIANT_SDK IN_LIST SWIFT_DARWIN_PLATFORMS) AND SWIFT_BUILD_SDK_OVERLAY)
list(APPEND stdlib_dependencies "swiftDarwin-${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_LIB_SUBDIR}")
endif()
foreach(stdlib_dependency ${UNIVERSAL_LIBRARY_NAMES_${SWIFT_BENCHMARK_COMPILE_PLATFORM}})
string(FIND "${stdlib_dependency}" "Unittest" find_output)
if("${find_output}" STREQUAL "-1")
Expand Down
6 changes: 1 addition & 5 deletions cmake/modules/DarwinSDKs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,7 @@ if(swift_build_freestanding AND (SWIFT_FREESTANDING_FLAVOR STREQUAL "apple"))
configure_target_variant(FREESTANDING-R "FREESTANDING Release" FREESTANDING R "Release")
configure_target_variant(FREESTANDING-S "FREESTANDING MinSizeRelease" FREESTANDING S "MinSizeRelease")

if(SWIFT_BUILD_SDK_OVERLAY)
set(SWIFT_FREESTANDING_TEST_DEPENDENCIES "Darwin")
else()
set(SWIFT_FREESTANDING_TEST_DEPENDENCIES "")
endif()
set(SWIFT_FREESTANDING_TEST_DEPENDENCIES "")
endif()

# Compatible cross-compile SDKS for Darwin OSes: IOS, IOS_SIMULATOR, TVOS,
Expand Down
9 changes: 2 additions & 7 deletions stdlib/private/OSLog/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
set(swift_oslog_darwin_dependencies "")
if(SWIFT_BUILD_SDK_OVERLAY)
list(APPEND swift_oslog_darwin_dependencies "Darwin")
endif()
if (SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY)
list(APPEND swift_oslog_darwin_dependencies "_Concurrency")
endif()
Expand All @@ -12,10 +9,8 @@ if((SWIFT_BUILD_CLANG_OVERLAYS
OR SWIFT_BUILD_TEST_SUPPORT_MODULES)
AND (NOT DEFINED SWIFT_BUILD_CLANG_OVERLAYS_SKIP_BUILTIN_FLOAT
OR NOT SWIFT_BUILD_CLANG_OVERLAYS_SKIP_BUILTIN_FLOAT))
# We need to make this dependency explicit because this library
# imports Darwin and Darwin re-exports _Builtin_float,
# but in most configurations we pull Darwin from the SDK,
# meaning we specify no Darwin dependency in the build system
# This library imports Darwin from the SDK, which re-exports
# _Builtin_float which is part of this build.
list(APPEND swift_oslog_darwin_dependencies _Builtin_float)
endif()

Expand Down
10 changes: 2 additions & 8 deletions stdlib/private/StdlibUnittest/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
if(SWIFT_BUILD_SDK_OVERLAY)
set(swift_stdlib_unittest_darwin_dependencies Darwin)
else()
set(swift_stdlib_unittest_darwin_dependencies)
endif()

if((SWIFT_BUILD_CLANG_OVERLAYS
OR SWIFT_BUILD_TEST_SUPPORT_MODULES)
AND (NOT DEFINED SWIFT_BUILD_CLANG_OVERLAYS_SKIP_BUILTIN_FLOAT
OR NOT SWIFT_BUILD_CLANG_OVERLAYS_SKIP_BUILTIN_FLOAT))
# We need to make this dependency explicit because this library
# imports Darwin and Darwin re-exports _Builtin_float,
# but in most configurations we pull Darwin from the SDK,
# meaning we specify no Darwin dependency in the build system
# This library imports Darwin from the SDK, which re-exports
# _Builtin_float which is part of this build.
list(APPEND swift_stdlib_unittest_darwin_dependencies _Builtin_float)
endif()

Expand Down
10 changes: 2 additions & 8 deletions stdlib/private/SwiftPrivate/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,14 @@ set(swift_swiftprivate_compile_flags
"-parse-stdlib"
"-Xfrontend" "-disable-access-control")

if(SWIFT_BUILD_SDK_OVERLAY)
set(swift_swiftprivate_darwin_dependencies Darwin)
else()
set(swift_swiftprivate_darwin_dependencies)
endif()

if((SWIFT_BUILD_CLANG_OVERLAYS
OR SWIFT_BUILD_TEST_SUPPORT_MODULES)
AND (NOT DEFINED SWIFT_BUILD_CLANG_OVERLAYS_SKIP_BUILTIN_FLOAT
OR NOT SWIFT_BUILD_CLANG_OVERLAYS_SKIP_BUILTIN_FLOAT))
# We need to make this dependency explicit because this library
# imports Darwin and Darwin re-exports _Builtin_float,
# but in most configurations we pull Darwin from the SDK,
# meaning we specify no Darwin dependency in the build system
# This library imports Darwin from the SDK, which re-exports
# _Builtin_float which is part of this build.
list(APPEND swift_swiftprivate_darwin_dependencies _Builtin_float)
endif()

Expand Down
10 changes: 2 additions & 8 deletions stdlib/private/SwiftPrivateLibcExtras/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,14 @@ else()
set(swift_private_libc_extras_incorporate_object_libraries "swiftCommandLineSupport")
endif()

if(SWIFT_BUILD_SDK_OVERLAY)
set(swift_private_libc_extras_darwin_dependencies Darwin)
else()
set(swift_private_libc_extras_darwin_dependencies)
endif()

if((SWIFT_BUILD_CLANG_OVERLAYS
OR SWIFT_BUILD_TEST_SUPPORT_MODULES)
AND (NOT DEFINED SWIFT_BUILD_CLANG_OVERLAYS_SKIP_BUILTIN_FLOAT
OR NOT SWIFT_BUILD_CLANG_OVERLAYS_SKIP_BUILTIN_FLOAT))
# We need to make this dependency explicit because this library
# imports Darwin and Darwin re-exports _Builtin_float,
# but in most configurations we pull Darwin from the SDK,
# meaning we specify no Darwin dependency in the build system
# This library imports Darwin from the SDK, which re-exports
# _Builtin_float which is part of this build.
list(APPEND swift_private_libc_extras_darwin_dependencies _Builtin_float)
endif()

Expand Down
10 changes: 2 additions & 8 deletions stdlib/private/SwiftPrivateThreadExtras/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
if(SWIFT_BUILD_SDK_OVERLAY)
set(swift_private_thread_extras_darwin_dependencies Darwin)
else()
set(swift_private_thread_extras_darwin_dependencies)
endif()

if((SWIFT_BUILD_CLANG_OVERLAYS
OR SWIFT_BUILD_TEST_SUPPORT_MODULES)
AND (NOT DEFINED SWIFT_BUILD_CLANG_OVERLAYS_SKIP_BUILTIN_FLOAT
OR NOT SWIFT_BUILD_CLANG_OVERLAYS_SKIP_BUILTIN_FLOAT))
# We need to make this dependency explicit because this library
# imports Darwin and Darwin re-exports _Builtin_float,
# but in most configurations we pull Darwin from the SDK,
# meaning we specify no Darwin dependency in the build system
# This library imports Darwin from the SDK, which re-exports
# _Builtin_float which is part of this build.
list(APPEND swift_private_thread_extras_darwin_dependencies _Builtin_float)
endif()

Expand Down
10 changes: 2 additions & 8 deletions stdlib/private/SwiftReflectionTest/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
if(SWIFT_BUILD_SDK_OVERLAY)
set(swift_reflection_test_darwin_dependencies Darwin)
else()
set(swift_reflection_test_darwin_dependencies)
endif()

if((SWIFT_BUILD_CLANG_OVERLAYS
OR SWIFT_BUILD_TEST_SUPPORT_MODULES)
AND (NOT DEFINED SWIFT_BUILD_CLANG_OVERLAYS_SKIP_BUILTIN_FLOAT
OR NOT SWIFT_BUILD_CLANG_OVERLAYS_SKIP_BUILTIN_FLOAT))
# We need to make this dependency explicit because this library
# imports Darwin and Darwin re-exports _Builtin_float,
# but in most configurations we pull Darwin from the SDK,
# meaning we specify no Darwin dependency in the build system
# This library imports Darwin from the SDK, which re-exports
# _Builtin_float which is part of this build.
list(APPEND swift_reflection_test_darwin_dependencies _Builtin_float)
endif()

Expand Down
15 changes: 0 additions & 15 deletions stdlib/public/Cxx/std/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,6 @@ add_dependencies(sdk-overlay CxxStdlib-apinotes)
add_dependencies(compiler CxxStdlib-apinotes)


# Swift compiler currently assumes that the Darwin overlay is a dependency of
# CxxStdlib, and fails to build CxxStdlib if Darwin.swiftmodule in build dir
# is built with a different (older) version of the compiler. To workaround this,
# declare the Darwin overlay as a dependency of CxxStdlib.
set(swift_cxxstdlib_darwin_dependencies)
if(SWIFT_BUILD_STDLIB AND SWIFT_BUILD_SDK_OVERLAY)
set(swift_cxxstdlib_darwin_dependencies Darwin)
endif()

set(swift_cxxstdlib_dependencies)
if(NOT DEFINED SWIFT_BUILD_CLANG_OVERLAYS_SKIP_BUILTIN_FLOAT OR NOT SWIFT_BUILD_CLANG_OVERLAYS_SKIP_BUILTIN_FLOAT)
set(swift_cxxstdlib_dependencies _Builtin_float)
Expand All @@ -44,12 +35,6 @@ add_swift_target_library(swiftCxxStdlib STATIC NO_LINK_NAME IS_STDLIB IS_SWIFT_O
String.swift

SWIFT_MODULE_DEPENDS Cxx ${swift_cxxstdlib_dependencies}
SWIFT_MODULE_DEPENDS_IOS ${swift_cxxstdlib_darwin_dependencies}
SWIFT_MODULE_DEPENDS_OSX ${swift_cxxstdlib_darwin_dependencies}
SWIFT_MODULE_DEPENDS_TVOS ${swift_cxxstdlib_darwin_dependencies}
SWIFT_MODULE_DEPENDS_WATCHOS ${swift_cxxstdlib_darwin_dependencies}
SWIFT_MODULE_DEPENDS_XROS ${swift_cxxstdlib_darwin_dependencies}
SWIFT_MODULE_DEPENDS_MACCATALYST ${swift_cxxstdlib_darwin_dependencies}
SWIFT_MODULE_DEPENDS_ANDROID Android

SWIFT_COMPILE_FLAGS ${SWIFT_RUNTIME_SWIFT_COMPILE_FLAGS} ${SWIFT_STANDARD_LIBRARY_SWIFT_FLAGS}
Expand Down
11 changes: 0 additions & 11 deletions stdlib/public/Differentiation/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@ else()
set(swiftDifferentiationSIMDFiles)
endif()

if(SWIFT_BUILD_SDK_OVERLAY)
set(swiftDifferentiationDarwinDependencies Darwin)
else()
set(swiftDifferentiationDarwinDependencies)
endif()

add_swift_target_library(swift_Differentiation ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_STDLIB
Differentiable.swift
DifferentialOperators.swift
Expand All @@ -37,11 +31,6 @@ add_swift_target_library(swift_Differentiation ${SWIFT_STDLIB_LIBRARY_BUILD_TYPE
TgmathDerivatives.swift.gyb
${swiftDifferentiationSIMDFiles}

SWIFT_MODULE_DEPENDS_OSX ${swiftDifferentiationDarwinDependencies}
SWIFT_MODULE_DEPENDS_IOS ${swiftDifferentiationDarwinDependencies}
SWIFT_MODULE_DEPENDS_TVOS ${swiftDifferentiationDarwinDependencies}
SWIFT_MODULE_DEPENDS_WATCHOS ${swiftDifferentiationDarwinDependencies}
SWIFT_MODULE_DEPENDS_XROS ${swiftDifferentiationDarwinDependencies}
SWIFT_MODULE_DEPENDS_ANDROID Android
SWIFT_MODULE_DEPENDS_LINUX Glibc
SWIFT_MODULE_DEPENDS_LINUX_STATIC Musl
Expand Down
10 changes: 2 additions & 8 deletions stdlib/public/Distributed/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,14 @@
#
#===----------------------------------------------------------------------===#

if(SWIFT_BUILD_SDK_OVERLAY)
set(swift_distributed_darwin_dependencies Darwin)
else()
set(swift_distributed_darwin_dependencies)
endif()

if((SWIFT_BUILD_CLANG_OVERLAYS
OR SWIFT_BUILD_TEST_SUPPORT_MODULES)
AND (NOT DEFINED SWIFT_BUILD_CLANG_OVERLAYS_SKIP_BUILTIN_FLOAT
OR NOT SWIFT_BUILD_CLANG_OVERLAYS_SKIP_BUILTIN_FLOAT))
# We need to make this dependency explicit because this library
# imports Darwin and Darwin re-exports _Builtin_float,
# but in most configurations we pull Darwin from the SDK,
# meaning we specify no Darwin dependency in the build system
# This library imports Darwin from the SDK, which re-exports
# _Builtin_float which is part of this build.
list(APPEND swift_distributed_darwin_dependencies _Builtin_float)
endif()

Expand Down
119 changes: 0 additions & 119 deletions stdlib/public/Platform/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,130 +4,11 @@ set(swift_platform_sources
set(swift_platform_gyb_sources
tgmath.swift.gyb)

set(darwin_depends)
if(NOT BUILD_STANDALONE)
# This is overly conservative, but we have so few API notes files that
# haven't migrated to the Swift repo that it's probably fine in practice.
list(APPEND darwin_depends copy_apinotes)
endif()

set(swift_platform_compile_flags)
if(SWIFT_ENABLE_REFLECTION)
list(APPEND swift_platform_compile_flags "-DSWIFT_ENABLE_REFLECTION")
endif()

set(swiftDarwin_target_sdks ALL_APPLE_PLATFORMS)
if(SWIFT_FREESTANDING_FLAVOR STREQUAL "apple" AND NOT SWIFT_FREESTANDING_IS_DARWIN)
set(swiftDarwin_target_sdks ALL_APPLE_PLATFORMS FREESTANDING)
endif()

set(swiftDarwin_common_options
IS_SDK_OVERLAY
${swift_platform_sources}
POSIXError.swift
MachError.swift

"${SWIFT_SOURCE_DIR}/stdlib/linker-support/magic-symbols-for-install-name.c"

GYB_SOURCES
${swift_platform_gyb_sources}
Darwin.swift.gyb

SWIFT_COMPILE_FLAGS
${SWIFT_RUNTIME_SWIFT_COMPILE_FLAGS}
${SWIFT_STANDARD_LIBRARY_SWIFT_FLAGS}
-Xfrontend -disable-objc-attr-requires-foundation-module
${swift_platform_compile_flags}
LINK_FLAGS "${SWIFT_RUNTIME_SWIFT_LINK_FLAGS}"
DEPENDS ${darwin_depends})


if(BOOTSTRAPPING_MODE STREQUAL "BOOTSTRAPPING" AND
SWIFT_HOST_VARIANT_SDK IN_LIST SWIFT_DARWIN_PLATFORMS)

set(swiftDarwin_common_bootstrapping_options
${swiftDarwin_common_options}
SHARED
IS_STDLIB
SDK ${SWIFT_HOST_VARIANT_SDK}
ARCHITECTURE ${SWIFT_HOST_VARIANT_ARCH}
INSTALL_IN_COMPONENT "never_install")

set(b0_deps swiftCore-bootstrapping0)
set(b1_deps swiftCore-bootstrapping1)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(b0_deps ${b0_deps} swiftSwiftOnoneSupport-bootstrapping0)
set(b1_deps ${b1_deps} swiftSwiftOnoneSupport-bootstrapping1)
endif()

add_swift_target_library_single(swiftDarwin-bootstrapping0 swiftDarwin
${swiftDarwin_common_bootstrapping_options}
FILE_DEPENDS ${b0_deps}
BOOTSTRAPPING 0)

add_swift_target_library_single(swiftDarwin-bootstrapping1 swiftDarwin
${swiftDarwin_common_bootstrapping_options}
FILE_DEPENDS ${b1_deps}
BOOTSTRAPPING 1)
endif()

add_swift_target_library(swiftDarwin ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES}
${swiftDarwin_common_options}
TARGET_SDKS "${swiftDarwin_target_sdks}"
INSTALL_IN_COMPONENT sdk-overlay
MACCATALYST_BUILD_FLAVOR "zippered"
INSTALL_BINARY_SWIFTMODULE FALSE)

if(SWIFT_SHOULD_BUILD_EMBEDDED_STDLIB)
set(SWIFT_ENABLE_REFLECTION OFF)

add_custom_target(embedded-darwin)
add_dependencies(embedded-libraries embedded-darwin)
foreach(entry ${EMBEDDED_STDLIB_TARGET_TRIPLES})
string(REGEX REPLACE "[ \t]+" ";" list "${entry}")
list(GET list 0 arch)
list(GET list 1 mod)
list(GET list 2 triple)

if(NOT "${mod}" MATCHES "-macos$")
continue()
endif()

set(SWIFT_SDK_embedded_ARCH_${arch}_MODULE "${mod}")
set(SWIFT_SDK_embedded_LIB_SUBDIR "embedded")
set(SWIFT_SDK_embedded_ARCH_${arch}_TRIPLE "${triple}")
set(SWIFT_SDK_embedded_PATH ${SWIFT_SDK_OSX_PATH})
set(SWIFT_SDK_embedded_ARCH_${arch}_PATH ${SWIFT_SDK_OSX_PATH})
set(SWIFT_SDK_embedded_USE_ISYSROOT TRUE)
add_swift_target_library_single(
embedded-darwin-${mod}
swiftDarwin
ONLY_SWIFTMODULE
IS_SDK_OVERLAY IS_FRAGILE

Platform.swift
TiocConstants.swift
POSIXError.swift
MachError.swift

GYB_SOURCES
tgmath.swift.gyb
Darwin.swift.gyb

SWIFT_COMPILE_FLAGS
-Xcc -ffreestanding -enable-experimental-feature Embedded
C_COMPILE_FLAGS
-ffreestanding
MODULE_DIR "${CMAKE_BINARY_DIR}/lib/swift/embedded"
SDK "embedded"
ARCHITECTURE "${arch}"
DEPENDS embedded-stdlib-${mod}
INSTALL_IN_COMPONENT stdlib
)
add_dependencies(embedded-darwin embedded-darwin-${mod})
endforeach()
endif()

set(swiftGlibc_target_sdks CYGWIN FREEBSD OPENBSD LINUX HAIKU)
if(SWIFT_FREESTANDING_FLAVOR STREQUAL "linux")
set(swiftGlibc_target_sdks CYGWIN FREEBSD OPENBSD LINUX HAIKU FREESTANDING)
Expand Down
Loading