17 lines
719 B
PowerShell
17 lines
719 B
PowerShell
$env:VCPATH = "D:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
|
|
$vcvarsOutput = & cmd /c "`"$env:VCPATH`" >nul 2>&1 && set" 2>$null
|
|
foreach ($line in $vcvarsOutput) {
|
|
if ($line -match '^([^=]+)=(.*)$') {
|
|
Set-Item -Path "env:$($matches[1])" -Value $matches[2]
|
|
}
|
|
}
|
|
|
|
Set-Location "g:\project\dllTest\TS660_DLL"
|
|
|
|
# 编译单元测试
|
|
$clOutput = & cl /nologo /EHsc /W3 /std:c++17 /utf-8 /DTS660_DLL_EXPORTS /I. TS660_UnitTest.cpp TS660DDG.cpp SerialPort.cpp /link /OUT:TS660_UnitTest.exe user32.lib 2>&1
|
|
Write-Host $clOutput[-5..-1]
|
|
|
|
Remove-Item TS660_UnitTest.obj, TS660DDG.obj, SerialPort.obj -ErrorAction SilentlyContinue
|
|
Write-Host "=== Build complete ==="
|