Debian Codegraph @

tools/run_tests/helper_scripts/build_cxx.bat

raw
1 @rem Copyright 2022 The gRPC Authors
2 @rem
3 @rem Licensed under the Apache License, Version 2.0 (the "License");
4 @rem you may not use this file except in compliance with the License.
5 @rem You may obtain a copy of the License at
6 @rem
7 @rem http://www.apache.org/licenses/LICENSE-2.0
8 @rem
9 @rem Unless required by applicable law or agreed to in writing, software
10 @rem distributed under the License is distributed on an "AS IS" BASIS,
11 @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 @rem See the License for the specific language governing permissions and
13 @rem limitations under the License.
14
15 setlocal
16
17 cd /d %~dp0\..\..\..
18
19 mkdir cmake
20 cd cmake
21 mkdir build
22 cd build
23
24 @rem Workaround a bug where VS150COMNTOOLS is not set due to a bug in VS 2017 installer
25 @rem see https://developercommunity.visualstudio.com/t/installing-visualstudio-build-tools-doesnt-add-env/17435
26 set "VS150COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\"
27
28 If "%GRPC_BUILD_ACTIVATE_VS_TOOLS%" == "2017" (
29 @rem set cl.exe build environment to build with VS2017 tooling
30 @rem this is required for Ninja build to work
31 call "%VS150COMNTOOLS%..\..\VC\Auxiliary\Build\vcvarsall.bat" %GRPC_BUILD_VS_TOOLS_ARCHITECTURE%
32 @rem restore command echo
33 echo on
34 )
35
36 If "%GRPC_CMAKE_GENERATOR%" == "Ninja" (
37 @rem Use ninja
38
39 @rem Select MSVC compiler (cl.exe) explicitly to make sure we don't end up gcc from mingw or cygwin
40 @rem (both are on path in kokoro win workers)
41 cmake -G "%GRPC_CMAKE_GENERATOR%" -DCMAKE_C_COMPILER="cl.exe" -DCMAKE_CXX_COMPILER="cl.exe" -DgRPC_BUILD_TESTS=ON -DCMAKE_BUILD_TYPE="%MSBUILD_CONFIG%" %* ../.. || goto :error
42
43 ninja -j%GRPC_RUN_TESTS_JOBS% buildtests_%GRPC_RUN_TESTS_CXX_LANGUAGE_SUFFIX% || goto :error
44
45 ) else (
46 @rem Use one of the Visual Studio generators.
47
48 cmake -G "%GRPC_CMAKE_GENERATOR%" -A "%GRPC_CMAKE_ARCHITECTURE%" -DCMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE=x64 -DgRPC_BUILD_TESTS=ON -DgRPC_BUILD_MSVC_MP_COUNT=%GRPC_RUN_TESTS_JOBS% %* ../.. || goto :error
49
50 @rem GRPC_RUN_TESTS_CXX_LANGUAGE_SUFFIX will be set to either "c" or "cxx"
51 cmake --build . --target buildtests_%GRPC_RUN_TESTS_CXX_LANGUAGE_SUFFIX% --config %MSBUILD_CONFIG% || goto :error
52 )
53
54 endlocal
55
56 goto :EOF
57
58 :error
59 echo Failed!
60 exit /b %errorlevel%