From 886dadfedb04cd150884f160eb1f362c4425d501 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mika=C3=ABl=20Capelle?= Date: Wed, 6 Sep 2023 18:50:00 +0200 Subject: [PATCH] Use cmake to generate solution and msbuild to build. Add a verbosity flag. --- bootstrap.ps1 | 42 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 36 insertions(+), 6 deletions(-) diff --git a/bootstrap.ps1 b/bootstrap.ps1 index 69ce93a..10df715 100644 --- a/bootstrap.ps1 +++ b/bootstrap.ps1 @@ -1,14 +1,44 @@ +param([switch]$Verbose) + $root = $PSScriptRoot if (!$root) { $root = "." } -cmake -B $root/build $root | Out-Null -cmake --build $root/build --config Release -- ` - "-p:UseMultiToolTask=true" ` - "-noLogo" ` - "-p:EnforceProcessCountAcrossBuilds=true" ` - "-clp:ErrorsOnly;Verbosity=minimal" +$output = if ($Verbose) { "Out-Default" } else { "Out-Null" } + +cmake -B $root/build $root | & $output + +$installationPath = & $root\third-party\bin\vswhere.exe -products * -nologo -prerelease -latest -property installationPath +if (! $?) { + Write-Error "vswhere returned $LastExitCode" + exit $LastExitCode +} + +if (! $installationPath) { + Write-Error "Empty installation path" + exit 1 +} + +$opts = "" +$opts += " $root\build\mob.sln" +$opts += " -m" +$opts += " -p:Configuration=Release" +$opts += " -noLogo" +$opts += " -p:UseMultiToolTask=true" +$opts += " -p:EnforceProcessCountAcrossBuilds=true" + +if (!$Verbose) { + $opts += " -clp:ErrorsOnly;Verbosity=minimal" +} + +$vsDevCmd = "$installationPath\Common7\Tools\VsDevCmd.bat" +if (!(Test-Path "$vsDevCmd")) { + Write-Error "VdDevCmd.bat not found at $vsDevCmd" + exit 1 +} + +& "${env:COMSPEC}" /c "`"$vsDevCmd`" -no_logo -arch=amd64 -host_arch=amd64 && msbuild $opts" if (! $?) { Write-Error "Build failed"