xref: /src/contrib/googletest/ci/windows-presubmit.bat (revision f25b8c9fb4f58cf61adb47d7570abe7caa6d385d)
1SETLOCAL ENABLEDELAYEDEXPANSION
2
3SET BAZEL_EXE=%KOKORO_GFILE_DIR%\bazel-8.0.0-windows-x86_64.exe
4
5SET PATH=C:\Python34;%PATH%
6SET BAZEL_PYTHON=C:\python34\python.exe
7SET BAZEL_SH=C:\tools\msys64\usr\bin\bash.exe
8SET CMAKE_BIN="cmake.exe"
9SET CTEST_BIN="ctest.exe"
10SET CTEST_OUTPUT_ON_FAILURE=1
11SET CMAKE_BUILD_PARALLEL_LEVEL=16
12SET CTEST_PARALLEL_LEVEL=16
13
14SET GTEST_ROOT=%~dp0\..
15IF %errorlevel% neq 0 EXIT /B 1
16
17:: ----------------------------------------------------------------------------
18:: CMake
19SET CMAKE_BUILD_PATH=cmake_msvc2022
20MKDIR %CMAKE_BUILD_PATH%
21CD %CMAKE_BUILD_PATH%
22
23%CMAKE_BIN% %GTEST_ROOT% ^
24  -G "Visual Studio 17 2022" ^
25  -DCMAKE_CXX_STANDARD=17 ^
26  -DPYTHON_EXECUTABLE:FILEPATH=c:\python37\python.exe ^
27  -DPYTHON_INCLUDE_DIR:PATH=c:\python37\include ^
28  -DPYTHON_LIBRARY:FILEPATH=c:\python37\lib\site-packages\pip ^
29  -Dgtest_build_samples=ON ^
30  -Dgtest_build_tests=ON ^
31  -Dgmock_build_tests=ON
32IF %errorlevel% neq 0 EXIT /B 1
33
34%CMAKE_BIN% --build . --target ALL_BUILD --config Debug -- -maxcpucount
35IF %errorlevel% neq 0 EXIT /B 1
36
37%CTEST_BIN% -C Debug --timeout 600
38IF %errorlevel% neq 0 EXIT /B 1
39
40CD %GTEST_ROOT%
41RMDIR /S /Q %CMAKE_BUILD_PATH%
42
43:: ----------------------------------------------------------------------------
44:: Bazel
45
46:: The default home directory on Kokoro is a long path which causes errors
47:: because of Windows limitations on path length.
48:: --output_user_root=C:\tmp causes Bazel to use a shorter path.
49SET BAZEL_VS=C:\Program Files\Microsoft Visual Studio\2022\Community
50
51:: C++17
52%BAZEL_EXE% ^
53  --output_user_root=C:\tmp ^
54  test ... ^
55  --compilation_mode=dbg ^
56  --copt=/std:c++17 ^
57  --copt=/WX ^
58  --enable_bzlmod=true ^
59  --keep_going ^
60  --test_output=errors ^
61  --test_tag_filters=-no_test_msvc2017
62IF %errorlevel% neq 0 EXIT /B 1
63
64:: C++20
65%BAZEL_EXE% ^
66  --output_user_root=C:\tmp ^
67  test ... ^
68  --compilation_mode=dbg ^
69  --copt=/std:c++20 ^
70  --copt=/WX ^
71  --enable_bzlmod=true ^
72  --keep_going ^
73  --test_output=errors ^
74  --test_tag_filters=-no_test_msvc2017
75IF %errorlevel% neq 0 EXIT /B 1
76