xref: /aosp_15_r20/external/abseil-cpp/ci/windows_clangcl_bazel.bat (revision 9356374a3709195abf420251b3e825997ff56c0f)
1*9356374aSAndroid Build Coastguard Worker:: Copyright 2023 The Abseil Authors
2*9356374aSAndroid Build Coastguard Worker::
3*9356374aSAndroid Build Coastguard Worker:: Licensed under the Apache License, Version 2.0 (the "License");
4*9356374aSAndroid Build Coastguard Worker:: you may not use this file except in compliance with the License.
5*9356374aSAndroid Build Coastguard Worker:: You may obtain a copy of the License at
6*9356374aSAndroid Build Coastguard Worker::
7*9356374aSAndroid Build Coastguard Worker::     https://www.apache.org/licenses/LICENSE-2.0
8*9356374aSAndroid Build Coastguard Worker::
9*9356374aSAndroid Build Coastguard Worker:: Unless required by applicable law or agreed to in writing, software
10*9356374aSAndroid Build Coastguard Worker:: distributed under the License is distributed on an "AS IS" BASIS,
11*9356374aSAndroid Build Coastguard Worker:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12*9356374aSAndroid Build Coastguard Worker:: See the License for the specific language governing permissions and
13*9356374aSAndroid Build Coastguard Worker:: limitations under the License.
14*9356374aSAndroid Build Coastguard Worker
15*9356374aSAndroid Build Coastguard WorkerSETLOCAL ENABLEDELAYEDEXPANSION
16*9356374aSAndroid Build Coastguard Worker
17*9356374aSAndroid Build Coastguard Worker:: Set LLVM directory.
18*9356374aSAndroid Build Coastguard WorkerSET BAZEL_LLVM=C:\Program Files\LLVM
19*9356374aSAndroid Build Coastguard Worker
20*9356374aSAndroid Build Coastguard Worker:: Change directory to the root of the project.
21*9356374aSAndroid Build Coastguard WorkerCD %~dp0\..
22*9356374aSAndroid Build Coastguard Workerif %errorlevel% neq 0 EXIT /B 1
23*9356374aSAndroid Build Coastguard Worker
24*9356374aSAndroid Build Coastguard Worker:: Set the standard version, [c++14|c++17|c++20|c++latest]
25*9356374aSAndroid Build Coastguard Worker:: https://msdn.microsoft.com/en-us/library/mt490614.aspx
26*9356374aSAndroid Build Coastguard Worker:: The default is c++14 if not set on command line.
27*9356374aSAndroid Build Coastguard WorkerIF "%STD%"=="" SET STD=c++14
28*9356374aSAndroid Build Coastguard Worker
29*9356374aSAndroid Build Coastguard Worker:: Set the compilation_mode (fastbuild|opt|dbg)
30*9356374aSAndroid Build Coastguard Worker:: https://docs.bazel.build/versions/master/user-manual.html#flag--compilation_mode
31*9356374aSAndroid Build Coastguard Worker:: The default is fastbuild
32*9356374aSAndroid Build Coastguard WorkerIF "%COMPILATION_MODE%"=="" SET COMPILATION_MODE=fastbuild
33*9356374aSAndroid Build Coastguard Worker
34*9356374aSAndroid Build Coastguard Worker:: Copy the alternate option file, if specified.
35*9356374aSAndroid Build Coastguard WorkerIF NOT "%ALTERNATE_OPTIONS%"=="" copy %ALTERNATE_OPTIONS% absl\base\options.h
36*9356374aSAndroid Build Coastguard Worker
37*9356374aSAndroid Build Coastguard Worker:: To upgrade Bazel, first download a new binary from
38*9356374aSAndroid Build Coastguard Worker:: https://github.com/bazelbuild/bazel/releases and copy it to
39*9356374aSAndroid Build Coastguard Worker:: /google/data/rw/teams/absl/kokoro/windows.
40*9356374aSAndroid Build Coastguard Worker::
41*9356374aSAndroid Build Coastguard Worker:: TODO(absl-team): Remove -Wno-microsoft-cast
42*9356374aSAndroid Build Coastguard Worker%KOKORO_GFILE_DIR%\bazel-7.0.0-windows-x86_64.exe ^
43*9356374aSAndroid Build Coastguard Worker  test ... ^
44*9356374aSAndroid Build Coastguard Worker  --compilation_mode=%COMPILATION_MODE% ^
45*9356374aSAndroid Build Coastguard Worker  --compiler=clang-cl ^
46*9356374aSAndroid Build Coastguard Worker  --copt=/WX ^
47*9356374aSAndroid Build Coastguard Worker  --copt=-Wno-microsoft-cast ^
48*9356374aSAndroid Build Coastguard Worker  --cxxopt=/std:%STD% ^
49*9356374aSAndroid Build Coastguard Worker  --define=absl=1 ^
50*9356374aSAndroid Build Coastguard Worker  --distdir=%KOKORO_GFILE_DIR%\distdir ^
51*9356374aSAndroid Build Coastguard Worker  --enable_bzlmod=true ^
52*9356374aSAndroid Build Coastguard Worker  --extra_execution_platforms=//:x64_windows-clang-cl ^
53*9356374aSAndroid Build Coastguard Worker  --extra_toolchains=@local_config_cc//:cc-toolchain-x64_windows-clang-cl ^
54*9356374aSAndroid Build Coastguard Worker  --keep_going ^
55*9356374aSAndroid Build Coastguard Worker  --test_env="GTEST_INSTALL_FAILURE_SIGNAL_HANDLER=1" ^
56*9356374aSAndroid Build Coastguard Worker  --test_env=TZDIR="%CD%\absl\time\internal\cctz\testdata\zoneinfo" ^
57*9356374aSAndroid Build Coastguard Worker  --test_output=errors ^
58*9356374aSAndroid Build Coastguard Worker  --test_tag_filters=-benchmark
59*9356374aSAndroid Build Coastguard Worker
60*9356374aSAndroid Build Coastguard Workerif %errorlevel% neq 0 EXIT /B 1
61*9356374aSAndroid Build Coastguard WorkerEXIT /B 0
62