Skip to content

Bump the deployment target for the compiler to macOS 13.0 #75914

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 4 commits into from
Sep 6, 2024
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
8 changes: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -552,16 +552,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
Expand Down
8 changes: 4 additions & 4 deletions benchmark/cmake/modules/AddSwiftBenchmarkSuite.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
8 changes: 4 additions & 4 deletions cmake/modules/SwiftConfigureSDK.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function(_report_sdk prefix)
endfunction()

# Remove architectures not supported by the SDK from the given list.
function(remove_sdk_unsupported_archs name os sdk_path architectures_var)
function(remove_sdk_unsupported_archs name os sdk_path deployment_version architectures_var)
execute_process(COMMAND
/usr/libexec/PlistBuddy -c "Print :SupportedTargets:${os}:Archs" ${sdk_path}/SDKSettings.plist
OUTPUT_VARIABLE sdk_supported_archs
Expand All @@ -87,11 +87,11 @@ function(remove_sdk_unsupported_archs name os sdk_path architectures_var)
# 32-bit iOS simulator is not listed explicitly in SDK settings.
message(STATUS "Assuming ${name} SDK at ${sdk_path} supports architecture ${arch}")
list(APPEND architectures ${arch})
elseif(arch STREQUAL "armv7k" AND os STREQUAL "watchos")
elseif(arch STREQUAL "armv7k" AND os STREQUAL "watchos" AND deployment_version VERSION_LESS "9.0")
# 32-bit watchOS is not listed explicitly in SDK settings.
message(STATUS "Assuming ${name} SDK at ${sdk_path} supports architecture ${arch}")
list(APPEND architectures ${arch})
elseif(arch STREQUAL "i386" AND os STREQUAL "watchsimulator")
elseif(arch STREQUAL "i386" AND os STREQUAL "watchsimulator" AND deployment_version VERSION_LESS "7.0")
# 32-bit watchOS simulator is not listed explicitly in SDK settings.
message(STATUS "Assuming ${name} SDK at ${sdk_path} supports architecture ${arch}")
list(APPEND architectures ${arch})
Expand Down Expand Up @@ -229,7 +229,7 @@ macro(configure_sdk_darwin
endif()

# Remove any architectures not supported by the SDK.
remove_sdk_unsupported_archs(${name} ${xcrun_name} ${SWIFT_SDK_${prefix}_PATH} SWIFT_SDK_${prefix}_ARCHITECTURES)
remove_sdk_unsupported_archs(${name} ${xcrun_name} ${SWIFT_SDK_${prefix}_PATH} "${SWIFT_SDK_${prefix}_DEPLOYMENT_VERSION}" SWIFT_SDK_${prefix}_ARCHITECTURES)

list_intersect(
"${SWIFT_DARWIN_MODULE_ARCHS}" # lhs
Expand Down
4 changes: 2 additions & 2 deletions test/Interpreter/SDK/submodules_smoke_test.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
// REQUIRES: OS=macosx

import OpenGL.GL3
_ = glGetString
_ = OpenGL.glGetString
_ = glGetString // expected-warning * {{'glGetString' was deprecated}}
_ = OpenGL.glGetString // expected-warning * {{'glGetString' was deprecated}}
_ = GL_COLOR_BUFFER_BIT
_ = OpenGL.GL_COLOR_BUFFER_BIT

Expand Down
4 changes: 2 additions & 2 deletions test/embedded/lit.local.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion test/stdlib/Foundation_NewGenericAPIs.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func test_NSCoder_decodeTopLevelObjectOfClasses_forKey_error(


func test_NSKeyedUnarchiver_unarchiveObjectWithData(_ data: NSData) {
var r = NSKeyedUnarchiver.unarchiveObject(with: data as Data)
var r = NSKeyedUnarchiver.unarchiveObject(with: data as Data) // expected-warning * {{'unarchiveObject(with:)' was deprecated}}
expectType(Optional<Any>.self, &r)
}

Expand Down
4 changes: 3 additions & 1 deletion test/stdlib/Reflection_objc.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// RUN: %empty-directory(%t)
//
// RUN: %target-clang %S/Inputs/Mirror/Mirror.mm -c -o %t/Mirror.mm.o -g
// RUN: %target-build-swift -parse-stdlib %s -module-name Reflection -I %S/Inputs/Mirror/ -Xlinker %t/Mirror.mm.o -o %t/a.out
// Note: explicitly link the CoreGraphics overlay because does not get autolinked
// and it is needed for conformances on macOS < 15.
// RUN: %target-build-swift -parse-stdlib %s -module-name Reflection -I %S/Inputs/Mirror/ -Xlinker %t/Mirror.mm.o -o %t/a.out -lswiftCoreGraphics
// RUN: %target-codesign %t/a.out
// RUN: %{python} %S/../Inputs/timeout.py 360 %target-run %t/a.out %S/Inputs/shuffle.jpg | %FileCheck %s
// FIXME: timeout wrapper is necessary because the ASan test runs for hours
Expand Down
2 changes: 1 addition & 1 deletion utils/build-presets.ini
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,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
Expand Down
2 changes: 1 addition & 1 deletion utils/build-script
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 4 additions & 4 deletions utils/build-script-impl
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
8 changes: 4 additions & 4 deletions utils/build_swift/build_swift/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@
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'
Expand Down
6 changes: 3 additions & 3 deletions utils/gyb_foundation_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def ObjectiveCBridgeableImplementationForNSValue(Type):
_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!)
Expand All @@ -27,7 +27,7 @@ def ObjectiveCBridgeableImplementationForNSValue(Type):
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!)
Expand All @@ -42,7 +42,7 @@ def ObjectiveCBridgeableImplementationForNSValue(Type):
_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)
Expand Down
8 changes: 6 additions & 2 deletions utils/swift_build_support/swift_build_support/targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -113,7 +116,7 @@ def uses_host_tests(self):
"""
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.
Expand All @@ -122,7 +125,8 @@ def sdk_supports_architecture(self, arch, toolchain):
# 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)
Expand Down