summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2023-10-13 06:53:38 -0500
committerGitHub <[email protected]>2023-10-13 06:53:38 -0500
commit23f5f45fdbc266eee5fb295641ed6b1703a2111c (patch)
tree5996b751448d7464cacc83df60ec91554967101e
parent8da5b070c91ba1fd48173e560400d088e69ac0a2 (diff)
parent27be8483199557b28424805d8fa17fa98f964175 (diff)
Merge pull request #4285 from A2va/fix-grpc
Fix proto grpc build on windows
-rw-r--r--xmake/rules/protobuf/proto.lua5
1 files changed, 3 insertions, 2 deletions
diff --git a/xmake/rules/protobuf/proto.lua b/xmake/rules/protobuf/proto.lua
index fee266087..1124899c0 100644
--- a/xmake/rules/protobuf/proto.lua
+++ b/xmake/rules/protobuf/proto.lua
@@ -52,7 +52,7 @@ end
-- get grpc_cpp_plugin
function _get_grpc_cpp_plugin(target, sourcekind)
assert(sourcekind == "cxx", "grpc_cpp_plugin only support c++")
- local grpc_cpp_plugin = find_tool("grpc_cpp_plugin", {norun = true})
+ local grpc_cpp_plugin = find_tool("grpc_cpp_plugin", {norun = true, force = true, envs = target:pkgenvs()})
return assert(grpc_cpp_plugin and grpc_cpp_plugin.program, "grpc_cpp_plugin not found!")
end
@@ -143,7 +143,8 @@ function buildcmd(target, batchcmds, sourcefile_proto, opt, sourcekind)
}
if grpc_cpp_plugin then
- table.insert(protoc_args, "--plugin=protoc-gen-grpc=" .. grpc_cpp_plugin_bin)
+ local extension = target:is_plat("windows") and ".exe" or ""
+ table.insert(protoc_args, "--plugin=protoc-gen-grpc=" .. grpc_cpp_plugin_bin .. extension)
table.insert(protoc_args, path(sourcefile_dir, function (p) return ("--grpc_out=") .. p end))
end