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 Download OpenSSL-Win32 originally installed from https://slproweb.com/products/Win32OpenSSL.html
23powershell -Command "(New-Object Net.WebClient).DownloadFile('https://storage.googleapis.com/grpc-testing.appspot.com/OpenSSL-Win32-1_1_0g.zip', 'OpenSSL-Win32.zip')"
24powershell -Command "Add-Type -Assembly 'System.IO.Compression.FileSystem'; [System.IO.Compression.ZipFile]::ExtractToDirectory('OpenSSL-Win32.zip', '.');"
25
26@rem set absolute path to OpenSSL with forward slashes
27set OPENSSL_DIR=%cd:\=/%/OpenSSL-Win32
28
29@rem TODO(jtattermusch): add support for GRPC_CPP_DISTRIBTEST_BUILD_COMPILER_JOBS env variable
30
31set VS_GENERATOR="Visual Studio 16 2019"
32@rem TODO(jtattermusch): switch to x64 build (will require pulling a x64 build of openssl)
33set VS_ARCHITECTURE="Win32"
34
35@rem Build helloworld example using cmake
36@rem Use non-standard build directory to avoid too long filenames
37mkdir example_build
38cd example_build
39cmake -G %VS_GENERATOR% -A %VS_ARCHITECTURE% -DOPENSSL_ROOT_DIR=%OPENSSL_DIR% ../examples/cpp/helloworld/cmake_externalproject || goto :error
40cmake --build . --config Release || goto :error
41cd ..
42
43goto :EOF
44
45:error
46echo Failed!
47exit /b %errorlevel%
48