Skip to content

Commit 1bbb017

Browse files
committed
Fix SwiftPM build dispatch include path on Windows
1 parent af24464 commit 1bbb017

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

Package.swift

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,25 @@
33

44
import PackageDescription
55

6-
var dispatchIncludeFlags: CSetting
6+
var dispatchIncludeFlags: [CSetting]
77
if let environmentPath = Context.environment["DISPATCH_INCLUDE_PATH"] {
8-
dispatchIncludeFlags = .unsafeFlags([
8+
dispatchIncludeFlags = [.unsafeFlags([
99
"-I\(environmentPath)",
1010
"-I\(environmentPath)/Block"
11-
])
11+
])]
1212
} else {
13-
dispatchIncludeFlags = .unsafeFlags([
14-
"-I/usr/lib/swift",
15-
"-I/usr/lib/swift/Block"
16-
], .when(platforms: [.linux, .android]))
13+
dispatchIncludeFlags = [
14+
.unsafeFlags([
15+
"-I/usr/lib/swift",
16+
"-I/usr/lib/swift/Block"
17+
], .when(platforms: [.linux, .android]))
18+
]
19+
if let sdkRoot = Context.environment["SDKROOT"] {
20+
dispatchIncludeFlags.append(.unsafeFlags([
21+
"-I\(sdkRoot)usr\\include",
22+
"-I\(sdkRoot)usr\\include\\Block",
23+
], .when(platforms: [.windows])))
24+
}
1725
}
1826

1927
let coreFoundationBuildSettings: [CSetting] = [
@@ -43,9 +51,8 @@ let coreFoundationBuildSettings: [CSetting] = [
4351
"-include",
4452
"\(Context.packageDirectory)/Sources/CoreFoundation/internalInclude/CoreFoundation_Prefix.h",
4553
// /EHsc for Windows
46-
]),
47-
dispatchIncludeFlags
48-
]
54+
])
55+
] + dispatchIncludeFlags
4956

5057
// For _CFURLSessionInterface, _CFXMLInterface
5158
let interfaceBuildSettings: [CSetting] = [
@@ -71,9 +78,8 @@ let interfaceBuildSettings: [CSetting] = [
7178
"-fno-common",
7279
"-fcf-runtime-abi=swift"
7380
// /EHsc for Windows
74-
]),
75-
dispatchIncludeFlags
76-
]
81+
])
82+
] + dispatchIncludeFlags
7783

7884
let swiftBuildSettings: [SwiftSetting] = [
7985
.define("DEPLOYMENT_RUNTIME_SWIFT"),

0 commit comments

Comments
 (0)