mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[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. Once the SDK overlays aren't being built, the clang overlays need to be built in testing. %target-swift-emit-pcm doesn't use the sdk, but %target-swift-frontend does, which will cause them to have a mismatch with "builtin headers belong to system modules, and _Builtin_ modules are ignored for cstdlib headers" aka LANGOPT(BuiltinHeadersInSystemModules) aka -fbuiltin-headers-in-system-modules. rdar://115192929
This commit is contained in:
@@ -244,10 +244,17 @@ option(SWIFT_BUILD_CLANG_OVERLAYS
|
|||||||
"Build Swift overlays for the clang builtin modules"
|
"Build Swift overlays for the clang builtin modules"
|
||||||
TRUE)
|
TRUE)
|
||||||
|
|
||||||
|
# The SDK overlay is provided by the SDK itself on Darwin platforms.
|
||||||
|
if(SWIFT_HOST_VARIANT_SDK IN_LIST SWIFT_DARWIN_PLATFORMS)
|
||||||
|
set(SWIFT_BUILD_DYNAMIC_SDK_OVERLAY_default FALSE)
|
||||||
|
else()
|
||||||
|
set(SWIFT_BUILD_DYNAMIC_SDK_OVERLAY_default TRUE)
|
||||||
|
endif()
|
||||||
|
|
||||||
option(SWIFT_BUILD_DYNAMIC_SDK_OVERLAY
|
option(SWIFT_BUILD_DYNAMIC_SDK_OVERLAY
|
||||||
"Build dynamic variants of the Swift SDK overlay"
|
"Build dynamic variants of the Swift SDK overlay"
|
||||||
TRUE)
|
"${SWIFT_BUILD_DYNAMIC_SDK_OVERLAY_default}")
|
||||||
|
|
||||||
option(SWIFT_BUILD_STATIC_SDK_OVERLAY
|
option(SWIFT_BUILD_STATIC_SDK_OVERLAY
|
||||||
"Build static variants of the Swift SDK overlay"
|
"Build static variants of the Swift SDK overlay"
|
||||||
FALSE)
|
FALSE)
|
||||||
|
|||||||
@@ -716,7 +716,7 @@ function(swift_benchmark_compile)
|
|||||||
|
|
||||||
if(NOT SWIFT_BENCHMARK_BUILT_STANDALONE)
|
if(NOT SWIFT_BENCHMARK_BUILT_STANDALONE)
|
||||||
set(stdlib_dependencies "swift-frontend" "swiftCore-${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_LIB_SUBDIR}")
|
set(stdlib_dependencies "swift-frontend" "swiftCore-${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_LIB_SUBDIR}")
|
||||||
if(SWIFT_HOST_VARIANT_SDK IN_LIST SWIFT_DARWIN_PLATFORMS)
|
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}")
|
list(APPEND stdlib_dependencies "swiftDarwin-${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_LIB_SUBDIR}")
|
||||||
endif()
|
endif()
|
||||||
foreach(stdlib_dependency ${UNIVERSAL_LIBRARY_NAMES_${SWIFT_BENCHMARK_COMPILE_PLATFORM}})
|
foreach(stdlib_dependency ${UNIVERSAL_LIBRARY_NAMES_${SWIFT_BENCHMARK_COMPILE_PLATFORM}})
|
||||||
|
|||||||
@@ -38,7 +38,11 @@ if(swift_build_freestanding AND (SWIFT_FREESTANDING_FLAVOR STREQUAL "apple"))
|
|||||||
configure_target_variant(FREESTANDING-R "FREESTANDING Release" FREESTANDING R "Release")
|
configure_target_variant(FREESTANDING-R "FREESTANDING Release" FREESTANDING R "Release")
|
||||||
configure_target_variant(FREESTANDING-S "FREESTANDING MinSizeRelease" FREESTANDING S "MinSizeRelease")
|
configure_target_variant(FREESTANDING-S "FREESTANDING MinSizeRelease" FREESTANDING S "MinSizeRelease")
|
||||||
|
|
||||||
set(SWIFT_FREESTANDING_TEST_DEPENDENCIES "Darwin")
|
if(SWIFT_BUILD_SDK_OVERLAY)
|
||||||
|
set(SWIFT_FREESTANDING_TEST_DEPENDENCIES "Darwin")
|
||||||
|
else()
|
||||||
|
set(SWIFT_FREESTANDING_TEST_DEPENDENCIES "")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Compatible cross-compile SDKS for Darwin OSes: IOS, IOS_SIMULATOR, TVOS,
|
# Compatible cross-compile SDKS for Darwin OSes: IOS, IOS_SIMULATOR, TVOS,
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
if(SWIFT_BUILD_SDK_OVERLAY)
|
if(SWIFT_BUILD_SDK_OVERLAY OR (SWIFT_BUILD_TEST_SUPPORT_MODULES AND NOT SWIFT_BUILD_DYNAMIC_SDK_OVERLAY_default))
|
||||||
# SwiftPrivateThreadExtras makes use of Darwin/Glibc, which is part of the
|
# SwiftPrivateThreadExtras makes use of Darwin/Glibc, which is part of the
|
||||||
# SDK overlay. It can't be built separately from the SDK overlay.
|
# SDK overlay. If the SDK overlay doesn't build by default, then it should
|
||||||
|
# be available in the SDK and DifferentiationUnittest can still be built.
|
||||||
if(SWIFT_ENABLE_EXPERIMENTAL_DIFFERENTIABLE_PROGRAMMING)
|
if(SWIFT_ENABLE_EXPERIMENTAL_DIFFERENTIABLE_PROGRAMMING)
|
||||||
add_subdirectory(DifferentiationUnittest)
|
add_subdirectory(DifferentiationUnittest)
|
||||||
endif()
|
endif()
|
||||||
@@ -20,7 +21,7 @@ if(SWIFT_BUILD_SDK_OVERLAY OR SWIFT_BUILD_TEST_SUPPORT_MODULES)
|
|||||||
add_subdirectory(StdlibUnittest)
|
add_subdirectory(StdlibUnittest)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(SWIFT_BUILD_SDK_OVERLAY)
|
if(SWIFT_BUILD_SDK_OVERLAY OR (SWIFT_BUILD_TEST_SUPPORT_MODULES AND NOT SWIFT_BUILD_DYNAMIC_SDK_OVERLAY_default))
|
||||||
add_subdirectory(OSLog)
|
add_subdirectory(OSLog)
|
||||||
|
|
||||||
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||||
|
|||||||
@@ -266,7 +266,7 @@ if(SWIFT_BUILD_STDLIB)
|
|||||||
add_subdirectory(core)
|
add_subdirectory(core)
|
||||||
add_subdirectory(SwiftOnoneSupport)
|
add_subdirectory(SwiftOnoneSupport)
|
||||||
|
|
||||||
if(SWIFT_BUILD_CLANG_OVERLAYS)
|
if(SWIFT_BUILD_CLANG_OVERLAYS OR SWIFT_BUILD_TEST_SUPPORT_MODULES)
|
||||||
add_subdirectory(ClangOverlays)
|
add_subdirectory(ClangOverlays)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@@ -315,13 +315,12 @@ if(SWIFT_BUILD_REMOTE_MIRROR)
|
|||||||
add_subdirectory(SwiftRemoteMirror)
|
add_subdirectory(SwiftRemoteMirror)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(SWIFT_BUILD_SDK_OVERLAY OR SWIFT_BUILD_TEST_SUPPORT_MODULES)
|
if(SWIFT_BUILD_SDK_OVERLAY OR (SWIFT_BUILD_TEST_SUPPORT_MODULES AND SWIFT_BUILD_DYNAMIC_SDK_OVERLAY_default))
|
||||||
add_subdirectory(Platform)
|
add_subdirectory(Platform)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(SWIFT_BUILD_SDK_OVERLAY)
|
if(SWIFT_BUILD_SDK_OVERLAY)
|
||||||
# On Apple platforms, we aren't building any overlays (other than Darwin in
|
# On Apple platforms, we aren't building any overlays. Instead, we're picking them up from the SDK.
|
||||||
# Platform above). Instead, we're picking them up from the SDK.
|
|
||||||
|
|
||||||
if(WINDOWS IN_LIST SWIFT_SDKS)
|
if(WINDOWS IN_LIST SWIFT_SDKS)
|
||||||
add_subdirectory(Windows)
|
add_subdirectory(Windows)
|
||||||
|
|||||||
@@ -9,12 +9,12 @@
|
|||||||
// CHECK: "arch":"{{[^"]*}}"
|
// CHECK: "arch":"{{[^"]*}}"
|
||||||
// CHECK: "swiftmodules":[
|
// CHECK: "swiftmodules":[
|
||||||
|
|
||||||
// Darwin, Swift and SwiftOnoneSupport is expected to be locally built;
|
// Swift and SwiftOnoneSupport is expected to be locally built;
|
||||||
// everything else comes from the SDK, built from swiftinterface.
|
// everything else comes from the SDK, built from swiftinterface.
|
||||||
|
|
||||||
// CHECK-DAG: "{{[^"]*}}/ObjectiveC.swiftmodule{{(\\/[^"]+[.]swift(module|interface))?}}"
|
// CHECK-DAG: "{{[^"]*}}/ObjectiveC.swiftmodule{{(\\/[^"]+[.]swift(module|interface))?}}"
|
||||||
// CHECK-DAG: "{{[^"]*}}/Dispatch.swiftmodule{{(\\/[^"]+[.]swift(module|interface))?}}"
|
// CHECK-DAG: "{{[^"]*}}/Dispatch.swiftmodule{{(\\/[^"]+[.]swift(module|interface))?}}"
|
||||||
// CHECK-DAG: "{{[^"]*}}/Darwin.swiftmodule{{(\\/[^"]+[.]swiftmodule)?}}"
|
// CHECK-DAG: "{{[^"]*}}/Darwin.swiftmodule{{(\\/[^"]+[.]swift(module|interface))?}}"
|
||||||
// CHECK-DAG: "{{[^"]*}}/Foundation.swiftmodule{{(\\/[^"]+[.]swift(module|interface))?}}"
|
// CHECK-DAG: "{{[^"]*}}/Foundation.swiftmodule{{(\\/[^"]+[.]swift(module|interface))?}}"
|
||||||
// CHECK-DAG: "{{[^"]*}}/Swift.swiftmodule{{(\\/[^"]+[.]swiftmodule)?}}"
|
// CHECK-DAG: "{{[^"]*}}/Swift.swiftmodule{{(\\/[^"]+[.]swiftmodule)?}}"
|
||||||
// CHECK-DAG: "{{[^"]*}}/SwiftOnoneSupport.swiftmodule{{(\\/[^"]+[.]swiftmodule)?}}"
|
// CHECK-DAG: "{{[^"]*}}/SwiftOnoneSupport.swiftmodule{{(\\/[^"]+[.]swiftmodule)?}}"
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
// CHECK: "swiftmodules":[
|
// CHECK: "swiftmodules":[
|
||||||
// CHECK-DAG: "{{[^"]*}}/ObjectiveC.swiftmodule{{(\\/[^"]+[.]swift(module|interface))?}}"
|
// CHECK-DAG: "{{[^"]*}}/ObjectiveC.swiftmodule{{(\\/[^"]+[.]swift(module|interface))?}}"
|
||||||
// CHECK-DAG: "{{[^"]*}}/Dispatch.swiftmodule{{(\\/[^"]+[.]swift(module|interface))?}}"
|
// CHECK-DAG: "{{[^"]*}}/Dispatch.swiftmodule{{(\\/[^"]+[.]swift(module|interface))?}}"
|
||||||
// CHECK-DAG: "{{[^"]*}}/Darwin.swiftmodule{{(\\/[^"]+[.]swiftmodule)?}}"
|
// CHECK-DAG: "{{[^"]*}}/Darwin.swiftmodule{{(\\/[^"]+[.]swift(module|interface))?}}"
|
||||||
// CHECK-DAG: "{{[^"]*}}/Foundation.swiftmodule{{(\\/[^"]+[.]swift(module|interface))?}}"
|
// CHECK-DAG: "{{[^"]*}}/Foundation.swiftmodule{{(\\/[^"]+[.]swift(module|interface))?}}"
|
||||||
// CHECK-DAG: "{{[^"]*}}/Swift.swiftmodule{{(\\/[^"]+[.]swiftmodule)?}}"
|
// CHECK-DAG: "{{[^"]*}}/Swift.swiftmodule{{(\\/[^"]+[.]swiftmodule)?}}"
|
||||||
// CHECK-DAG: "{{[^"]*}}/SwiftOnoneSupport.swiftmodule{{(\\/[^"]+[.]swiftmodule)?}}"
|
// CHECK-DAG: "{{[^"]*}}/SwiftOnoneSupport.swiftmodule{{(\\/[^"]+[.]swiftmodule)?}}"
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
// Make sure that we can deserialize darwin.
|
|
||||||
// RUN: %target-sil-opt %platform-sdk-overlay-dir/Darwin.swiftmodule/%target-swiftmodule-name -module-name Darwin > /dev/null
|
|
||||||
// RUN: llvm-bcanalyzer %platform-sdk-overlay-dir/Darwin.swiftmodule/%target-swiftmodule-name | %FileCheck %s
|
|
||||||
|
|
||||||
// REQUIRES: objc_interop
|
|
||||||
|
|
||||||
// CHECK-NOT: Unknown
|
|
||||||
@@ -9,6 +9,10 @@
|
|||||||
// REQUIRES: optimized_stdlib
|
// REQUIRES: optimized_stdlib
|
||||||
// REQUIRES: OS=macosx
|
// REQUIRES: OS=macosx
|
||||||
|
|
||||||
|
// The Darwin SDK overlay module in the macOS SDK cannot be imported in
|
||||||
|
// embedded Swift mode.
|
||||||
|
// XFAIL: OS=macosx
|
||||||
|
|
||||||
import _Concurrency
|
import _Concurrency
|
||||||
|
|
||||||
actor Number {
|
actor Number {
|
||||||
|
|||||||
@@ -9,6 +9,10 @@
|
|||||||
// REQUIRES: optimized_stdlib
|
// REQUIRES: optimized_stdlib
|
||||||
// REQUIRES: OS=macosx
|
// REQUIRES: OS=macosx
|
||||||
|
|
||||||
|
// The Darwin SDK overlay module in the macOS SDK cannot be imported in
|
||||||
|
// embedded Swift mode.
|
||||||
|
// XFAIL: OS=macosx
|
||||||
|
|
||||||
import _Concurrency
|
import _Concurrency
|
||||||
|
|
||||||
func fib(_ n: Int) -> Int {
|
func fib(_ n: Int) -> Int {
|
||||||
|
|||||||
@@ -9,6 +9,10 @@
|
|||||||
// REQUIRES: optimized_stdlib
|
// REQUIRES: optimized_stdlib
|
||||||
// REQUIRES: OS=macosx
|
// REQUIRES: OS=macosx
|
||||||
|
|
||||||
|
// The Darwin SDK overlay module in the macOS SDK cannot be imported in
|
||||||
|
// embedded Swift mode.
|
||||||
|
// XFAIL: OS=macosx
|
||||||
|
|
||||||
import _Concurrency
|
import _Concurrency
|
||||||
|
|
||||||
public func test() async -> Int {
|
public func test() async -> Int {
|
||||||
|
|||||||
@@ -11,6 +11,10 @@
|
|||||||
// REQUIRES: VENDOR=apple
|
// REQUIRES: VENDOR=apple
|
||||||
// REQUIRES: OS=macosx
|
// REQUIRES: OS=macosx
|
||||||
|
|
||||||
|
// The Darwin SDK overlay module in the macOS SDK cannot be imported in
|
||||||
|
// embedded Swift mode.
|
||||||
|
// XFAIL: OS=macosx
|
||||||
|
|
||||||
// BEGIN BridgingHeader.h
|
// BEGIN BridgingHeader.h
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|||||||
@@ -9,6 +9,10 @@
|
|||||||
// REQUIRES: VENDOR=apple
|
// REQUIRES: VENDOR=apple
|
||||||
// REQUIRES: OS=macosx
|
// REQUIRES: OS=macosx
|
||||||
|
|
||||||
|
// The Darwin SDK overlay module in the macOS SDK cannot be imported in
|
||||||
|
// embedded Swift mode.
|
||||||
|
// XFAIL: OS=macosx
|
||||||
|
|
||||||
import Darwin
|
import Darwin
|
||||||
|
|
||||||
@main
|
@main
|
||||||
|
|||||||
@@ -47,6 +47,10 @@
|
|||||||
// REQUIRES: optimized_stdlib
|
// REQUIRES: optimized_stdlib
|
||||||
// REQUIRES: OS=macosx
|
// REQUIRES: OS=macosx
|
||||||
|
|
||||||
|
// The Darwin SDK overlay module in the macOS SDK cannot be imported in
|
||||||
|
// embedded Swift mode.
|
||||||
|
// XFAIL: OS=macosx
|
||||||
|
|
||||||
import _Concurrency
|
import _Concurrency
|
||||||
|
|
||||||
public func test() async -> Int {
|
public func test() async -> Int {
|
||||||
|
|||||||
@@ -1533,8 +1533,8 @@ if run_vendor == 'apple':
|
|||||||
'%s -modulewrap -target %s' %
|
'%s -modulewrap -target %s' %
|
||||||
(config.swiftc, config.variant_triple))
|
(config.swiftc, config.variant_triple))
|
||||||
config.target_swift_emit_pcm = (
|
config.target_swift_emit_pcm = (
|
||||||
'%s -emit-pcm -target %s' %
|
'%s -emit-pcm -target %s -sdk %r' %
|
||||||
(config.swiftc, config.variant_triple))
|
(config.swiftc, config.variant_triple, config.variant_sdk))
|
||||||
subst_target_swift_frontend_mock_sdk_after = \
|
subst_target_swift_frontend_mock_sdk_after = \
|
||||||
target_options_for_mock_sdk_after
|
target_options_for_mock_sdk_after
|
||||||
config.target_sil_opt = (
|
config.target_sil_opt = (
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
import os
|
import os
|
||||||
|
import platform
|
||||||
|
|
||||||
import android.adb.commands
|
import android.adb.commands
|
||||||
|
|
||||||
@@ -1140,7 +1141,7 @@ def create_argument_parser():
|
|||||||
help='build static variants of the Swift standard library')
|
help='build static variants of the Swift standard library')
|
||||||
|
|
||||||
option('--build-swift-dynamic-sdk-overlay', toggle_true,
|
option('--build-swift-dynamic-sdk-overlay', toggle_true,
|
||||||
default=True,
|
default=platform.system() != "Darwin",
|
||||||
help='build dynamic variants of the Swift SDK overlay')
|
help='build dynamic variants of the Swift SDK overlay')
|
||||||
|
|
||||||
option('--build-swift-static-sdk-overlay', toggle_true,
|
option('--build-swift-static-sdk-overlay', toggle_true,
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
|
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
|
import platform
|
||||||
|
|
||||||
from build_swift import argparse
|
from build_swift import argparse
|
||||||
from build_swift import defaults
|
from build_swift import defaults
|
||||||
@@ -79,7 +80,7 @@ EXPECTED_DEFAULTS = {
|
|||||||
'build_runtime_with_host_compiler': False,
|
'build_runtime_with_host_compiler': False,
|
||||||
'build_stdlib_deployment_targets': ['all'],
|
'build_stdlib_deployment_targets': ['all'],
|
||||||
'build_subdir': None,
|
'build_subdir': None,
|
||||||
'build_swift_dynamic_sdk_overlay': True,
|
'build_swift_dynamic_sdk_overlay': platform.system() != "Darwin",
|
||||||
'build_swift_dynamic_stdlib': True,
|
'build_swift_dynamic_stdlib': True,
|
||||||
'build_swift_inspect': False,
|
'build_swift_inspect': False,
|
||||||
'build_swift_private_stdlib': True,
|
'build_swift_private_stdlib': True,
|
||||||
|
|||||||
Reference in New Issue
Block a user