summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2023-04-24 22:56:27 +0800
committerruki <[email protected]>2023-04-24 22:56:27 +0800
commit98045c1c03854b066594e8e1f4dddc83e00dcb70 (patch)
treebb8d85255eabf02ff94af62aa01c8a5f076e04ed
parent1eef7dac208c82aaf2480cb20c4ff2359230c22a (diff)
improve proto autogendir
-rw-r--r--xmake/rules/protobuf/proto.lua4
1 files changed, 3 insertions, 1 deletions
diff --git a/xmake/rules/protobuf/proto.lua b/xmake/rules/protobuf/proto.lua
index c416e61a3..1d30c7bd6 100644
--- a/xmake/rules/protobuf/proto.lua
+++ b/xmake/rules/protobuf/proto.lua
@@ -65,13 +65,15 @@ function load(target, sourcekind)
-- get c/c++ source file for protobuf
local prefixdir
+ local autogendir
local public
local fileconfig = target:fileconfig(sourcefile_proto)
if fileconfig then
public = fileconfig.proto_public
prefixdir = fileconfig.proto_rootdir
+ autogendir = fileconfig.proto_autogendir
end
- local rootdir = path.join(target:autogendir(), "rules", "protobuf")
+ local rootdir = autogendir and autogendir or path.join(target:autogendir(), "rules", "protobuf")
local filename = path.basename(sourcefile_proto) .. ".pb" .. (sourcekind == "cxx" and ".cc" or "-c.c")
local sourcefile_cx = target:autogenfile(sourcefile_proto, {rootdir = rootdir, filename = filename})
local sourcefile_dir = prefixdir and path.join(rootdir, prefixdir) or path.directory(sourcefile_cx)