2023-09-24 10:08:57 +02:00
|
|
|
param(
|
|
|
|
|
[switch]
|
|
|
|
|
$Verbose,
|
|
|
|
|
[ValidateSet("Debug", "RelWithDebInfo", "Release")]
|
|
|
|
|
[string]
|
|
|
|
|
$Config = "Release"
|
|
|
|
|
)
|
2023-09-06 18:50:00 +02:00
|
|
|
|
2020-07-21 18:23:40 -04:00
|
|
|
$root = $PSScriptRoot
|
|
|
|
|
if (!$root) {
|
2023-08-30 15:52:35 +02:00
|
|
|
$root = "."
|
2020-07-21 18:23:40 -04:00
|
|
|
}
|
|
|
|
|
|
2023-09-06 18:50:00 +02:00
|
|
|
$output = if ($Verbose) { "Out-Default" } else { "Out-Null" }
|
|
|
|
|
|
2025-05-22 19:02:43 +02:00
|
|
|
cmake -B $root/build -G "Visual Studio 17 2022" $root | & $output
|
2023-09-06 18:50:00 +02:00
|
|
|
|
|
|
|
|
$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"
|
2023-09-24 10:08:57 +02:00
|
|
|
$opts += " -p:Configuration=${Config}"
|
2023-09-06 18:50:00 +02:00
|
|
|
$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"
|
2020-05-20 18:28:49 +01:00
|
|
|
|
|
|
|
|
if (! $?) {
|
|
|
|
|
Write-Error "Build failed"
|
|
|
|
|
exit $LastExitCode
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-24 10:08:57 +02:00
|
|
|
Copy-Item "$root\build\src\${Config}\mob.exe" "$root\mob.exe"
|
2023-08-30 15:52:35 +02:00
|
|
|
Write-Output "run ``.\mob -d prefix/path build`` to start building"
|