17 lines
1.1 KiB
PowerShell
17 lines
1.1 KiB
PowerShell
param([string]$Configuration='Release',[switch]$SkipTests)
|
|
$ErrorActionPreference='Stop'
|
|
$projectRoot=Split-Path (Split-Path $PSScriptRoot -Parent) -Parent
|
|
$cmakeCommand=Get-Command cmake -ErrorAction SilentlyContinue
|
|
if($cmakeCommand){$cmakeExecutable=$cmakeCommand.Source}else{$cmakeExecutable='C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe'}
|
|
if(-not(Test-Path -LiteralPath $cmakeExecutable)){throw 'CMake not available'}
|
|
$buildDirectory=Join-Path $projectRoot 'Builds\gameFramework\vs2022-x64'
|
|
& $cmakeExecutable -S (Join-Path $projectRoot 'gameFramework') -B $buildDirectory -G 'Visual Studio 17 2022' -A x64
|
|
if($LASTEXITCODE -ne 0){throw 'Core configuration failed'}
|
|
& $cmakeExecutable --build $buildDirectory --config $Configuration --parallel 2
|
|
if($LASTEXITCODE -ne 0){throw 'Core compilation failed'}
|
|
if(-not $SkipTests){
|
|
$ctestExecutable=Join-Path (Split-Path $cmakeExecutable) 'ctest.exe'
|
|
& $ctestExecutable --test-dir $buildDirectory -C $Configuration --output-on-failure
|
|
if($LASTEXITCODE -ne 0){throw 'Core behavior tests failed'}
|
|
}
|