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 15@rem enter this directory 16cd /d %~dp0\..\..\.. 17 18@rem TODO(jtattermusch): Kokoro has pre-installed protoc.exe in C:\Program Files\ProtoC and that directory 19@rem is on PATH. To avoid picking up the older version protoc.exe, we change the path to something non-existent. 20set PATH=%PATH:ProtoC=DontPickupProtoC% 21 22@rem Install into ./testinstall, but use absolute path and foward slashes 23set INSTALL_DIR=%cd:\=/%/testinstall 24 25@rem Download OpenSSL-Win32 originally installed from https://slproweb.com/products/Win32OpenSSL.html 26powershell -Command "(New-Object Net.WebClient).DownloadFile('https://storage.googleapis.com/grpc-testing.appspot.com/OpenSSL-Win32-1_1_0g.zip', 'OpenSSL-Win32.zip')" 27powershell -Command "Add-Type -Assembly 'System.IO.Compression.FileSystem'; [System.IO.Compression.ZipFile]::ExtractToDirectory('OpenSSL-Win32.zip', '.');" 28 29@rem set absolute path to OpenSSL with forward slashes 30set OPENSSL_DIR=%cd:\=/%/OpenSSL-Win32 31 32@rem Install absl 33mkdir third_party\abseil-cpp\cmake\build 34pushd third_party\abseil-cpp\cmake\build 35cmake -DCMAKE_INSTALL_PREFIX=%INSTALL_DIR% ..\.. 36cmake --build . --config Release --target install || goto :error 37popd 38 39@rem Install c-ares 40mkdir third_party\cares\cares\cmake\build 41pushd third_party\cares\cares\cmake\build 42cmake -DCMAKE_INSTALL_PREFIX=%INSTALL_DIR% ..\.. 43cmake --build . --config Release --target install || goto :error 44popd 45 46@rem Install protobuf 47mkdir third_party\protobuf\cmake\build 48pushd third_party\protobuf\cmake\build 49cmake -DCMAKE_INSTALL_PREFIX=%INSTALL_DIR% -DZLIB_ROOT=%INSTALL_DIR% -Dprotobuf_MSVC_STATIC_RUNTIME=OFF -Dprotobuf_BUILD_TESTS=OFF .. 50cmake --build . --config Release --target install || goto :error 51popd 52 53@rem Install re2 54mkdir third_party\re2\cmake\build 55pushd third_party\re2\cmake\build 56cmake -DCMAKE_INSTALL_PREFIX=%INSTALL_DIR% ..\.. 57cmake --build . --config Release --target install || goto :error 58popd 59 60@rem Install zlib 61mkdir third_party\zlib\cmake\build 62pushd third_party\zlib\cmake\build 63cmake -DCMAKE_INSTALL_PREFIX=%INSTALL_DIR% ..\.. 64cmake --build . --config Release --target install || goto :error 65popd 66 67@rem Just before installing gRPC, wipe out contents of all the submodules to simulate 68@rem a standalone build from an archive 69git submodule deinit --all --force 70 71@rem Install gRPC 72mkdir cmake\build 73pushd cmake\build 74cmake ^ 75 -DCMAKE_BUILD_TYPE=Release ^ 76 -DCMAKE_INSTALL_PREFIX=%INSTALL_DIR% ^ 77 -DOPENSSL_ROOT_DIR=%OPENSSL_DIR% ^ 78 -DZLIB_ROOT=%INSTALL_DIR% ^ 79 -DgRPC_INSTALL=ON ^ 80 -DgRPC_BUILD_TESTS=OFF ^ 81 -DgRPC_ABSL_PROVIDER=package ^ 82 -DgRPC_CARES_PROVIDER=package ^ 83 -DgRPC_PROTOBUF_PROVIDER=package ^ 84 -DgRPC_RE2_PROVIDER=package ^ 85 -DgRPC_SSL_PROVIDER=package ^ 86 -DgRPC_ZLIB_PROVIDER=package ^ 87 ../.. || goto :error 88cmake --build . --config Release --target install || goto :error 89popd 90 91@rem Build helloworld example using cmake 92mkdir examples\cpp\helloworld\cmake\build 93pushd examples\cpp\helloworld\cmake\build 94cmake -DCMAKE_INSTALL_PREFIX=%INSTALL_DIR% -DOPENSSL_ROOT_DIR=%OPENSSL_DIR% -DZLIB_ROOT=%INSTALL_DIR% ../.. || goto :error 95cmake --build . --config Release || goto :error 96popd 97 98goto :EOF 99 100:error 101echo Failed! 102exit /b %errorlevel% 103