-
Notifications
You must be signed in to change notification settings - Fork 1
/
premake5.lua
59 lines (57 loc) · 1.8 KB
/
premake5.lua
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
local gitdir = "protoc-gen-lua"
local luadir = "Lua/5.1.5"
local luaVer = "lua51"
solution("protobuf")
location("build")
configurations("Release")
project("protobuf")
location("build")
kind("SharedLib")
language("c")
targetname("pb")
targetdir("compiled/protobuf")
defines
{
"WIN32";
}
flags
{
"MultiProcessorCompile";
"NoImportLib";
"NoIncrementalLink";
}
disablewarnings
{
"4244" -- disable int64_t and uint64_t to lua_Integer warnings
}
includedirs
{
luadir .. "/include";
}
libdirs
{
luadir
}
links
{
luaVer .. ".lib"
}
files
{
gitdir .. "/protobuf/*.c";
}
local copyCmd = '(robocopy "%s" "%s" %s) ^& IF %%ERRORLEVEL%% LEQ 1 SET ERRORLEVEL=0 '; -- Eat Robocopy return codes.
postbuildcommands
{
"{DELETE} %{cfg.targetdir}/pb.lib"; -- I can't figure out how to not make these, so let's just delete them.
"{DELETE} %{cfg.targetdir}/pb.exp"; -- ""
copyCmd:format("../" .. luadir, "../compiled/example", luaVer..".exe " .. luaVer..".dll");
copyCmd:format("../example", "../compiled/example", "");
copyCmd:format("../" .. gitdir .. "/protobuf", "../compiled/protobuf", "*.lua");
copyCmd:format("../" .. gitdir .. "/plugin", "../compiled/plugin", "protoc-gen-lua plugin_*");
copyCmd:format("../" .. gitdir .. "/", "../compiled", "protoc.exe");
copyCmd:format("../" .. gitdir .. "/example", "../compiled", "*.proto");
"ECHO @python plugin/protoc-gen-lua> ../compiled/plugin/lua_out.bat";
"ECHO @ECHO OFF>> ../compiled/compile_proto.bat";
"ECHO protoc --lua_out=./ --plugin=protoc-gen-lua=plugin\\lua_out.bat %%*>> ../compiled/compile_proto.bat";
}