Skip to content

Commit 32ca833

Browse files
committed
FIx Linux platform include CF issue
1 parent d840bbc commit 32ca833

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

Package.swift

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// swift-tools-version: 6.0
22

3+
import Foundation
34
import PackageDescription
45

56
func envEnable(_ key: String, default defaultValue: Bool = false) -> Bool {
@@ -22,7 +23,15 @@ let development = envEnable("OPENBOX_DEVELOPMENT")
2223

2324
let releaseVersion = Context.environment["OPENBOX_TARGET_RELEASE"].flatMap { Int($0) } ?? 2024
2425

25-
let sharedCSettings: [CSetting] = []
26+
let swiftBinPath = Context.environment["_"] ?? "/usr/bin/swift"
27+
let swiftBinURL = URL(fileURLWithPath: swiftBinPath)
28+
let SDKPath = swiftBinURL.deletingLastPathComponent().deletingLastPathComponent().deletingLastPathComponent().path
29+
let includePath = SDKPath.appending("/usr/lib/swift")
30+
31+
let sharedCSettings: [CSetting] = [
32+
.unsafeFlags(["-I", includePath], .when(platforms: .nonDarwinPlatforms)),
33+
.define("__COREFOUNDATION_FORSWIFTFOUNDATIONONLY__", to: "1", .when(platforms: .nonDarwinPlatforms)),
34+
]
2635
let sharedSwiftSettings: [SwiftSetting] = []
2736

2837
// MARK: - Targets
@@ -125,5 +134,3 @@ extension [Platform] {
125134
[.linux, .android, .wasi, .openbsd, .windows]
126135
}
127136
}
128-
129-

0 commit comments

Comments
 (0)