zoukankan      html  css  js  c++  java
  • 手动编译protobuf3的C++源码

    Windows下编译

    官方文档
    第三方文档

    准备工具

    需要注意

    推荐按照第三方的文档上的安装就可以了,但是中间会有许多坑。
    比如:若是下载proto3的最新版,就会编译错误,我这里也没找到为嘛错误,所以就按照第三方文档上面的git 3.0版本的源代码。

    按照各自的需求修改源代码后,直接进行编译和检查就行了。

    主要步骤

    1、 通过你的开始菜单,打开Visual Studio 2013的开发人员命令提示工具:

    2、然后cd到D盘,自己创建以下目录

    1. D:Path o

    3、git源代码(3.0版本)

    1. D:Path o>git clone -b v3.0.0 https://github.com/google/protobuf.git
    2. D:Path o>cd protobuf
    3. D:Path oprotobuf>
    4. D:Path oprotobuf>git clone -b release-1.7.0 https://github.com/google/googlemock.git gmock
    5. D:Path oprotobuf>cd gmock
    6. D:Path oprotobufgmock>git clone -b release-1.7.0 https://github.com/google/googletest.git gtest

    4、cmake的配置

    1. D:Path oprotobufgmock>cd ..cmake
    2. D:Path oprotobufcmake>

    5、创建build临时编译目录

    1. D:Path oprotobufcmake>mkdir build & cd build
    2. D:Path oprotobufcmakeuild>

    6、Release 配置

    1. D:Path oprotobufcmakeuild>mkdir release & cd release
    2. D:Path oprotobufcmakeuild elease>cmake -G "NMake Makefiles"-DCMAKE_BUILD_TYPE=Release-DCMAKE_INSTALL_PREFIX=../../../../install ../..

    7、开始编译发布

    1. D:Path oprotobufcmakeuild elease>nmake

    接下来等待一段时间:

    8、获取编译后的可执行文件
    在当前文件夹下,就可以看到编译好的文件:protoc.exe

  • 相关阅读:
    三、Nginx配置文件说明
    Nginx配置文件说明
    二、Nginx离线安装
    一、Nginx简述
    yum 下载全量依赖 rpm 包及离线安装(终极解决方案)
    Java注解
    windows常用运行命令和dos命令
    MySQL学习记录一之存储引擎篇
    查询某条数据的上一条和下一条数据的Sql语句
    Single Number II
  • 原文地址:https://www.cnblogs.com/likeli/p/6603780.html
Copyright © 2011-2022 走看看