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 version of GoogleTest to be used in the CMake tests in this directory. 18:: Keep this in sync with the version in the WORKSPACE file. 19SET ABSL_GOOGLETEST_VERSION=1.15.2 20SET ABSL_GOOGLETEST_DOWNLOAD_URL=https://github.com/google/googletest/releases/download/v%ABSL_GOOGLETEST_VERSION%/googletest-%ABSL_GOOGLETEST_VERSION%.tar.gz 21 22:: Replace '\' with '/' in Windows paths for CMake. 23:: Note that this cannot go inside the IF block above, because BAT files are weird. 24SET ABSL_GOOGLETEST_DOWNLOAD_URL=%ABSL_GOOGLETEST_DOWNLOAD_URL:\=/% 25 26IF EXIST "C:\Program Files\CMake\bin\" ( 27 SET CMAKE_BIN="C:\Program Files\CMake\bin\cmake.exe" 28 SET CTEST_BIN="C:\Program Files\CMake\bin\ctest.exe" 29) ELSE ( 30 SET CMAKE_BIN="cmake.exe" 31 SET CTEST_BIN="ctest.exe" 32) 33 34SET CTEST_OUTPUT_ON_FAILURE=1 35SET CMAKE_BUILD_PARALLEL_LEVEL=16 36SET CTEST_PARALLEL_LEVEL=16 37 38:: Change directory to the root of the project. 39CD %~dp0\.. 40if %errorlevel% neq 0 EXIT /B 1 41 42SET TZDIR=%CD%\absl\time\internal\cctz\testdata\zoneinfo 43 44MKDIR "build" 45CD "build" 46 47SET CXXFLAGS="/WX" 48 49%CMAKE_BIN% ^ 50 -DABSL_BUILD_TESTING=ON ^ 51 -DABSL_GOOGLETEST_DOWNLOAD_URL=%ABSL_GOOGLETEST_DOWNLOAD_URL% ^ 52 -DBUILD_SHARED_LIBS=%ABSL_CMAKE_BUILD_SHARED% ^ 53 -DCMAKE_CXX_STANDARD=%ABSL_CMAKE_CXX_STANDARD% ^ 54 -G "%ABSL_CMAKE_GENERATOR%" ^ 55 .. 56IF %errorlevel% neq 0 EXIT /B 1 57 58%CMAKE_BIN% --build . --target ALL_BUILD --config %ABSL_CMAKE_BUILD_TYPE% 59IF %errorlevel% neq 0 EXIT /B 1 60 61%CTEST_BIN% -C %ABSL_CMAKE_BUILD_TYPE% -E "absl_lifetime_test|absl_symbolize_test" 62IF %errorlevel% neq 0 EXIT /B 1 63 64EXIT /B 0 65