windows-presubmit.bat 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. SETLOCAL ENABLEDELAYEDEXPANSION
  2. SET BAZEL_EXE=%KOKORO_GFILE_DIR%\bazel-7.0.0-windows-x86_64.exe
  3. SET PATH=C:\Python34;%PATH%
  4. SET BAZEL_PYTHON=C:\python34\python.exe
  5. SET BAZEL_SH=C:\tools\msys64\usr\bin\bash.exe
  6. SET CMAKE_BIN="cmake.exe"
  7. SET CTEST_BIN="ctest.exe"
  8. SET CTEST_OUTPUT_ON_FAILURE=1
  9. SET CMAKE_BUILD_PARALLEL_LEVEL=16
  10. SET CTEST_PARALLEL_LEVEL=16
  11. IF EXIST git\googletest (
  12. CD git\googletest
  13. ) ELSE IF EXIST github\googletest (
  14. CD github\googletest
  15. )
  16. IF %errorlevel% neq 0 EXIT /B 1
  17. :: ----------------------------------------------------------------------------
  18. :: CMake
  19. MKDIR cmake_msvc2022
  20. CD cmake_msvc2022
  21. %CMAKE_BIN% .. ^
  22. -G "Visual Studio 17 2022" ^
  23. -DPYTHON_EXECUTABLE:FILEPATH=c:\python37\python.exe ^
  24. -DPYTHON_INCLUDE_DIR:PATH=c:\python37\include ^
  25. -DPYTHON_LIBRARY:FILEPATH=c:\python37\lib\site-packages\pip ^
  26. -Dgtest_build_samples=ON ^
  27. -Dgtest_build_tests=ON ^
  28. -Dgmock_build_tests=ON
  29. IF %errorlevel% neq 0 EXIT /B 1
  30. %CMAKE_BIN% --build . --target ALL_BUILD --config Debug -- -maxcpucount
  31. IF %errorlevel% neq 0 EXIT /B 1
  32. %CTEST_BIN% -C Debug --timeout 600
  33. IF %errorlevel% neq 0 EXIT /B 1
  34. CD ..
  35. RMDIR /S /Q cmake_msvc2022
  36. :: ----------------------------------------------------------------------------
  37. :: Bazel
  38. :: The default home directory on Kokoro is a long path which causes errors
  39. :: because of Windows limitations on path length.
  40. :: --output_user_root=C:\tmp causes Bazel to use a shorter path.
  41. SET BAZEL_VS=C:\Program Files\Microsoft Visual Studio\2022\Community
  42. %BAZEL_EXE% ^
  43. --output_user_root=C:\tmp ^
  44. test ... ^
  45. --compilation_mode=dbg ^
  46. --copt=/std:c++14 ^
  47. --copt=/WX ^
  48. --enable_bzlmod=true ^
  49. --keep_going ^
  50. --test_output=errors ^
  51. --test_tag_filters=-no_test_msvc2017
  52. IF %errorlevel% neq 0 EXIT /B 1