build_artifact_protoc.bat 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. @rem Copyright 2016 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. mkdir -p %ARTIFACTS_OUT%
  15. @rem enter repo root
  16. cd /d %~dp0\..\..\..
  17. mkdir cmake
  18. cd cmake
  19. mkdir build
  20. cd build
  21. @rem Use externally provided env to determine build parallelism, otherwise use default.
  22. if "%GRPC_PROTOC_BUILD_COMPILER_JOBS%"=="" (
  23. set GRPC_PROTOC_BUILD_COMPILER_JOBS=2
  24. )
  25. @rem set cl.exe build environment to build with VS2015 tooling
  26. @rem this is required for Ninja build to work
  27. call "%VS140COMNTOOLS%..\..\VC\vcvarsall.bat" %ARCHITECTURE%
  28. @rem restore command echo
  29. echo on
  30. @rem Select MSVC compiler (cl.exe) explicitly to make sure we don't end up gcc from mingw or cygwin
  31. @rem (both are on path in kokoro win workers)
  32. cmake -G Ninja -DCMAKE_C_COMPILER="cl.exe" -DCMAKE_CXX_COMPILER="cl.exe" -DCMAKE_BUILD_TYPE=Release -DgRPC_BUILD_TESTS=OFF -DgRPC_MSVC_STATIC_RUNTIME=ON ../../.. || goto :error
  33. ninja -j%GRPC_PROTOC_BUILD_COMPILER_JOBS% protoc plugins || goto :error
  34. cd ..\..
  35. xcopy /Y cmake\build\third_party\protobuf\protoc.exe %ARTIFACTS_OUT%\ || goto :error
  36. xcopy /Y cmake\build\*_plugin.exe %ARTIFACTS_OUT%\ || goto :error
  37. goto :EOF
  38. :error
  39. exit /b 1