Proto-Gen-Lua 环境搭建编译、安装、使用

版权声明:http://blog.csdn.net/admin_jhon https://blog.csdn.net/Admin_Jhon/article/details/77161914

懒人直达

Proto-Gen-Lua(Auto)

简介

官方介绍

Protocol buffers are a flexible, efficient, automated mechanism for serializing structured data – think XML, but smaller, faster, and simpler.
You define how you want your data to be structured once, then you can use special generated source code to easily write and read your structured data to and from a variety of data streams and using a variety of languages. You can even update your data structure without breaking deployed programs that are compiled against the “old” format.

需要用到的文件

  • Python27(要求2.6以上,本文以Python27版本为例

  • protoc-gen-lua

  • protobuf 、ProtoC这个两个文件版本要对应,本文以2.4.1为例

部署步骤

  1. protoc.exe 拷贝至protobuf\src以及protoc-gen-lua

  2. 在protobuf的python目录下,打开命令行,依次执行

    python setup.py build
    python setup.py test
    python setup.py install
  3. proto-gen-lua\plugin 目录下 编写,以下含义的批处理文件

    @python "%~dp0protoc-gen-lua"
  4. proto-gen-lua 目录下编写以下含义的批处理文件

     @ECHO off
     rem CD 到存放*.proto的文件夹下(eg. CD LuaProto)
     for %%i in (*.proto) do (
     echo %%i  
     "..\protoc.exe" --plugin=protoc-gen-lua="..\plugin\protoc-gen-lua.bat(这是上一个步骤编写的批处理文件)" --lua_out=. %%i
     )
     ECHO end  
     PAUSE

Help&Demo

以上步骤只是授之于渔,并没有授之于鱼。如果不明白具体是怎么部署的可以下载这个文件包来部署以及学习。
Proto-Gen-Lua(Auto)

猜你喜欢

转载自blog.csdn.net/Admin_Jhon/article/details/77161914
今日推荐