本地工具路径DTU_*环境变量改造落地:10处调用点去硬编码+变量优先解析,本机全链路验证通过,文档同步收口,requirements补pre-commit
This commit is contained in:
+12
-6
@@ -45,12 +45,18 @@ if (-not $cmake) {
|
||||
exit 3
|
||||
}
|
||||
|
||||
# vswhere 随 Visual Studio / BuildTools 自带
|
||||
$pf86 = ${env:ProgramFiles(x86)}
|
||||
if (-not $pf86) { $pf86 = 'C:\Program Files (x86)' }
|
||||
$vswhere = Join-Path $pf86 'Microsoft Visual Studio\Installer\vswhere.exe'
|
||||
if (-not (Test-Path $vswhere)) {
|
||||
Write-Host '[build_sim] 预检失败:未找到 vswhere(本机未安装 Visual Studio / BuildTools)' -ForegroundColor Red
|
||||
# vswhere:DTU_VSWHERE 显式覆盖 > %ProgramFiles(x86)% 推导(不保留固定 C 盘值)
|
||||
$vswhere = $env:DTU_VSWHERE
|
||||
if ($vswhere) {
|
||||
if (-not (Test-Path -LiteralPath $vswhere)) {
|
||||
Write-Host "[build_sim] 预检失败:DTU_VSWHERE 已设置但文件不存在:$vswhere" -ForegroundColor Red
|
||||
exit 3
|
||||
}
|
||||
} elseif (${env:ProgramFiles(x86)}) {
|
||||
$vswhere = Join-Path ${env:ProgramFiles(x86)} 'Microsoft Visual Studio\Installer\vswhere.exe'
|
||||
}
|
||||
if (-not $vswhere -or -not (Test-Path -LiteralPath $vswhere)) {
|
||||
Write-Host '[build_sim] 预检失败:未找到 vswhere(本机未安装 Visual Studio / BuildTools,或布局非标准;可用 DTU_VSWHERE 指向 vswhere.exe 完整路径)' -ForegroundColor Red
|
||||
exit 3
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user