File tree Expand file tree Collapse file tree 4 files changed +26
-4
lines changed Expand file tree Collapse file tree 4 files changed +26
-4
lines changed Original file line number Diff line number Diff line change @@ -291,7 +291,8 @@ extension Driver {
291
291
292
292
try toolchain. addPlatformSpecificCommonFrontendOptions ( commandLine: & commandLine,
293
293
inputs: & inputs,
294
- frontendTargetInfo: frontendTargetInfo)
294
+ frontendTargetInfo: frontendTargetInfo,
295
+ driver: self )
295
296
}
296
297
297
298
mutating func addFrontendSupplementaryOutputArguments( commandLine: inout [ Job . ArgTemplate ] ,
Original file line number Diff line number Diff line change @@ -339,7 +339,8 @@ public final class DarwinToolchain: Toolchain {
339
339
public func addPlatformSpecificCommonFrontendOptions(
340
340
commandLine: inout [ Job . ArgTemplate ] ,
341
341
inputs: inout [ TypedVirtualPath ] ,
342
- frontendTargetInfo: FrontendTargetInfo
342
+ frontendTargetInfo: FrontendTargetInfo ,
343
+ driver: Driver
343
344
) throws {
344
345
guard let sdkPath = frontendTargetInfo. sdkPath? . path,
345
346
let sdkInfo = getTargetSDKInfo ( sdkPath: sdkPath) else { return }
@@ -351,6 +352,12 @@ public final class DarwinToolchain: Toolchain {
351
352
commandLine. append ( . flag( " -target-variant-sdk-version " ) )
352
353
commandLine. append ( . flag( sdkInfo. sdkVersion ( for: targetVariantTriple) . description) )
353
354
}
355
+
356
+ if driver. isFrontendArgSupported ( . targetSdkName) {
357
+ commandLine. append ( . flag( Option . targetSdkName. spelling) )
358
+ commandLine. append ( . flag( sdkInfo. canonicalName) )
359
+ }
360
+
354
361
// We should be able to pass down prebuilt module dir for all other SDKs.
355
362
// For macCatalyst, doing so is specifically necessary because -target-sdk-version
356
363
// doesn't always match the macosx sdk version so the compiler may fail to find
Original file line number Diff line number Diff line change @@ -96,7 +96,8 @@ public protocol Toolchain {
96
96
func addPlatformSpecificCommonFrontendOptions(
97
97
commandLine: inout [ Job . ArgTemplate ] ,
98
98
inputs: inout [ TypedVirtualPath ] ,
99
- frontendTargetInfo: FrontendTargetInfo
99
+ frontendTargetInfo: FrontendTargetInfo ,
100
+ driver: Driver
100
101
) throws
101
102
102
103
var dummyForTestingObjectFormat : Triple . ObjectFormat { get }
@@ -220,7 +221,8 @@ extension Toolchain {
220
221
public func addPlatformSpecificCommonFrontendOptions(
221
222
commandLine: inout [ Job . ArgTemplate ] ,
222
223
inputs: inout [ TypedVirtualPath ] ,
223
- frontendTargetInfo: FrontendTargetInfo
224
+ frontendTargetInfo: FrontendTargetInfo ,
225
+ driver: Driver
224
226
) throws { }
225
227
}
226
228
Original file line number Diff line number Diff line change @@ -3091,6 +3091,12 @@ final class SwiftDriverTests: XCTestCase {
3091
3091
. flag( " -target-sdk-version " ) ,
3092
3092
. flag( " 10.15.0 " )
3093
3093
] ) )
3094
+ if driver. isFrontendArgSupported ( . targetSdkName) {
3095
+ XCTAssertTrue ( frontendJobs [ 0 ] . commandLine. contains ( subsequence: [
3096
+ . flag( " -target-sdk-name " ) ,
3097
+ . flag( " macosx10.15 " ) ,
3098
+ ] ) )
3099
+ }
3094
3100
XCTAssertEqual ( frontendJobs [ 1 ] . kind, . link)
3095
3101
XCTAssertTrue ( frontendJobs [ 1 ] . commandLine. contains ( subsequence: [
3096
3102
. flag( " -platform_version " ) ,
@@ -3141,6 +3147,12 @@ final class SwiftDriverTests: XCTestCase {
3141
3147
. flag( " -target-variant-sdk-version " ) ,
3142
3148
. flag( " 13.4.0 " )
3143
3149
] ) )
3150
+ if driver. isFrontendArgSupported ( . targetSdkName) {
3151
+ XCTAssertTrue ( frontendJobs [ 0 ] . commandLine. contains ( subsequence: [
3152
+ . flag( " -target-sdk-name " ) ,
3153
+ . flag( " macosx10.15.4 " ) ,
3154
+ ] ) )
3155
+ }
3144
3156
XCTAssertEqual ( frontendJobs [ 1 ] . kind, . link)
3145
3157
XCTAssertTrue ( frontendJobs [ 1 ] . commandLine. contains ( subsequence: [
3146
3158
. flag( " -platform_version " ) ,
You can’t perform that action at this time.
0 commit comments