param([string]$MasmRoot = 'F:\MASM32\masm32') $ErrorActionPreference = 'Stop' $root = (Resolve-Path (Join-Path $PSScriptRoot '..\..')).Path Push-Location $root try { & "$MasmRoot\bin\ml.exe" /c /coff /Cp /nologo /Fobuild\actions\billiards-benchmark.obj tools\tests\billiards_benchmark.asm if ($LASTEXITCODE -ne 0) { throw 'Billiards benchmark assembly failed' } $sdkRoot = Join-Path ${env:ProgramFiles(x86)} 'Windows Kits\10\Lib' $sdk = Get-ChildItem -LiteralPath $sdkRoot -Directory | Sort-Object Name -Descending | Where-Object { Test-Path -LiteralPath (Join-Path $_.FullName 'um\x86\kernel32.lib') } | Select-Object -First 1 $libraries = @() $libraries += '/LIBPATH:' + (Join-Path $sdk.FullName 'um\x86') $libraries += "/LIBPATH:$MasmRoot\lib" & "$MasmRoot\bin\link.exe" /nologo /SUBSYSTEM:CONSOLE /ENTRY:RunBilliardsBenchmark@0 @libraries /OUT:build\actions\billiards-benchmark.exe build\actions\billiards-benchmark.obj build\graphics\poker.obj kernel32.lib winmm.lib user32.lib ws2_32.lib gdi32.lib if ($LASTEXITCODE -ne 0) { throw 'Billiards benchmark link failed' } & .\build\actions\billiards-benchmark.exe if ($LASTEXITCODE -ne 0) { throw "Billiards benchmark failed: $LASTEXITCODE" } } finally { Pop-Location }