1、下載protobuf和protoc-gen-lua開源項(xiàng)目。
2、在protobuf/vsprojects目錄下編譯出protoc.exe。
3岖寞、將protoc.exe復(fù)制到protobuf/src目錄
4抡四、在protobuf/python目錄下編譯和安裝支持Python插件的Protoc。
編譯命令:python setup.py build
安裝命令:python setup.py install
5、將protoc.exe再?gòu)?fù)制到protoc-gen-lua目錄
6指巡、在protoc-gen-lua/plugin下創(chuàng)建protoc-gen-lua.bat文件淑履,文件內(nèi)容:
@python "%~dp0protoc-gen-lua"
(其實(shí)就是用一個(gè)Bat對(duì)Python插件進(jìn)行封裝)
7、在protoc-gen-lua目錄創(chuàng)建buildproto.bat文件藻雪,文件核心內(nèi)容:
"protoc.exe" --plugin=protoc-gen-lua=".\plugin\protoc-gen-lua.bat" --lua_out=. xxx.proto
(其實(shí)就是執(zhí)行官方的protoc.exe秘噪,但是使用一個(gè)基于Python的插件:protoc-gen-lua)
--lua_out 輸出目錄
xxx.proto Proto描述文件