|
| 1 | +# Run this first if needed: |
| 2 | +# Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process |
| 3 | +param ( |
| 4 | + # height of largest column without top bar |
| 5 | + [Parameter(Mandatory=$true)] |
| 6 | + [string]$protocolVersion |
| 7 | +) |
| 8 | + |
| 9 | +$ErrorActionPreference = 'Stop' |
| 10 | +# check for vscmd |
| 11 | +if ([string]::IsNullOrEmpty($env:VSCMD_VER)) { |
| 12 | + Write-Host 'Must be run inside of VS Developer Powershell' |
| 13 | + exit 1 |
| 14 | +} |
| 15 | + |
| 16 | +# check for git |
| 17 | +try { |
| 18 | + $git_version = git --version |
| 19 | +} catch { |
| 20 | + Write-Host 'git not installed' |
| 21 | + exit 1 |
| 22 | +} |
| 23 | + |
| 24 | +# setup vcpkg |
| 25 | +if (Test-Path -Path 'vcpkg\') { |
| 26 | + Write-Host 'vcpkg already setup' |
| 27 | +} else { |
| 28 | + Write-Host 'Setting up vcpkg...' |
| 29 | + git clone "https://github.com/microsoft/vcpkg.git" |
| 30 | +} |
| 31 | + |
| 32 | +if (-not (Test-Path -Path 'vcpkg\vcpkg.exe')) { |
| 33 | + Write-Host 'Bootstrapping vcpkg...' |
| 34 | + Start-Process -Wait -NoNewWindow -FilePath 'vcpkg\bootstrap-vcpkg.bat' -ArgumentList '-disableMetrics' |
| 35 | +} |
| 36 | + |
| 37 | +$env:VCPKG_ROOT='' # ignore msvc's vcpkg root, it doesn't work |
| 38 | +$vcpkg = (Resolve-Path -Path '.\vcpkg') |
| 39 | +Write-Host "vcpkg installed to $vcpkg" |
| 40 | +Start-Process -Wait -NoNewWindow -FilePath 'vcpkg\vcpkg.exe' -ArgumentList 'install sqlite3:x64-windows' |
| 41 | + |
| 42 | +# setup cmake project |
| 43 | +if (Test-Path -Path 'build\') { |
| 44 | + Write-Host 'cmake project already setup'; |
| 45 | +} else { |
| 46 | + Write-Host 'Setting up cmake project...' |
| 47 | + Start-Process -Wait -NoNewWindow -FilePath 'cmake' -ArgumentList "-B build -DPROTOCOL_VERSION=$protocolVersion -DCMAKE_TOOLCHAIN_FILE=$vcpkg\scripts\buildsystems\vcpkg.cmake" |
| 48 | +} |
| 49 | + |
| 50 | +Write-Host 'Done!' |
| 51 | +$sln = (Resolve-Path -Path '.\build\OpenFusion.sln') |
| 52 | +Write-Host "Solution file is at $sln" |
0 commit comments