Skip to content

Commit

Permalink
Add a workaround for swift-corelibs-foundation on Linux/Android
Browse files Browse the repository at this point in the history
CoreFoundation depends on dispatch, this dependency is implicit
and dispatch itself is bundled with swift toolchains. Let's add
a package specific workaround for Linux/Android targets to add
toolchain resources directory to search paths of clang build targets.
  • Loading branch information
xedin committed Mar 26, 2024
1 parent c86ea69 commit 0871a04
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Sources/Build/BuildDescription/ClangTargetBuildDescription.swift
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,18 @@ package final class ClangTargetBuildDescription {
args += ["-I", includeSearchPath.pathString]
}

// FIXME: Remove this once it becomes possible to express this dependency in a package manifest.
//
// On Linux/Android swift-corelibs-foundation depends on dispatch library which is
// currently shipped with the Swift toolchain.
if (triple.isLinux() || triple.isAndroid()) && self.package.id == .plain("swift-corelibs-foundation") {
let swiftCompilerPath = self.buildParameters.toolchain.swiftCompilerPath
let toolchainResourcesPath = swiftCompilerPath.parentDirectory
.parentDirectory
.appending(components: ["lib", "swift"])
args += ["-I", toolchainResourcesPath.pathString]
}

return args
}

Expand Down

0 comments on commit 0871a04

Please sign in to comment.