<# Builds and runs f1_hardware_repro.cpp against one GVFG SDK build, on a PC with a GVFG card and a live signal on channel 0. No viewer may hold the card while it runs. powershell -NoProfile -ExecutionPolicy Bypass -File .agents\skills\verify-gvfg-frame-hold\scripts\f1-hardware-repro.ps1 -GvfgBuildDir GVFG_SDK\build\ The build dir must contain bin\gvfg.dll and lib\gvfg.lib. Exit codes are the program's: 0 fixed, 1 F1 reproduced, 2 not verifiable here, 3 unexpected. #> param([Parameter(Mandatory)][string]$GvfgBuildDir) $ErrorActionPreference = 'Stop' $repo = (Resolve-Path (Join-Path $PSScriptRoot '..\..\..\..')).Path $sdk = Join-Path $repo 'GVFG_SDK\sdk\gvfg' $build = (Resolve-Path $GvfgBuildDir).Path foreach ($f in 'bin\gvfg.dll', 'lib\gvfg.lib') { if (-not (Test-Path (Join-Path $build $f))) { Write-Host "Missing $f in $build"; exit 3 } } if (Get-Process qt6_viewer, GVFG_CardTest -ErrorAction SilentlyContinue) { Write-Host 'A viewer or card test holds the card; close it first.'; exit 2 } $vswhere = Join-Path ${env:ProgramFiles(x86)} 'Microsoft Visual Studio\Installer\vswhere.exe' $vs = & $vswhere -products * -latest -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath $env:PATH = (Split-Path $vswhere) + ';' + $env:PATH cmd /c "`"$(Join-Path $vs 'VC\Auxiliary\Build\vcvars64.bat')`" >nul 2>&1 && set" | ForEach-Object { if ($_ -match '^([^=]+)=(.*)$') { [Environment]::SetEnvironmentVariable($matches[1], $matches[2]) } } $out = Join-Path $env:TEMP ("gvfg-f1-repro-" + (Split-Path $build -Leaf)) New-Item -ItemType Directory -Force $out | Out-Null $exe = Join-Path $out 'f1_hardware_repro.exe' & cl.exe /nologo /std:c++17 /EHsc /O2 /utf-8 "/I$sdk\include" "/I$sdk\src" (Join-Path $PSScriptRoot 'f1_hardware_repro.cpp') ` "/Fe:$exe" "/Fo:$out\\" /link "/LIBPATH:$build\lib" gvfg.lib | Out-Null if ($LASTEXITCODE -ne 0) { Write-Host 'Compile failed'; exit 3 } $env:PATH = (Join-Path $build 'bin') + ';' + $env:PATH Write-Host "SDK build: $build" & $exe exit $LASTEXITCODE