|
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)), |
@@ -31,8 +44,7 @@ let coreFoundationBuildSettings: [CSetting] = [ |
31 | 44 | "\(Context.packageDirectory)/Sources/CoreFoundation/internalInclude/CoreFoundation_Prefix.h", |
32 | 45 | // /EHsc for Windows |
33 | 46 | ]), |
34 | | - .unsafeFlags(["-I/usr/lib/swift"], .when(platforms: [.linux, .android])), // dispatch |
35 | | - .unsafeFlags(["-I/usr/lib/swift/Block"], .when(platforms: [.linux, .android])) // Block.h |
| 47 | + dispatchIncludeFlags |
36 | 48 | ] |
37 | 49 |
|
38 | 50 | // For _CFURLSessionInterface, _CFXMLInterface |
@@ -60,8 +72,7 @@ let interfaceBuildSettings: [CSetting] = [ |
60 | 72 | "-fcf-runtime-abi=swift" |
61 | 73 | // /EHsc for Windows |
62 | 74 | ]), |
63 | | - .unsafeFlags(["-I/usr/lib/swift"], .when(platforms: [.linux, .android])), // dispatch |
64 | | - .unsafeFlags(["-I/usr/lib/swift/Block"], .when(platforms: [.linux, .android])) // Block.h |
| 75 | + dispatchIncludeFlags |
65 | 76 | ] |
66 | 77 |
|
67 | 78 | let swiftBuildSettings: [SwiftSetting] = [ |
|
0 commit comments