#requires -Version 5.1 # One-time developer setup (Windows): # - verifies required tools # - installs vcpkg if VCPKG_ROOT is not set # - pins the vcpkg dependency baseline in vcpkg.json $ErrorActionPreference = 'Stop' $RepoRoot = Split-Path -Parent (Split-Path -Parent $MyInvocation.MyCommand.Path) Set-Location $RepoRoot Write-Host '>> Checking required tools' $missing = $false foreach ($tool in @('git', 'cmake', 'ninja')) { if (-not (Get-Command $tool -ErrorAction SilentlyContinue)) { Write-Host " MISSING: $tool" $missing = $true } } if ($missing) { Write-Error 'Install the missing tools and re-run.' } # MSVC is only on PATH inside a Developer prompt; detect the install instead. $vswhere = Join-Path ${env:ProgramFiles(x86)} 'Microsoft Visual Studio\Installer\vswhere.exe' if (Test-Path $vswhere) { $vc = & $vswhere -latest -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath if ($vc) { Write-Host " MSVC C++ toolchain: $vc" } else { Write-Host ' WARNING: Visual Studio found but the C++ workload (VC.Tools) is not installed.' } } else { Write-Host ' WARNING: Visual Studio not detected. Install VS 2022 with the' Write-Host ' "Desktop development with C++" workload (MSVC 19.36+ for C++23).' } Write-Host '>> Setting up vcpkg' if (-not $env:VCPKG_ROOT) { $vcpkgDir = Join-Path $RepoRoot 'vcpkg' if (-not (Test-Path $vcpkgDir)) { Write-Host ' Cloning vcpkg into .\vcpkg' git clone https://github.com/microsoft/vcpkg.git $vcpkgDir } & (Join-Path $vcpkgDir 'bootstrap-vcpkg.bat') -disableMetrics $env:VCPKG_ROOT = $vcpkgDir Write-Host ' VCPKG_ROOT is not set in your environment. Set it permanently with:' Write-Host " setx VCPKG_ROOT `"$vcpkgDir`"" } else { Write-Host " Using VCPKG_ROOT=$env:VCPKG_ROOT" } $vcpkgExe = Join-Path $env:VCPKG_ROOT 'vcpkg.exe' Write-Host '>> Pinning the vcpkg dependency baseline' if (Select-String -Path 'vcpkg.json' -Pattern '"builtin-baseline"' -Quiet) { Write-Host ' builtin-baseline already present — leaving it pinned.' } else { & $vcpkgExe x-update-baseline --add-initial-baseline Write-Host ' Added builtin-baseline to vcpkg.json. Commit this change.' } Write-Host '' Write-Host '>> Bootstrap complete. Next steps:' Write-Host ' cmake --preset windows-debug' Write-Host ' cmake --build --preset windows-debug' Write-Host ' ctest --preset windows-debug'