1:: Copyright 2023 The Abseil Authors 2:: 3:: Licensed under the Apache License, Version 2.0 (the "License"); 4:: you may not use this file except in compliance with the License. 5:: You may obtain a copy of the License at 6:: 7:: https://www.apache.org/licenses/LICENSE-2.0 8:: 9:: Unless required by applicable law or agreed to in writing, software 10:: distributed under the License is distributed on an "AS IS" BASIS, 11:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12:: See the License for the specific language governing permissions and 13:: limitations under the License. 14 15SETLOCAL ENABLEDELAYEDEXPANSION 16 17:: Use GoogleTest v1.14.0 18SET ABSL_GOOGLETEST_COMMIT=f8d7d77c06936315286eb55f8de22cd23c188571 19 20IF EXIST %KOKORO_GFILE_DIR%\distdir\%ABSL_GOOGLETEST_COMMIT%.zip ( 21 SET ABSL_GOOGLETEST_DOWNLOAD_URL=file://%KOKORO_GFILE_DIR%\distdir\%ABSL_GOOGLETEST_COMMIT%.zip 22) ELSE ( 23 SET ABSL_GOOGLETEST_DOWNLOAD_URL=https://github.com/google/googletest/archive/%ABSL_GOOGLETEST_COMMIT%.zip 24) 25 26:: Replace '\' with '/' in Windows paths for CMake. 27:: Note that this cannot go inside the IF block above, because BAT files are weird. 28SET ABSL_GOOGLETEST_DOWNLOAD_URL=%ABSL_GOOGLETEST_DOWNLOAD_URL:\=/% 29 30IF EXIST "C:\Program Files\CMake\bin\" ( 31 SET CMAKE_BIN="C:\Program Files\CMake\bin\cmake.exe" 32 SET CTEST_BIN="C:\Program Files\CMake\bin\ctest.exe" 33) ELSE ( 34 SET CMAKE_BIN="cmake.exe" 35 SET CTEST_BIN="ctest.exe" 36) 37 38SET CTEST_OUTPUT_ON_FAILURE=1 39SET CMAKE_BUILD_PARALLEL_LEVEL=16 40SET CTEST_PARALLEL_LEVEL=16 41 42:: Change directory to the root of the project. 43CD %~dp0\.. 44if %errorlevel% neq 0 EXIT /B 1 45 46SET TZDIR=%CD%\absl\time\internal\cctz\testdata\zoneinfo 47 48MKDIR "build" 49CD "build" 50 51SET CXXFLAGS="/WX" 52 53%CMAKE_BIN% ^ 54 -DABSL_BUILD_TEST_HELPERS=ON ^ 55 -DABSL_BUILD_TESTING=ON ^ 56 -DABSL_GOOGLETEST_DOWNLOAD_URL=%ABSL_GOOGLETEST_DOWNLOAD_URL% ^ 57 -DBUILD_SHARED_LIBS=%ABSL_CMAKE_BUILD_SHARED% ^ 58 -DCMAKE_CXX_STANDARD=%ABSL_CMAKE_CXX_STANDARD% ^ 59 -G "%ABSL_CMAKE_GENERATOR%" ^ 60 .. 61IF %errorlevel% neq 0 EXIT /B 1 62 63%CMAKE_BIN% --build . --target ALL_BUILD --config %ABSL_CMAKE_BUILD_TYPE% 64IF %errorlevel% neq 0 EXIT /B 1 65 66%CTEST_BIN% -C %ABSL_CMAKE_BUILD_TYPE% -E "absl_lifetime_test|absl_symbolize_test" 67IF %errorlevel% neq 0 EXIT /B 1 68 69EXIT /B 0 70