From 404fcf9138aecfcd279674dfe7d0a8fe5daa6f0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=BChnel?= Date: Mon, 16 Dec 2019 10:09:47 +0000 Subject: [PATCH] fixed more windows weirdness --- scripts/common.ps1 | 2 +- scripts/run_cmake.ps1 | 5 ++++- scripts/run_ninja.ps1 | 7 ++++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/scripts/common.ps1 b/scripts/common.ps1 index b730ec1..d1c92ea 100644 --- a/scripts/common.ps1 +++ b/scripts/common.ps1 @@ -42,7 +42,7 @@ function Invoke-Call { [scriptblock]$ScriptBlock, [string]$ErrorAction = "Stop" ) - & @ScriptBlock | ForEach-Object { "$_" } + & @ScriptBlock *>&1 | ForEach-Object { "$_" } if (($lastexitcode -ne 0) -and $ErrorAction -eq "Stop") { Write-Error "Command $ScriptBlock exited with $lastexitcode." exit $lastexitcode diff --git a/scripts/run_cmake.ps1 b/scripts/run_cmake.ps1 index a02a462..b579faf 100644 --- a/scripts/run_cmake.ps1 +++ b/scripts/run_cmake.ps1 @@ -14,19 +14,22 @@ . ${PSScriptRoot}\common.ps1 +# Delete and re-create build folder Remove-Item build -Recurse -ErrorAction Ignore New-Item -ItemType Directory -Force -Path build | Out-Null Push-Location build +# load Vistual Studio environment variables Invoke-CmdScript "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\Tools\VsDevCmd.bat" -arch=amd64 -host_arch=amd64 +# call CMake Invoke-Call -ScriptBlock { cmake ..\llvm -G Ninja -DCMAKE_BUILD_TYPE=Release ` -D LLVM_ENABLE_PROJECTS="clang;clang-tools-extra" ` -D LLVM_ENABLE_ASSERTIONS=ON ` -DLLVM_LIT_ARGS="-v --xunit-xml-output test-results.xml" ` -D LLVM_ENABLE_DIA_SDK=OFF -} -ErrorAction Stop +} # LLVM_ENABLE_DIA_SDK=OFF is a workaround to make the tests pass. # see https://bugs.llvm.org/show_bug.cgi?id=44151 diff --git a/scripts/run_ninja.ps1 b/scripts/run_ninja.ps1 index 34bc0a8..9027351 100644 --- a/scripts/run_ninja.ps1 +++ b/scripts/run_ninja.ps1 @@ -18,8 +18,13 @@ param( . ${PSScriptRoot}\common.ps1 +# cd into build folder Push-Location build -Invoke-Call -ScriptBlock {ninja $target} -ErrorAction Stop +# load Visual Studio environment variables +Invoke-CmdScript "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\Tools\VsDevCmd.bat" -arch=amd64 -host_arch=amd64 + +# call ninja +Invoke-Call -ScriptBlock {ninja $target} Pop-Location