From 167b131a66b3f4d5c0564259b78efcda630875ff Mon Sep 17 00:00:00 2001 From: David Neto Date: Fri, 10 Jan 2025 17:29:58 -0500 Subject: [PATCH] kokoro: Add vs2022 configs (#139) Pass target CPU architecture explicitly vis BUILD_TARGET_ARCH Use cmake --build to build, instead of hardcoding the path to msbuild --- .../msvc-14.14-x64/cmake/presubmit.cfg | 2 +- .../msvc-14.14-x86/cmake/presubmit.cfg | 2 +- kokoro/windows/presubmit.bat | 7 +++---- .../windows/vs2022-amd64/cmake/presubmit.cfg | 19 +++++++++++++++++++ kokoro/windows/vs2022-x86/cmake/presubmit.cfg | 19 +++++++++++++++++++ 5 files changed, 43 insertions(+), 6 deletions(-) create mode 100644 kokoro/windows/vs2022-amd64/cmake/presubmit.cfg create mode 100644 kokoro/windows/vs2022-x86/cmake/presubmit.cfg diff --git a/kokoro/windows/msvc-14.14-x64/cmake/presubmit.cfg b/kokoro/windows/msvc-14.14-x64/cmake/presubmit.cfg index 70acce5..f43317d 100644 --- a/kokoro/windows/msvc-14.14-x64/cmake/presubmit.cfg +++ b/kokoro/windows/msvc-14.14-x64/cmake/presubmit.cfg @@ -10,7 +10,7 @@ env_vars { env_vars { key: "BUILD_GENERATOR" - value: "Visual Studio 15 2017 Win64" + value: "Visual Studio 15 2017" } env_vars { diff --git a/kokoro/windows/msvc-14.14-x86/cmake/presubmit.cfg b/kokoro/windows/msvc-14.14-x86/cmake/presubmit.cfg index 5c6902c..dd492e7 100644 --- a/kokoro/windows/msvc-14.14-x86/cmake/presubmit.cfg +++ b/kokoro/windows/msvc-14.14-x86/cmake/presubmit.cfg @@ -15,5 +15,5 @@ env_vars { env_vars { key: "BUILD_TARGET_ARCH" - value: "x86" + value: "Win32" } diff --git a/kokoro/windows/presubmit.bat b/kokoro/windows/presubmit.bat index ad3be81..6e6f9bf 100644 --- a/kokoro/windows/presubmit.bat +++ b/kokoro/windows/presubmit.bat @@ -26,7 +26,6 @@ if !ERRORLEVEL! neq 0 exit !ERRORLEVEL! git submodule update --init if !ERRORLEVEL! neq 0 exit !ERRORLEVEL! -SET MSBUILD="C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild" SET CONFIG=Release mkdir %SRC%\build @@ -34,11 +33,11 @@ cd %SRC%\build if !ERRORLEVEL! neq 0 exit !ERRORLEVEL! IF /I "%BUILD_SYSTEM%"=="cmake" ( - cmake .. -G "%BUILD_GENERATOR%" "-DCPPDAP_BUILD_TESTS=1" "-DCPPDAP_BUILD_EXAMPLES=1" "-DCPPDAP_WARNINGS_AS_ERRORS=1" + cmake .. -G "%BUILD_GENERATOR%" -A %BUILD_TARGET_ARCH% "-DCPPDAP_BUILD_TESTS=1" "-DCPPDAP_BUILD_EXAMPLES=1" "-DCPPDAP_WARNINGS_AS_ERRORS=1" if !ERRORLEVEL! neq 0 exit !ERRORLEVEL! - %MSBUILD% /p:Configuration=%CONFIG% cppdap.sln + cmake --build . --config %CONFIG% if !ERRORLEVEL! neq 0 exit !ERRORLEVEL! - Release\cppdap-unittests.exe + %CONFIG%\cppdap-unittests.exe if !ERRORLEVEL! neq 0 exit !ERRORLEVEL! ) ELSE ( echo "Unknown build system: %BUILD_SYSTEM%" diff --git a/kokoro/windows/vs2022-amd64/cmake/presubmit.cfg b/kokoro/windows/vs2022-amd64/cmake/presubmit.cfg new file mode 100644 index 0000000..5800334 --- /dev/null +++ b/kokoro/windows/vs2022-amd64/cmake/presubmit.cfg @@ -0,0 +1,19 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Location of the continuous bash script in Git. +build_file: "cppdap/kokoro/windows/presubmit.bat" + +env_vars { + key: "BUILD_SYSTEM" + value: "cmake" +} + +env_vars { + key: "BUILD_GENERATOR" + value: "Visual Studio 17 2022" +} + +env_vars { + key: "BUILD_TARGET_ARCH" + value: "x64" +} diff --git a/kokoro/windows/vs2022-x86/cmake/presubmit.cfg b/kokoro/windows/vs2022-x86/cmake/presubmit.cfg new file mode 100644 index 0000000..bf3d29f --- /dev/null +++ b/kokoro/windows/vs2022-x86/cmake/presubmit.cfg @@ -0,0 +1,19 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Location of the continuous bash script in Git. +build_file: "cppdap/kokoro/windows/presubmit.bat" + +env_vars { + key: "BUILD_SYSTEM" + value: "cmake" +} + +env_vars { + key: "BUILD_GENERATOR" + value: "Visual Studio 17 2022" +} + +env_vars { + key: "BUILD_TARGET_ARCH" + value: "Win32" +}