18 lines
790 B
PowerShell
18 lines
790 B
PowerShell
$env:VCVARS = "D:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
|
|
# 加载 VS 环境
|
|
$vcvarsOutput = & cmd /c "`"$env:VCVARS`" >nul 2>&1 && set" 2>$null
|
|
foreach ($line in $vcvarsOutput) {
|
|
if ($line -match '^([^=]+)=(.*)$') {
|
|
Set-Item -Path "env:$($matches[1])" -Value $matches[2]
|
|
}
|
|
}
|
|
Write-Host "INCLUDE: $($env:INCLUDE.Substring(0, [Math]::Min(80, $env:INCLUDE.Length)))..."
|
|
|
|
Set-Location "g:\project\dllTest\TS660_DLL"
|
|
|
|
# 编译
|
|
cl /nologo /EHsc /W3 /std:c++17 /utf-8 /DTS660_DLL_EXPORTS /I. TS660_Debug.cpp SerialPort.cpp TS660DDG.cpp /link /OUT:TS660_Debug.exe user32.lib 2>&1 | Select-Object -Last 8
|
|
|
|
Remove-Item TS660_Debug.obj, SerialPort.obj, TS660DDG.obj -ErrorAction SilentlyContinue
|
|
Write-Host "=== Build complete ==="
|