无法匹配到自定义的 rule #1968
Answered
by
waruqi
someoneinjd
asked this question in
Q&A
无法匹配到自定义的 rule
#1968
-
个人写的一个 wayland 项目中需要依赖 rule('wayland-xml')
set_extensions('.xml')
on_build_file(function(target, sourcefile, opt)
import("core.project.depend")
import("utils.progress")
os.mkdir(target:targetdir())
local targetfile_c = path.join(target:targetdir(), path.basename(sourcefile) .. '-protocol.c')
local targetfile_h = path.join(target:targetdir(), path.basename(sourcefile) .. '-client-protocol.h')
target:add('includedirs', target:targetdir(), {public = true})
depend.on_changed(function ()
os.vrunv('wayland-scanner', {'private-code', sourcefile, targetfile_c})
os.vrunv('wayland-scanner', {'client-header', sourcefile, targetfile_h})
target:add('files', targetfile_c)
progress.show(opt.progress, "${color.build.object}protocol xml %s", sourcefile)
end, {files = sourcefile})
end)
rule_end()
local client_protocols = {
{'stable/xdg-shell', 'xdg-shell'},
{'unstable/xdg-output', 'xdg-output-unstable-v1'},
{'protocols', 'wlr-layer-shell-unstable-v1'}
}
for i, proto in ipairs(client_protocols) do
target(proto[2])
set_kind('static')
on_load(function(target)
local wl_proto_dir, _ = os.iorun('pkg-config wayland-protocols --variable=pkgdatadir')
local trimmed = string.trim(wl_proto_dir)
local src_dir = path.join(i == 3 and os.projectdir() or trimmed, proto[1])
target:add('files', src_dir .. proto[2] .. '.xml', {rule = 'wayland-xml'})
end)
target_end()
end 本意是对于每个
看样子应该是没有匹配到自定义的 rule,请问我该如何解决呢? |
Beta Was this translation helpful? Give feedback.
Answered by
waruqi
Jan 10, 2022
Replies: 2 comments 2 replies
-
缺 add_rules ,看下文档 |
Beta Was this translation helpful? Give feedback.
1 reply
-
那就是 not found ,自己确认下路径 |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
someoneinjd
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
那就是 not found ,自己确认下路径