Skip to content

Commit 4e4ebd9

Browse files
committed
fix: Add LLVM detection debugging and fallback paths
- Add debugging step to verify LLVM_DIR before configuration - Add Windows-specific fallback search paths for LLVMConfig.cmake - Improve LLVM_DIR variable handling in CMake invocation - Search common LLVM installation paths on Windows This should help diagnose and fix the LLVM package detection issue.
1 parent 02aff16 commit 4e4ebd9

2 files changed

Lines changed: 39 additions & 1 deletion

File tree

.github/workflows/build.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,21 @@ jobs:
8181
if: matrix.os == 'windows-latest'
8282
run: choco install ninja -y
8383

84+
- name: Debug LLVM Configuration (Windows)
85+
if: matrix.os == 'windows-latest'
86+
shell: pwsh
87+
run: |
88+
Write-Host "LLVM_DIR: $env:LLVM_DIR"
89+
Write-Host "LLVM_ROOT: $env:LLVM_ROOT"
90+
Write-Host "Checking if LLVMConfig.cmake exists..."
91+
if (Test-Path "$env:LLVM_DIR/LLVMConfig.cmake") {
92+
Write-Host "✓ Found LLVMConfig.cmake at $env:LLVM_DIR/LLVMConfig.cmake"
93+
} else {
94+
Write-Host "✗ LLVMConfig.cmake not found at $env:LLVM_DIR"
95+
Write-Host "Searching for LLVMConfig.cmake..."
96+
Get-ChildItem -Path "$env:LLVM_ROOT" -Filter "LLVMConfig.cmake" -Recurse -ErrorAction SilentlyContinue | Select-Object -First 5 | ForEach-Object { Write-Host $_.FullName }
97+
}
98+
8499
- name: Configure (Unix)
85100
if: matrix.os != 'windows-latest'
86101
shell: bash
@@ -94,14 +109,17 @@ jobs:
94109
if: matrix.os == 'windows-latest'
95110
shell: pwsh
96111
run: |
112+
$llvmDir = $env:LLVM_DIR
113+
Write-Host "Using LLVM_DIR: $llvmDir"
114+
97115
cmake -S . -B build `
98116
-G "Ninja" `
99117
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} `
100118
-DBUILD_TESTS=OFF `
101119
-DBUILD_BENCH=OFF `
102120
-DCMAKE_C_COMPILER="$env:LLVM_ROOT/bin/clang.exe" `
103121
-DCMAKE_CXX_COMPILER="$env:LLVM_ROOT/bin/clang++.exe" `
104-
-DLLVM_DIR="$env:LLVM_DIR" `
122+
-DLLVM_DIR="$llvmDir" `
105123
-DCMAKE_PREFIX_PATH="$env:LLVM_ROOT"
106124
107125
- name: Build

CMakeLists.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,26 @@ endif()
1717
# --- LLVM Configuration ---
1818
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules")
1919

20+
# Add explicit hints for LLVM on Windows
21+
if(WIN32 AND NOT LLVM_DIR)
22+
message(STATUS "Searching for LLVM on Windows...")
23+
# Common LLVM installation paths on Windows
24+
set(LLVM_SEARCH_PATHS
25+
"C:/Program Files/LLVM/lib/cmake/llvm"
26+
"C:/Program Files/LLVM/share/llvm/cmake"
27+
"C:/Program Files (x86)/LLVM/lib/cmake/llvm"
28+
"C:/Program Files (x86)/LLVM/share/llvm/cmake"
29+
)
30+
31+
foreach(search_path ${LLVM_SEARCH_PATHS})
32+
if(EXISTS "${search_path}/LLVMConfig.cmake")
33+
set(LLVM_DIR "${search_path}" CACHE PATH "LLVM CMake directory")
34+
message(STATUS "Found LLVM CMake files at: ${search_path}")
35+
break()
36+
endif()
37+
endforeach()
38+
endif()
39+
2040
# --- LLVM Configuration ---
2141
find_package(LLVM CONFIG REQUIRED)
2242

0 commit comments

Comments
 (0)