Merge pull request #352 from compnerd/gnu-dependency

SKSwiftPMWorkspace: make `testBasicCXXArgs` pass on Windows
This commit is contained in:
Ben Langmuir
2020-11-30 13:17:37 -08:00
committed by GitHub
2 changed files with 22 additions and 7 deletions

View File

@@ -378,7 +378,11 @@ extension SwiftPMWorkspace {
var args = td.basicArguments()
let compilePath = td.compilePaths().first(where: { $0.source == path })
let nativePath: AbsolutePath =
URL(fileURLWithPath: path.pathString).withUnsafeFileSystemRepresentation {
AbsolutePath(String(cString: $0!))
}
let compilePath = td.compilePaths().first(where: { $0.source == nativePath })
if let compilePath = compilePath {
args += [
"-MD",

View File

@@ -365,16 +365,27 @@ final class SwiftPMWorkspaceTests: XCTestCase {
let args = ws.settings(for: acxx.asURI, .cpp)!.compilerArguments
checkArgsCommon(args)
check("-MD", "-MT", "dependencies",
"-MF", build.appending(components: "lib.build", "a.cpp.d").pathString,
arguments: args)
check("-c", acxx.pathString, arguments: args)
check("-o", build.appending(components: "lib.build", "a.cpp.o").pathString, arguments: args)
URL(fileURLWithPath: build.appending(components: "lib.build", "a.cpp.d").pathString)
.withUnsafeFileSystemRepresentation {
check("-MD", "-MT", "dependencies", "-MF", String(cString: $0!), arguments: args)
}
URL(fileURLWithPath: acxx.pathString).withUnsafeFileSystemRepresentation {
check("-c", String(cString: $0!), arguments: args)
}
URL(fileURLWithPath: build.appending(components: "lib.build", "a.cpp.o").pathString)
.withUnsafeFileSystemRepresentation {
check("-o", String(cString: $0!), arguments: args)
}
let header = packageRoot.appending(components: "Sources", "lib", "include", "a.h")
let headerArgs = ws.settings(for: header.asURI, .cpp)!.compilerArguments
checkArgsCommon(headerArgs)
check("-c", "-x", "c++-header", header.pathString, arguments: headerArgs)
check("-c", "-x", "c++-header", URL(fileURLWithPath: header.pathString).path,
arguments: headerArgs)
}
}