Fix cmake not found on Windows after winget install
Two issues fixed: 1. After winget installs cmake, Refresh-Environment may not pick up the new PATH entry (MSI PATH changes sometimes need a new shell). Added a fallback that probes cmake's default install locations (Program Files, LocalAppData) and adds the directory to PATH explicitly if found. 2. If cmake is still unavailable when the llama.cpp build starts (e.g. winget failed silently or PATH was not updated), the build now skips gracefully with a [SKIP] warning instead of crashing with "cmake : The term 'cmake' is not recognized".
This commit is contained in:
parent
c53f5298ca
commit
be61a3435c
1 changed files with 26 additions and 0 deletions
|
|
@ -340,6 +340,25 @@ if (-not $HasCmake) {
|
|||
$HasCmake = $null -ne (Get-Command cmake -ErrorAction SilentlyContinue)
|
||||
} catch { }
|
||||
}
|
||||
# winget may succeed but cmake isn't on PATH yet (MSI PATH changes need a
|
||||
# new shell). Try the default install location as a fallback.
|
||||
if (-not $HasCmake) {
|
||||
$cmakeDefaults = @(
|
||||
"$env:ProgramFiles\CMake\bin",
|
||||
"${env:ProgramFiles(x86)}\CMake\bin",
|
||||
"$env:LOCALAPPDATA\CMake\bin"
|
||||
)
|
||||
foreach ($d in $cmakeDefaults) {
|
||||
if (Test-Path (Join-Path $d "cmake.exe")) {
|
||||
$env:Path = "$d;$env:Path"
|
||||
$HasCmake = $null -ne (Get-Command cmake -ErrorAction SilentlyContinue)
|
||||
if ($HasCmake) {
|
||||
Write-Host " Found cmake at $d (added to PATH)" -ForegroundColor Gray
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($HasCmake) {
|
||||
Write-Host "[OK] CMake installed" -ForegroundColor Green
|
||||
} else {
|
||||
|
|
@ -991,9 +1010,16 @@ $LlamaCppDir = Join-Path $UnslothHome "llama.cpp"
|
|||
$BuildDir = Join-Path $LlamaCppDir "build"
|
||||
$LlamaServerBin = Join-Path $BuildDir "bin\Release\llama-server.exe"
|
||||
|
||||
$HasCmakeForBuild = $null -ne (Get-Command cmake -ErrorAction SilentlyContinue)
|
||||
|
||||
if (Test-Path $LlamaServerBin) {
|
||||
Write-Host ""
|
||||
Write-Host "[OK] llama-server already exists at $LlamaServerBin" -ForegroundColor Green
|
||||
} elseif (-not $HasCmakeForBuild) {
|
||||
Write-Host ""
|
||||
Write-Host "[SKIP] llama-server build -- cmake not available" -ForegroundColor Yellow
|
||||
Write-Host " GGUF inference and export will not be available." -ForegroundColor Yellow
|
||||
Write-Host " Install CMake from https://cmake.org/download/ and re-run setup." -ForegroundColor Yellow
|
||||
} else {
|
||||
Write-Host ""
|
||||
if ($HasNvidiaSmi) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue