summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2024-01-30 22:50:06 +0800
committerruki <[email protected]>2024-01-30 22:50:06 +0800
commit03e1525e1dca4849ab13fe9edb06bdbaaf932d42 (patch)
tree836ff9b41adee5a796be9f92a45d0e64f4647dd6
parentbb3b6ac6ebd60660049baaa0d61847b544b69b59 (diff)
fix find protoc #4659
-rw-r--r--xmake/rules/protobuf/proto.lua9
1 files changed, 6 insertions, 3 deletions
diff --git a/xmake/rules/protobuf/proto.lua b/xmake/rules/protobuf/proto.lua
index 2bb464fd5..0be0cbb96 100644
--- a/xmake/rules/protobuf/proto.lua
+++ b/xmake/rules/protobuf/proto.lua
@@ -31,9 +31,11 @@ import("private.async.buildjobs")
function _get_protoc(target, sourcekind)
-- find protoc
+ -- @see https://github.com/xmake-io/xmake/issues/4659
+ local envs = os.joinenvs(target:pkgenvs(), os.getenvs())
local protoc = target:data("protobuf.protoc")
if not protoc and sourcekind == "cxx" then
- protoc = find_tool("protoc", {envs = target:pkgenvs()})
+ protoc = find_tool("protoc", {envs = envs})
if protoc and protoc.program then
target:data_set("protobuf.protoc", protoc.program)
end
@@ -42,7 +44,7 @@ function _get_protoc(target, sourcekind)
-- find protoc-c
local protoc_c = target:data("protobuf.protoc-c")
if not protoc_c and sourcekind == "cc" then
- protoc_c = find_tool("protoc-c", {envs = target:pkgenvs()}) or protoc
+ protoc_c = find_tool("protoc-c", {envs = envs}) or protoc
if protoc_c and protoc_c.program then
target:data_set("protobuf.protoc-c", protoc_c.program)
end
@@ -54,8 +56,9 @@ end
-- get grpc_cpp_plugin
function _get_grpc_cpp_plugin(target, sourcekind)
+ local envs = os.joinenvs(target:pkgenvs(), os.getenvs())
assert(sourcekind == "cxx", "grpc_cpp_plugin only support c++")
- local grpc_cpp_plugin = find_tool("grpc_cpp_plugin", {norun = true, force = true, envs = target:pkgenvs()})
+ local grpc_cpp_plugin = find_tool("grpc_cpp_plugin", {norun = true, force = true, envs = envs})
return assert(grpc_cpp_plugin and grpc_cpp_plugin.program, "grpc_cpp_plugin not found!")
end