Skip to content

Commit acc6390

Browse files
committed
fix: Use official LLVM binaries with CMake support
- Replace Chocolatey LLVM with official GitHub releases binary - Official LLVM distribution includes LLVMConfig.cmake - Download LLVM 17.0.6 directly from llvm-project releases - Automatically search for and set LLVM_DIR after installation - Simplify debug step to just verify the configuration This should resolve the missing LLVMConfig.cmake issue.
1 parent 83b305f commit acc6390

1 file changed

Lines changed: 29 additions & 34 deletions

File tree

.github/workflows/build.yml

Lines changed: 29 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -53,27 +53,37 @@ jobs:
5353
if: matrix.os == 'windows-latest'
5454
shell: pwsh
5555
run: |
56-
choco install llvm --version 17.0.6 -y --force
56+
$llvmVersion = "17.0.6"
57+
$llvmUrl = "https://github.com/llvm/llvm-project/releases/download/llvmorg-${llvmVersion}/LLVM-${llvmVersion}-win64.exe"
58+
$installerPath = "$env:TEMP\LLVM-installer.exe"
59+
60+
Write-Host "Downloading LLVM ${llvmVersion} from GitHub releases..."
61+
Invoke-WebRequest -Uri $llvmUrl -OutFile $installerPath
62+
63+
Write-Host "Installing LLVM..."
64+
Start-Process -FilePath $installerPath -ArgumentList "/S" -Wait
65+
5766
$llvmRoot = "C:\Program Files\LLVM"
5867
if (-not (Test-Path $llvmRoot)) { $llvmRoot = "C:\Program Files (x86)\LLVM" }
5968
60-
$llvmDir = ""
61-
$candidates = @("$llvmRoot\lib\cmake\llvm", "$llvmRoot\share\llvm\cmake", "$llvmRoot\lib\llvm\cmake", "$llvmRoot\cmake")
62-
foreach ($c in $candidates) {
63-
if (Test-Path "$c\LLVMConfig.cmake") { $llvmDir = $c; break }
64-
}
65-
66-
if (-not $llvmDir -and (Test-Path "C:\Program Files\LLVM\lib\cmake\llvm")) {
67-
$llvmDir = "C:\Program Files\LLVM\lib\cmake\llvm"
68-
}
69+
Write-Host "Searching for LLVMConfig.cmake..."
70+
$found = Get-ChildItem -Path $llvmRoot -Filter "LLVMConfig.cmake" -Recurse -ErrorAction SilentlyContinue | Select-Object -First 1
6971
70-
if ($llvmDir) {
71-
$llvmDir = $llvmDir -replace "\\", "/"
72-
$llvmRoot = $llvmRoot -replace "\\", "/"
72+
if ($found) {
73+
$llvmDir = Split-Path -Parent $found.FullName
74+
$llvmDir = $llvmDir -replace "\\\\", "/"
75+
$llvmRoot = $llvmRoot -replace "\\\\", "/"
76+
7377
Add-Content $env:GITHUB_PATH "$llvmRoot/bin"
7478
Add-Content $env:GITHUB_ENV "LLVM_DIR=$llvmDir"
7579
Add-Content $env:GITHUB_ENV "LLVM_ROOT=$llvmRoot"
80+
81+
Write-Host "✓ LLVM installed at: $llvmRoot"
82+
Write-Host "✓ LLVM_DIR set to: $llvmDir"
7683
} else {
84+
Write-Host "✗ Could not find LLVMConfig.cmake after installation"
85+
Write-Host "Listing LLVM directory structure..."
86+
Get-ChildItem -Path $llvmRoot -Recurse -Directory | Select-Object -First 20 | ForEach-Object { Write-Host $_.FullName }
7787
exit 1
7888
}
7989
@@ -85,30 +95,15 @@ jobs:
8595
if: matrix.os == 'windows-latest'
8696
shell: pwsh
8797
run: |
88-
Write-Host "Initial LLVM_DIR: $env:LLVM_DIR"
98+
Write-Host "LLVM_DIR: $env:LLVM_DIR"
8999
Write-Host "LLVM_ROOT: $env:LLVM_ROOT"
90100
91-
# Check if LLVMConfig.cmake exists at the set LLVM_DIR
92-
if ($env:LLVM_DIR -and (Test-Path "$env:LLVM_DIR/LLVMConfig.cmake")) {
93-
Write-Host "✓ Found LLVMConfig.cmake at $env:LLVM_DIR/LLVMConfig.cmake"
101+
# Verify LLVMConfig.cmake exists
102+
if (Test-Path "$env:LLVM_DIR/LLVMConfig.cmake") {
103+
Write-Host "✓ Confirmed: LLVMConfig.cmake exists at $env:LLVM_DIR/LLVMConfig.cmake"
94104
} else {
95-
Write-Host "✗ LLVMConfig.cmake not found at $env:LLVM_DIR"
96-
Write-Host "Searching for LLVMConfig.cmake..."
97-
98-
# Search for LLVMConfig.cmake in LLVM installation
99-
$found = Get-ChildItem -Path "$env:LLVM_ROOT" -Filter "LLVMConfig.cmake" -Recurse -ErrorAction SilentlyContinue | Select-Object -First 1
100-
101-
if ($found) {
102-
$correctLLVMDir = Split-Path -Parent $found.FullName
103-
$correctLLVMDir = $correctLLVMDir -replace "\\\\", "/"
104-
Write-Host "✓ Found LLVMConfig.cmake at: $($found.FullName)"
105-
Write-Host "Updating LLVM_DIR to: $correctLLVMDir"
106-
Add-Content $env:GITHUB_ENV "LLVM_DIR=$correctLLVMDir"
107-
$env:LLVM_DIR = $correctLLVMDir
108-
} else {
109-
Write-Host "✗ Could not find LLVMConfig.cmake in $env:LLVM_ROOT"
110-
exit 1
111-
}
105+
Write-Host "✗ ERROR: LLVMConfig.cmake not found at $env:LLVM_DIR"
106+
exit 1
112107
}
113108
114109
- name: Configure (Unix)

0 commit comments

Comments
 (0)