diff options
| -rw-r--r-- | xmake/rules/protobuf/proto.lua | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/xmake/rules/protobuf/proto.lua b/xmake/rules/protobuf/proto.lua index 9c20857ff..c416e61a3 100644 --- a/xmake/rules/protobuf/proto.lua +++ b/xmake/rules/protobuf/proto.lua @@ -88,13 +88,17 @@ function buildcmd(target, batchcmds, sourcefile_proto, opt, 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 + -- custom autogen directory to access the generated header files + -- @see https://github.com/xmake-io/xmake/issues/3678 + 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) |
