diff --git a/.build/build.ps1 b/.build/build.ps1 index 5f884fb..a1bf513 100644 --- a/.build/build.ps1 +++ b/.build/build.ps1 @@ -25,22 +25,24 @@ $PSDefaultParameterValues['*:ErrorAction'] = 'Stop' $repoRoot = (Resolve-Path "$PSScriptRoot\..").Path Push-Location $repoRoot -$null = New-Item -Path build -ItemType Directory -Force -cd build - -$env:VERBOSE = '1' - -cmake -DCMAKE_PREFIX_PATH="$GTestPath" -DSTRING_ENCODING_TYPE="$EncodingType" .. -if ($LastExitCode -ne 0) { - throw "'cmake' exited with code $LastExitCode" -} - -cmake --build . --config Debug -if ($LastExitCode -ne 0) { - throw "'cmake --build' exited with code $LastExitCode" +try { + $null = New-Item -Path build -ItemType Directory -Force + cd build + + $env:VERBOSE = '1' + + cmake -DCMAKE_PREFIX_PATH="$GTestPath" -DSTRING_ENCODING_TYPE="$EncodingType" .. + if ($LastExitCode -ne 0) { + throw "'cmake' exited with code $LastExitCode" + } + + cmake --build . --config Debug + if ($LastExitCode -ne 0) { + throw "'cmake --build' exited with code $LastExitCode" + } + + cp $GTestPath\debug\bin\*.dll tests\Debug + cp Debug\kaitai_struct_cpp_stl_runtime.dll tests\Debug +} finally { + Pop-Location } - -cp $GTestPath\debug\bin\*.dll tests\Debug -cp Debug\kaitai_struct_cpp_stl_runtime.dll tests\Debug - -Pop-Location