google::protobuf 编译方法
这两天用了一下Protobuf 感觉很方便, 记录一下编译过程, 以做务忘(需要安装cmake):
1: 下载地址: https://developers.google.com/protocol-buffers/docs/downloads
2: 解压后会有一个cmake目录, 打开vs command line 并进入cmake目录
3: c:\protobuf\cmake > mkdir build & cd build
4: 如果编译为debug:
c:\protobuf\cmake\build>mkdir debug & cd debug
c:\protobuf\cmake\build\debug>cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Debug -Dprotobuf_BUILD_TESTS=OFF -DCMAKE_INSTALL_PREFIX=../../../install ../..
5: 如果编译为debug:
c:\protobuf\cmake\build>mkdir release & cd release
c:\protobuf\cmake\build\release>cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -Dprotobuf_BUILD_TESTS=OFF -DCMAKE_INSTALL_PREFIX=../../../install ../..
6: 开始编译
c:\protobuf\cmake\build\debug>nmake
7: 安装
c:\protobuf\cmake\build\debug>nmake install
成功后会在最上层根目录(c:\protobuf)下生成一个install的文件夹,里面有三个文件夹,bin,include和lib。
原文地址: Google protobuf windows 下编译