Skip to content

Commit e115b73

Browse files
committed
Fix windows libclang lookup
1 parent d764431 commit e115b73

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

Sources/SWBCore/SpecImplementations/Tools/CCompiler.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -967,10 +967,10 @@ public class ClangCompilerSpec : CompilerSpec, SpecIdentifierType, GCCCompatible
967967

968968
// If not defined, try to find one from the toolchain.
969969
var candidatesSkipped: [Path] = []
970-
for (toolchainPath, toolchainLibrarySearchPath) in cbc.producer.toolchains.map({ ($0.path, $0.librarySearchPaths) }) {
971-
if let path = toolchainLibrarySearchPath.findLibrary(operatingSystem: cbc.producer.hostOperatingSystem, basename: "clang") {
970+
for toolchain in cbc.producer.toolchains {
971+
if let path = try? toolchain.lookup(subject: .library(basename: "clang"), operatingSystem: cbc.producer.hostOperatingSystem) {
972972
// Check that this is the same toolchain and version as the compiler. Mismatched clang/libclang is not supported with explicit modules.
973-
let compilerAndLibraryAreInSameToolchain = toolchainPath.isAncestor(of: compiler)
973+
let compilerAndLibraryAreInSameToolchain = toolchain.path.isAncestor(of: compiler)
974974
let libclangVersion = cbc.producer.lookupLibclang(path: path).version
975975
// On macOS we enforce a matching clang and libclang version, the versioning schemes on other host platforms currently make this difficult.
976976
let compilerAndLibraryVersionsMatch = libclangVersion != nil && libclangVersion == clangInfo?.clangVersion || cbc.producer.hostOperatingSystem != .macOS

Sources/SWBWindowsPlatform/Specs/WindowsCompile.xcspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
Type = Compiler;
1818
BasedOn = "default:com.apple.compilers.llvm.clang.1_0";
1919
EnvironmentVariables = {
20-
"TEMP" = "$(OBJROOT)";
21-
"TMP" = "$(OBJROOT)";
20+
"TEMP" = "$(CACHE_ROOT:default=$(OBJROOT))";
21+
"TMP" = "$(CACHE_ROOT:default=$(OBJROOT))";
2222
};
2323
Name = "Apple LLVM Windows";
2424
Description = "Apple LLVM Windows compiler";

Tests/SWBBuildSystemTests/ClangExplicitModulesTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1422,8 +1422,8 @@ fileprivate struct ClangExplicitModulesTests: CoreBasedTests {
14221422
"PRODUCT_NAME": "$(TARGET_NAME)",
14231423
"CLANG_ENABLE_MODULES": "YES",
14241424
"_EXPERIMENTAL_CLANG_EXPLICIT_MODULES": "YES",
1425-
"HEADER_SEARCH_PATHS": "$(inherited) \(tmpDir.join("Test/aProject").str)",
1426-
"CLANG_EXPLICIT_MODULES_OUTPUT_PATH": "\(tmpDir.join("clangmodules").str)",
1425+
"HEADER_SEARCH_PATHS": "$(inherited) \(tmpDir.join("Test").join("aProject").strWithPosixSlashes)",
1426+
"CLANG_EXPLICIT_MODULES_OUTPUT_PATH": "\(tmpDir.join("clangmodules").strWithPosixSlashes)",
14271427
])],
14281428
targets: [
14291429
TestStandardTarget(

0 commit comments

Comments
 (0)