@@ -103,21 +103,15 @@ public struct Destination {
103
103
}
104
104
105
105
// Compute common arguments for clang and swift.
106
- var extraCCFlags : [ String ] = [ ]
107
- var extraSwiftCFlags : [ String ] = [ ]
108
- if let sdkPaths = Destination . sdkPlatformFrameworkPaths ( environment: environment) {
109
- extraCCFlags += [ " -F " , sdkPaths. fwk. pathString]
110
- extraSwiftCFlags += [ " -F " , sdkPaths. fwk. pathString]
111
- extraSwiftCFlags += [ " -I " , sdkPaths. lib. pathString]
112
- extraSwiftCFlags += [ " -L " , sdkPaths. lib. pathString]
113
- }
106
+ // This is currently just frameworks path.
107
+ let commonArgs = Destination . sdkPlatformFrameworkPath ( environment: environment) . map ( { [ " -F " , $0. pathString] } ) ?? [ ]
114
108
115
109
return Destination (
116
110
target: hostTargetTriple,
117
111
sdk: sdkPath,
118
112
binDir: binDir,
119
- extraCCFlags: extraCCFlags ,
120
- extraSwiftCFlags: extraSwiftCFlags ,
113
+ extraCCFlags: commonArgs ,
114
+ extraSwiftCFlags: commonArgs ,
121
115
extraCPPFlags: [ " -lc++ " ]
122
116
)
123
117
#else
@@ -133,31 +127,21 @@ public struct Destination {
133
127
}
134
128
135
129
/// Returns macosx sdk platform framework path.
136
- public static func sdkPlatformFrameworkPaths(
137
- environment: [ String : String ] = Process . env
138
- ) -> ( fwk: AbsolutePath , lib: AbsolutePath ) ? {
130
+ public static func sdkPlatformFrameworkPath( environment: [ String : String ] = Process . env) -> AbsolutePath ? {
139
131
if let path = _sdkPlatformFrameworkPath {
140
132
return path
141
133
}
142
134
let platformPath = try ? Process . checkNonZeroExit (
143
- arguments: [ " xcrun " , " --sdk " , " macosx " , " --show-sdk-platform-path " ] ,
144
- environment: environment) . spm_chomp ( )
135
+ arguments: [ " xcrun " , " --sdk " , " macosx " , " --show-sdk-platform-path " ] , environment: environment) . spm_chomp ( )
145
136
146
137
if let platformPath = platformPath, !platformPath. isEmpty {
147
- // For XCTest framework.
148
- let fwk = AbsolutePath ( platformPath) . appending (
138
+ _sdkPlatformFrameworkPath = AbsolutePath ( platformPath) . appending (
149
139
components: " Developer " , " Library " , " Frameworks " )
150
-
151
- // For XCTest Swift library.
152
- let lib = AbsolutePath ( platformPath) . appending (
153
- components: " Developer " , " usr " , " lib " )
154
-
155
- _sdkPlatformFrameworkPath = ( fwk, lib)
156
140
}
157
141
return _sdkPlatformFrameworkPath
158
142
}
159
143
/// Cache storage for sdk platform path.
160
- private static var _sdkPlatformFrameworkPath : ( fwk : AbsolutePath , lib : AbsolutePath ) ? = nil
144
+ private static var _sdkPlatformFrameworkPath : AbsolutePath ? = nil
161
145
162
146
/// Target triple for the host system.
163
147
private static let hostTargetTriple = Triple . hostTriple
0 commit comments