Bump the deployment target for the compiler to macOS 13.0

Bump the deployment target from macOS 10.13-aligned versions to macOS
13.0-aligned versions. This allows us to stop linking CoreFoundation
in the swift runtime, which was previously required for availability
checking. It also lets us align the deployment target on x86_64 with
arm64, which was 11.0. Finally, it is a prerequisite to being able to
build swift using the macOS 15 beta SDKs.

(cherry picked from commit ad82d86041)
(cherry picked from commit cd71e316ee)
This commit is contained in:
Ben Langmuir
2024-08-14 16:49:12 -07:00
parent c90b291a04
commit b87b263742
10 changed files with 36 additions and 25 deletions

View File

@@ -556,16 +556,16 @@ option(SWIFT_ALLOW_LINKING_SWIFT_CONTENT_IN_DARWIN_TOOLCHAIN
This is needed to support Apple internal configurations."
FALSE)
set(SWIFT_DARWIN_DEPLOYMENT_VERSION_OSX "10.13" CACHE STRING
set(SWIFT_DARWIN_DEPLOYMENT_VERSION_OSX "13.0" CACHE STRING
"Minimum deployment target version for OS X")
set(SWIFT_DARWIN_DEPLOYMENT_VERSION_IOS "11.0" CACHE STRING
set(SWIFT_DARWIN_DEPLOYMENT_VERSION_IOS "16.0" CACHE STRING
"Minimum deployment target version for iOS")
set(SWIFT_DARWIN_DEPLOYMENT_VERSION_TVOS "11.0" CACHE STRING
set(SWIFT_DARWIN_DEPLOYMENT_VERSION_TVOS "16.0" CACHE STRING
"Minimum deployment target version for tvOS")
set(SWIFT_DARWIN_DEPLOYMENT_VERSION_WATCHOS "4.0" CACHE STRING
set(SWIFT_DARWIN_DEPLOYMENT_VERSION_WATCHOS "9.0" CACHE STRING
"Minimum deployment target version for watchOS")
set(SWIFT_DARWIN_DEPLOYMENT_VERSION_XROS "1.0" CACHE STRING

View File

@@ -110,10 +110,10 @@ macro(configure_sdks_darwin)
set(appletvos_arch "arm64")
set(watchos_arch "armv7k" "arm64_32")
set(macosx_ver "10.13")
set(iphoneos_ver "11.0")
set(appletvos_ver "11.0")
set(watchos_ver "4.0")
set(macosx_ver "13.0")
set(iphoneos_ver "16.0")
set(appletvos_ver "16.0")
set(watchos_ver "9.0")
set(macosx_vendor "apple")
set(iphoneos_vendor "apple")

View File

@@ -18,6 +18,13 @@ set(SUPPORTED_OSX_ARCHS "x86_64;arm64")
set(SUPPORTED_XROS_ARCHS "arm64;arm64e")
set(SUPPORTED_XROS_SIMULATOR_ARCHS "arm64")
if(SWIFT_DARWIN_DEPLOYMENT_VERSION_WATCHOS VERSION_GREATER_EQUAL 7.0)
list(REMOVE_ITEM SUPPORTED_WATCHOS_SIMULATOR_ARCHS "i386")
endif()
if(SWIFT_DARWIN_DEPLOYMENT_VERSION_WATCHOS VERSION_GREATER_EQUAL 9.0)
list(REMOVE_ITEM SUPPORTED_WATCHOS_ARCHS "armv7k")
endif()
is_sdk_requested(OSX swift_build_osx)
if(swift_build_osx)
configure_sdk_darwin(

View File

@@ -4,9 +4,9 @@ config.substitutions = list(config.substitutions)
if config.target_sdk_name == 'macosx':
def do_fixup(key, value):
if isinstance(value, str):
value = value.replace("-apple-macosx10.13", "-apple-macos14")
value = value.replace("-apple-macosx13.0", "-apple-macos14")
elif isinstance(value, SubstituteCaptures):
value.substitution = value.substitution.replace("-apple-macosx10.13", "-apple-macos14")
value.substitution = value.substitution.replace("-apple-macosx13.0", "-apple-macos14")
return (key, value)
config.substitutions = [do_fixup(a, b) for (a, b) in config.substitutions]

View File

@@ -695,7 +695,7 @@ build-ninja
# to LLVM_USE_RUNTIMES to build compiler-rt (#60993), so we can leverage
# the value for SANITIZER_MIN_OSX_VERSION set in cmake_product.py
extra-cmake-options=
-DCLANG_COMPILER_RT_CMAKE_ARGS:STRING="-DSANITIZER_MIN_OSX_VERSION:STRING=10.13"
-DCLANG_COMPILER_RT_CMAKE_ARGS:STRING="-DSANITIZER_MIN_OSX_VERSION:STRING=13.0"
# Do not build swift or cmark
skip-build-swift

View File

@@ -424,7 +424,7 @@ def apply_default_arguments(toolchain, args):
for target in targets
if (not target.platform.is_darwin or
target.platform.sdk_supports_architecture(
target.arch, args.darwin_xcrun_toolchain))
target.arch, args.darwin_xcrun_toolchain, args))
]
# Include the Darwin module-only architectures in the CMake options.

View File

@@ -101,10 +101,10 @@ KNOWN_SETTINGS=(
## Darwin Options
darwin-crash-reporter-client "" "whether to enable CrashReporter integration, default is 1 on Darwin platforms, 0 otherwise"
darwin-deployment-version-ios "11.0" "minimum deployment target version for iOS"
darwin-deployment-version-osx "10.13" "minimum deployment target version for OS X"
darwin-deployment-version-tvos "11.0" "minimum deployment target version for tvOS"
darwin-deployment-version-watchos "4.0" "minimum deployment target version for watchOS"
darwin-deployment-version-ios "16.0" "minimum deployment target version for iOS"
darwin-deployment-version-osx "13.0" "minimum deployment target version for OS X"
darwin-deployment-version-tvos "16.0" "minimum deployment target version for tvOS"
darwin-deployment-version-watchos "9.0" "minimum deployment target version for watchOS"
darwin-deployment-version-xros "1.0" "minimum deployment target version for xrOS"
darwin-install-extract-symbols "" "whether to extract symbols with dsymutil during installations"
darwin-install-extract-symbols-use-just-built-dsymutil "1" "whether we should extract symbols using the just built dsymutil"

View File

@@ -52,10 +52,10 @@ CLANG_USER_VISIBLE_VERSION = Version('17.0.0')
SWIFT_ANALYZE_CODE_COVERAGE = 'false'
DARWIN_XCRUN_TOOLCHAIN = 'default'
DARWIN_DEPLOYMENT_VERSION_OSX = '10.13'
DARWIN_DEPLOYMENT_VERSION_IOS = '11.0'
DARWIN_DEPLOYMENT_VERSION_TVOS = '11.0'
DARWIN_DEPLOYMENT_VERSION_WATCHOS = '4.0'
DARWIN_DEPLOYMENT_VERSION_OSX = '13.0'
DARWIN_DEPLOYMENT_VERSION_IOS = '16.0'
DARWIN_DEPLOYMENT_VERSION_TVOS = '16.0'
DARWIN_DEPLOYMENT_VERSION_WATCHOS = '9.0'
DARWIN_DEPLOYMENT_VERSION_XROS = '1.0'
UNIX_INSTALL_PREFIX = '/usr'

View File

@@ -12,7 +12,7 @@ extension {Type}: _ObjectiveCBridgeable {{
_getObjCTypeEncoding({Type}.self)) == 0,
"NSValue does not contain the right type to bridge to {Type}")
result = {Type}()
if #available(OSX 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *) {{
if #available(OSX 13.0, iOS 16.0, tvOS 16.0, watchOS 9.0, *) {{
source.getValue(&result!, size: MemoryLayout<{Type}>.size)
}} else {{
source.getValue(&result!)
@@ -27,7 +27,7 @@ extension {Type}: _ObjectiveCBridgeable {{
return false
}}
result = {Type}()
if #available(OSX 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *) {{
if #available(OSX 13.0, iOS 16.0, tvOS 16.0, watchOS 9.0, *) {{
source.getValue(&result!, size: MemoryLayout<{Type}>.size)
}} else {{
source.getValue(&result!)
@@ -42,7 +42,7 @@ extension {Type}: _ObjectiveCBridgeable {{
_getObjCTypeEncoding({Type}.self)) == 0,
"NSValue does not contain the right type to bridge to {Type}")
var result = {Type}()
if #available(OSX 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *) {{
if #available(OSX 13.0, iOS 16.0, tvOS 16.0, watchOS 9.0, *) {{
unwrappedSource.getValue(&result, size: MemoryLayout<{Type}>.size)
}} else {{
unwrappedSource.getValue(&result)

View File

@@ -11,12 +11,15 @@
import os
import platform
from . import cmake
from . import shell
try:
from build_swift.build_swift.versions import Version
from build_swift.build_swift.wrappers import xcrun
except ImportError:
from build_swift.versions import Version
from build_swift.wrappers import xcrun
@@ -113,7 +116,7 @@ class DarwinPlatform(Platform):
"""
return self.is_embedded and not self.is_simulator
def sdk_supports_architecture(self, arch, toolchain):
def sdk_supports_architecture(self, arch, toolchain, args):
"""
Convenience function for checking whether the SDK supports the
target architecture.
@@ -122,7 +125,8 @@ class DarwinPlatform(Platform):
# The names match up with the xcrun SDK names.
xcrun_sdk_name = self.name
if (xcrun_sdk_name == 'watchos' and arch == 'armv7k'):
if (xcrun_sdk_name == 'watchos' and arch == 'armv7k' and
Version(args.darwin_deployment_version_watchos) < Version('9.0')):
return True
sdk_path = xcrun.sdk_path(sdk=xcrun_sdk_name, toolchain=toolchain)