diff options
| author | ruki <[email protected]> | 2023-04-24 22:55:30 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2023-04-24 22:55:30 +0800 |
| commit | 1eef7dac208c82aaf2480cb20c4ff2359230c22a (patch) | |
| tree | b28d287ec8f92ef39ab00580b692df48e93ce0ab | |
| parent | c56d1efdb4ea11db91cc14dfe66464181b3a7856 (diff) | |
add proto_autogendir #3678
| -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) |
