|
3 | 3 |
|
4 | 4 | import PackageDescription |
5 | 5 |
|
| 6 | +var dispatchIncludeFlags: CSetting |
| 7 | +if let environmentPath = Context.environment["DISPATCH_INCLUDE_PATH"] { |
| 8 | + dispatchIncludeFlags = .unsafeFlags([ |
| 9 | + "-I\(environmentPath)", |
| 10 | + "-I\(environmentPath)/Block" |
| 11 | + ]) |
| 12 | +} else { |
| 13 | + dispatchIncludeFlags = .unsafeFlags([ |
| 14 | + "-I/usr/lib/swift", |
| 15 | + "-I/usr/lib/swift/Block" |
| 16 | + ], .when(platforms: [.linux, .android])) |
| 17 | +} |
| 18 | + |
6 | 19 | let coreFoundationBuildSettings: [CSetting] = [ |
7 | 20 | .headerSearchPath("internalInclude"), |
8 | 21 | .define("DEBUG", .when(configuration: .debug)), |
@@ -30,8 +43,7 @@ let coreFoundationBuildSettings: [CSetting] = [ |
30 | 43 | "\(Context.packageDirectory)/Sources/CoreFoundation/internalInclude/CoreFoundation_Prefix.h", |
31 | 44 | // /EHsc for Windows |
32 | 45 | ]), |
33 | | - .unsafeFlags(["-I/usr/lib/swift"], .when(platforms: [.linux, .android])), // dispatch |
34 | | - .unsafeFlags(["-I/usr/lib/swift/Block"], .when(platforms: [.linux, .android])) // Block.h |
| 46 | + dispatchIncludeFlags |
35 | 47 | ] |
36 | 48 |
|
37 | 49 | // For _CFURLSessionInterface, _CFXMLInterface |
@@ -59,8 +71,7 @@ let interfaceBuildSettings: [CSetting] = [ |
59 | 71 | "-fcf-runtime-abi=swift" |
60 | 72 | // /EHsc for Windows |
61 | 73 | ]), |
62 | | - .unsafeFlags(["-I/usr/lib/swift"], .when(platforms: [.linux, .android])), // dispatch |
63 | | - .unsafeFlags(["-I/usr/lib/swift/Block"], .when(platforms: [.linux, .android])) // Block.h |
| 74 | + dispatchIncludeFlags |
64 | 75 | ] |
65 | 76 |
|
66 | 77 | let swiftBuildSettings: [SwiftSetting] = [ |
|
0 commit comments