一. 获取Protocol Buffer
1.1 获得源码
Git clone之:git clone https://github.com/google/protobuf.git
本例选择从release下载3.7.0版本
下载并解压到目录: D:\wzx\protobuf\protobuf-3.7.0
1.2 编译protoc.exe(Windows平台)
准备工具: VS2017(包含C++模块),
提取码:jwa7
1.打开cmake目录,运行cmakegui:
D:\wzx\protobuf\cmake-3.14.0-win64-x64\bin\cmake-gui.exe
2.配置选项:
Source Code目录: D:/wzx/protobuf/protobuf-3.7.0/cmake
build the binaries目录:D:/wzx/protobuf/cmake-3.14.0-win64-x64/bin/protobuf-build
菜单栏Tools->configure,选择generator:本例使用VS2017 64位版本,所以选择:Visual Studio 15 2017
4.点击finish,结果如下图:
5.将列表中的protobuf_BUILD_SHARED_LIBS勾上, 然后generator。< |