-
Notifications
You must be signed in to change notification settings - Fork 10.5k
🍒[cxx-interop] Lower macOS deployment target version for the Cxx module #69605
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
🍒[cxx-interop] Lower macOS deployment target version for the Cxx module #69605
Conversation
The CMake flag `DEPLOYMENT_VERSION_OSX` is currently only passed to the C compiler. This change makes sure it is also passed to the Swift compiler, e.g. when building Swift-only targets like Cxx or CxxStdlib. rdar://117699474 (cherry picked from commit e192ee2)
The Cxx module does not rely on any modern OS features. It can be deployed to older macOS versions. rdar://117699474 (cherry picked from commit 00cdb66)
@swift-ci please test |
@@ -23,6 +23,8 @@ add_swift_target_library(swiftCxx STATIC NO_LINK_NAME IS_STDLIB IS_SWIFT_ONLY IS | |||
# For functionality that depends on the C++ stdlib, use C++ stdlib overlay (`swiftstd` module). | |||
-Xcc -nostdinc++ | |||
|
|||
DEPLOYMENT_VERSION_OSX ${COMPATIBILITY_MINIMUM_DEPLOYMENT_VERSION_OSX} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like this needs to be done for all Apple OS's, as we do for the various compatibility libraries, e.g.,
DEPLOYMENT_VERSION_OSX ${COMPATIBILITY_MINIMUM_DEPLOYMENT_VERSION_OSX}
DEPLOYMENT_VERSION_IOS ${COMPATIBILITY_MINIMUM_DEPLOYMENT_VERSION_IOS}
DEPLOYMENT_VERSION_TVOS ${COMPATIBILITY_MINIMUM_DEPLOYMENT_VERSION_TVOS}
DEPLOYMENT_VERSION_WATCHOS ${COMPATIBILITY_MINIMUM_DEPLOYMENT_VERSION_WATCHOS}
MACCATALYST_BUILD_FLAVOR "zippered"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, I added other Apple platforms here
@@ -49,6 +49,8 @@ add_swift_target_library(swiftCxxStdlib STATIC NO_LINK_NAME IS_STDLIB IS_SWIFT_O | |||
SWIFT_COMPILE_FLAGS_LINUX | |||
${SWIFT_SDK_LINUX_CXX_OVERLAY_SWIFT_COMPILE_FLAGS} | |||
|
|||
DEPLOYMENT_VERSION_OSX ${COMPATIBILITY_MINIMUM_DEPLOYMENT_VERSION_OSX} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment here about all Apple platforms
@@ -452,6 +457,7 @@ function(_compile_swift_files | |||
"${SWIFT_STDLIB_BUILD_TYPE}" | |||
"${SWIFT_STDLIB_ASSERTIONS}" | |||
swift_flags | |||
DEPLOYMENT_VERSION_OSX ${SWIFTFILE_DEPLOYMENT_VERSION_OSX} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm surprised that any of these changes are needed, given that add_swift_target_library
is already being used with these DEPLOYMENT_VERSION_*
options elsewhere. Are you sure these changes here are necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add_swift_target_library
currently only applies these options for C/C++ source files. Here we're making it apply DEPLOYMENT_VERSION_*
for Swift modules as well.
@swift-ci please test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good now, thank you!
Explanation: The Cxx module does not rely on any modern OS features. It can be deployed to older macOS versions. Having a high deployment target blocks certain usage workflows of the Cxx module.
Scope: All of the code changes are on a C++ interop only code path.
Risk: Low, only takes effect when C++ interop is enabled.
Testing: Covered by LIT tests.
Original PR: #69512
rdar://117699474