Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Sources/Workspace/Destination.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public struct Destination: Encodable {
public let target: Triple

/// The SDK used to compile for the destination.
public let sdk: AbsolutePath
public let sdk: AbsolutePath?

/// The binDir in the containing the compilers/linker to be used for the compilation.
public let binDir: AbsolutePath
Expand Down Expand Up @@ -112,7 +112,7 @@ public struct Destination: Encodable {
#else
return Destination(
target: hostTargetTriple,
sdk: .root,
sdk: nil,
binDir: binDir,
extraCCFlags: ["-fPIC"],
extraSwiftCFlags: [],
Expand Down
15 changes: 10 additions & 5 deletions Sources/Workspace/UserToolchain.swift
Original file line number Diff line number Diff line change
Expand Up @@ -221,14 +221,19 @@ public final class UserToolchain: Toolchain {
self.xctest = nil
#endif

self.extraSwiftCFlags = (destination.target.isDarwin()
? ["-sdk", destination.sdk.pathString]
if let sdk = destination.sdk {
self.extraSwiftCFlags = (destination.target.isDarwin()
? ["-sdk", sdk.pathString]
: [])
+ destination.extraSwiftCFlags

self.extraCCFlags = [
destination.target.isDarwin() ? "-isysroot" : "--sysroot", destination.sdk.pathString
] + destination.extraCCFlags
self.extraCCFlags = [
destination.target.isDarwin() ? "-isysroot" : "--sysroot", sdk.pathString
] + destination.extraCCFlags
} else {
self.extraSwiftCFlags = destination.extraSwiftCFlags
self.extraCCFlags = destination.extraCCFlags
}

// Compute the path of directory containing the PackageDescription libraries.
var pdLibDir = UserManifestResources.libDir(forBinDir: binDir)
Expand Down