diff options
| author | ruki <[email protected]> | 2025-05-09 06:51:23 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-05-09 06:51:23 +0800 |
| commit | a3df7afcefd2e8fe195cf011f2fad3681d367cc5 (patch) | |
| tree | c6dddff42bdebb28b4917a3112cef862bb222bc1 | |
| parent | 93c6fb1a2a7dbe2a320fa51ce3fd71818fb89d09 (diff) | |
| parent | 6ee4c9b436c94ed8827d63e5a4e3cd91f9d4ad3c (diff) | |
Merge pull request #6405 from jiangyanan224/pb_rule
rule protobuf.cpp add custom args, pass through to protoc. Resolves #6398
| -rw-r--r-- | xmake/rules/protobuf/proto.lua | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/xmake/rules/protobuf/proto.lua b/xmake/rules/protobuf/proto.lua index bebeb3105..2649a0586 100644 --- a/xmake/rules/protobuf/proto.lua +++ b/xmake/rules/protobuf/proto.lua @@ -108,6 +108,7 @@ function buildcmd_pfile(target, batchcmds, sourcefile_proto, sourcekind, opt) local autogendir local public local grpc_cpp_plugin + local proto_flags local fileconfig = target:fileconfig(sourcefile_proto) if fileconfig then public = fileconfig.proto_public @@ -116,6 +117,8 @@ function buildcmd_pfile(target, batchcmds, sourcefile_proto, sourcekind, opt) -- @see https://github.com/xmake-io/xmake/issues/3678 autogendir = fileconfig.proto_autogendir grpc_cpp_plugin = fileconfig.proto_grpc_cpp_plugin + -- custom flags, pass through to protoc + proto_flags = fileconfig.proto_flags end 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") @@ -143,6 +146,10 @@ function buildcmd_pfile(target, batchcmds, sourcefile_proto, sourcekind, opt) table.insert(protoc_args, path(sourcefile_dir, function (p) return ("--grpc_out=") .. p end)) end + if proto_flags then + table.join2(protoc_args, proto_flags) + end + -- add commands batchcmds:mkdir(sourcefile_dir) batchcmds:show_progress( |
