Derek Mauro | 486ec29 | 2023-04-03 07:16:06 -0700 | [diff] [blame] | 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 | |
| 15 | SETLOCAL ENABLEDELAYEDEXPANSION |
| 16 | |
Derek Mauro | 7795d08 | 2024-07-18 04:31:54 -0700 | [diff] [blame] | 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. |
| 19 | SET ABSL_GOOGLETEST_VERSION=1.15.0 |
| 20 | SET ABSL_GOOGLETEST_DOWNLOAD_URL=https://github.com/google/googletest/releases/download/v%ABSL_GOOGLETEST_VERSION%/googletest-%ABSL_GOOGLETEST_VERSION%.tar.gz |
Derek Mauro | 486ec29 | 2023-04-03 07:16:06 -0700 | [diff] [blame] | 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. |
| 24 | SET ABSL_GOOGLETEST_DOWNLOAD_URL=%ABSL_GOOGLETEST_DOWNLOAD_URL:\=/% |
| 25 | |
| 26 | IF 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 | |
| 34 | SET CTEST_OUTPUT_ON_FAILURE=1 |
| 35 | SET CMAKE_BUILD_PARALLEL_LEVEL=16 |
| 36 | SET CTEST_PARALLEL_LEVEL=16 |
| 37 | |
| 38 | :: Change directory to the root of the project. |
| 39 | CD %~dp0\.. |
| 40 | if %errorlevel% neq 0 EXIT /B 1 |
| 41 | |
| 42 | SET TZDIR=%CD%\absl\time\internal\cctz\testdata\zoneinfo |
| 43 | |
| 44 | MKDIR "build" |
| 45 | CD "build" |
| 46 | |
| 47 | SET CXXFLAGS="/WX" |
| 48 | |
| 49 | %CMAKE_BIN% ^ |
Derek Mauro | 486ec29 | 2023-04-03 07:16:06 -0700 | [diff] [blame] | 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 | .. |
| 56 | IF %errorlevel% neq 0 EXIT /B 1 |
| 57 | |
| 58 | %CMAKE_BIN% --build . --target ALL_BUILD --config %ABSL_CMAKE_BUILD_TYPE% |
| 59 | IF %errorlevel% neq 0 EXIT /B 1 |
| 60 | |
| 61 | %CTEST_BIN% -C %ABSL_CMAKE_BUILD_TYPE% -E "absl_lifetime_test|absl_symbolize_test" |
| 62 | IF %errorlevel% neq 0 EXIT /B 1 |
| 63 | |
| 64 | EXIT /B 0 |