This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[ValidateSet("Debug", "Release")]
|
||||
[string]$Configuration = "Debug"
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
$root = Split-Path -Parent $PSScriptRoot
|
||||
$cmake = "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe"
|
||||
$ctest = "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\ctest.exe"
|
||||
if (-not (Test-Path -LiteralPath $cmake)) {
|
||||
$cmakeCommand = Get-Command cmake -ErrorAction Stop
|
||||
$cmake = $cmakeCommand.Source
|
||||
$ctestCommand = Get-Command ctest -ErrorAction Stop
|
||||
$ctest = $ctestCommand.Source
|
||||
}
|
||||
|
||||
$rootBytes = [System.Text.Encoding]::UTF8.GetBytes(
|
||||
[System.IO.Path]::GetFullPath($root).ToLowerInvariant())
|
||||
$sha256 = [System.Security.Cryptography.SHA256]::Create()
|
||||
try {
|
||||
$rootHashBytes = $sha256.ComputeHash($rootBytes)
|
||||
}
|
||||
finally {
|
||||
$sha256.Dispose()
|
||||
}
|
||||
$rootHash = (
|
||||
[System.BitConverter]::ToString($rootHashBytes) -replace "-", ""
|
||||
).Substring(0, 12).ToLowerInvariant()
|
||||
$buildName = "build/windows-{0}-{1}" -f $Configuration.ToLowerInvariant(), $rootHash
|
||||
$build = Join-Path $root $buildName
|
||||
|
||||
& $cmake -S $root -B $build -G "Visual Studio 17 2022" -A x64 `
|
||||
-DBUILD_TESTING=ON -DCHIMERA_GFX_REGISTER_EXTERNAL_EVIDENCE_VALIDATORS=OFF
|
||||
if ($LASTEXITCODE -ne 0) { throw "Host configure failed" }
|
||||
& $cmake --build $build --config $Configuration
|
||||
if ($LASTEXITCODE -ne 0) { throw "Host build failed" }
|
||||
& $ctest --test-dir $build -C $Configuration --output-on-failure
|
||||
if ($LASTEXITCODE -ne 0) { throw "Host tests failed" }
|
||||
Reference in New Issue
Block a user