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:: The commit of GoogleTest to be used in the CMake tests in this directory. 18:: Keep this in sync with the commit in the WORKSPACE file. 19:: TODO(dmauro): After the next GoogleTest release, use the stable file required 20:: by Bzlmod. This means downloading a copy of the file and reuploading it to 21:: avoid changing checksums if the compression is changed by GitHub. It also 22:: means stop referring to it as a commit and instead use the uploaded filename. 23SET ABSL_GOOGLETEST_COMMIT=f8d7d77c06936315286eb55f8de22cd23c188571 24 25IF EXIST %KOKORO_GFILE_DIR%\distdir\%ABSL_GOOGLETEST_COMMIT%.zip ( 26 SET ABSL_GOOGLETEST_DOWNLOAD_URL=file://%KOKORO_GFILE_DIR%\distdir\%ABSL_GOOGLETEST_COMMIT%.zip 27) ELSE ( 28 SET ABSL_GOOGLETEST_DOWNLOAD_URL=https://github.com/google/googletest/archive/%ABSL_GOOGLETEST_COMMIT%.zip 29) 30 31:: Replace '\' with '/' in Windows paths for CMake. 32:: Note that this cannot go inside the IF block above, because BAT files are weird. 33SET ABSL_GOOGLETEST_DOWNLOAD_URL=%ABSL_GOOGLETEST_DOWNLOAD_URL:\=/% 34 35IF EXIST "C:\Program Files\CMake\bin\" ( 36 SET CMAKE_BIN="C:\Program Files\CMake\bin\cmake.exe" 37 SET CTEST_BIN="C:\Program Files\CMake\bin\ctest.exe" 38) ELSE ( 39 SET CMAKE_BIN="cmake.exe" 40 SET CTEST_BIN="ctest.exe" 41) 42 43SET CTEST_OUTPUT_ON_FAILURE=1 44SET CMAKE_BUILD_PARALLEL_LEVEL=16 45SET CTEST_PARALLEL_LEVEL=16 46 47:: Change directory to the root of the project. 48CD %~dp0\.. 49if %errorlevel% neq 0 EXIT /B 1 50 51SET TZDIR=%CD%\absl\time\internal\cctz\testdata\zoneinfo 52 53MKDIR "build" 54CD "build" 55 56SET CXXFLAGS="/WX" 57 58%CMAKE_BIN% ^ 59 -DABSL_BUILD_TEST_HELPERS=ON ^ 60 -DABSL_BUILD_TESTING=ON ^ 61 -DABSL_GOOGLETEST_DOWNLOAD_URL=%ABSL_GOOGLETEST_DOWNLOAD_URL% ^ 62 -DBUILD_SHARED_LIBS=%ABSL_CMAKE_BUILD_SHARED% ^ 63 -DCMAKE_CXX_STANDARD=%ABSL_CMAKE_CXX_STANDARD% ^ 64 -G "%ABSL_CMAKE_GENERATOR%" ^ 65 .. 66IF %errorlevel% neq 0 EXIT /B 1 67 68%CMAKE_BIN% --build . --target ALL_BUILD --config %ABSL_CMAKE_BUILD_TYPE% 69IF %errorlevel% neq 0 EXIT /B 1 70 71%CTEST_BIN% -C %ABSL_CMAKE_BUILD_TYPE% -E "absl_lifetime_test|absl_symbolize_test" 72IF %errorlevel% neq 0 EXIT /B 1 73 74EXIT /B 0 75