-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGenProtoCode.bat
68 lines (59 loc) · 1.75 KB
/
GenProtoCode.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
@echo off
rem Author: i0gan
rem Email : [email protected]
rem Date : 2023-01-04
rem Github: https://github.com/pwnsky/squick
rem Description: Generate proto code
set proto_bin=.\Tools\protoc\protoc
set proto_path=".\Proto"
set cpp_out_path=".\ProtoCode\Cpp"
set csharp_out_path=".\ProtoCode\Csharp"
set python_out_path=".\ProtoCode\Python"
set lua_out_path=".\ProtoCode\Lua"
del /f /q /s ProtoCode\*
mkdir %csharp_out_path%
mkdir %python_out_path%
mkdir %cpp_out_path%
mkdir %lua_out_path%
rem Gen lua code
cd Tools\proto
python gen_msgid.py
python proto_enum_to_lua.py
python proto_to_lua_str.py
cd ..\..
for %%f in (%proto_path%\*.proto) do (
%proto_bin% --csharp_out=%csharp_out_path% --proto_path=%proto_path% %%f
if %ERRORLEVEL% neq 0 (
pause
exit /b %ERRORLEVEL%
)
)
for %%f in (%proto_path%\*.proto) do (
%proto_bin% --python_out=%python_out_path% --proto_path=%proto_path% %%f
if %ERRORLEVEL% neq 0 (
pause
exit /b %ERRORLEVEL%
)
)
rem windows dll于linux so有所区别,windows在需要声明导出函数,才能让其他dll或程序进行调用 参考 https://www.cnblogs.com/zhongpan/p/8378825.html
for %%f in (%proto_path%\*.proto) do (
%proto_bin% --cpp_out=dllexport_decl="WIN_DLL_EXPORT":%cpp_out_path% --proto_path=%proto_path% %%f
if %ERRORLEVEL% neq 0 (
pause
exit /b %ERRORLEVEL%
)
)
rem 删除多余的proto
del /f /q /s %csharp_out_path%\N*.cs
echo "Proto to code succ"
xcopy /s /e /y ProtoCode\Python Tools\pycli\proto
if "%1"=="no_pause" (
echo continue
) else if "%1"=="server" (
echo "Copy to server"
xcopy /s /e /y ProtoCode\Cpp ..\src\struct
mkdir ..\pycli\proto
copy ProtoCode\Lua\enum_all.lua ..\src\lua\proto\enum.lua
) else (
pause
)