Run command by powershell
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
安装 perl
choco install activeperl
install yasm
choco install yasm
install go
choco install golang
install ninja
choco install ninja
intall grpc
git clone https://github.com/grpc/grpc.git
git checkout v1.23.0 //保证编译正确
下载依赖
git submodule update --init
下载完毕后,找到并打开文件./grpc/third_party/zlib/gzguts.h找到
#ifdef _WIN32
#inlcude <stddef.h>
#endif
改为
#ifdef _WIN32
#include <stddef.h>
#pragma warning(disable:4996)
#endif
屏蔽一些警告,感觉没啥实际作用,只是照着做而已。
mkdir .build
cd .build
cmake –version
cmake .. -G "Visual Studio 15 2017 Win64" -DCMAKE_BUILD_TYPE=Release
HelloWorld
protoc -I="./protos" --grpc_out="./protos" --plugin=protoc-gen-grpc=“E:\LearningOpensourceLib\gRPC\grpc_plugs\grpc\.build\Debug\grpc_cpp_plugin.exe " "./protos\hw.proto"
protoc -I="./protos" --cpp_out="./protos" "./protos\hw.proto"