33
44import PackageDescription
55
6- var dispatchIncludeFlags : CSetting
6+ var dispatchIncludeFlags : [ CSetting ]
77if 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
1927let 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
5158let 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
7884let swiftBuildSettings : [ SwiftSetting ] = [
7985 . define( " DEPLOYMENT_RUNTIME_SWIFT " ) ,
0 commit comments