From 80993f249ad0dcc5281dc21eb1cddd35f7437ff3 Mon Sep 17 00:00:00 2001 From: David Tarditi Date: Sun, 26 Nov 2023 20:02:52 -0800 Subject: [PATCH] Set env vars for location of VC++ compiler. --- test_scripts/automation/Windows/run-cmake.bat | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test_scripts/automation/Windows/run-cmake.bat b/test_scripts/automation/Windows/run-cmake.bat index b766927..8850fa2 100644 --- a/test_scripts/automation/Windows/run-cmake.bat +++ b/test_scripts/automation/Windows/run-cmake.bat @@ -13,8 +13,20 @@ if "%BUILD_PACKAGE%"=="Yes" ( set OLD_DIR=%CD% cd %LLVM_OBJ_DIR% + +rem Set up the environment so CMake can find the Visual C++ compiler. +setlocal +for /f "usebackq tokens=*" %%i in (`vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do ( + set InstallDir=%%i +) + +if exist "%InstallDir%\VC\Auxiliary\Build" ( + "%InstallDir%\VC\Auxiliary\BuildC\vcvars32.bat +) + cmake -G Ninja %EXTRA_FLAGS% -DCMAKE_BUILD_TYPE=%BUILDCONFIGURATION% DLLVM_ENABLE_PROJECTS=clang -DLLVM_INSTALL_TOOLCHAIN_ONLY=ON %BUILD_SOURCESDIRECTORY%\checkedc-llvm-project\llvm if ERRORLEVEL 1 (goto cmdfailed) +endlocal :succeeded cd %OLD_DIR%