1 Star 0 Fork 30

Goldgom/third_party_wayland_standard

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
wayland_protocol.gni 3.26 KB
一键复制 编辑 原始数据 按行查看 历史
import("//build/ohos.gni")
template("python3_action") {
action(target_name) {
# Forward all variables. Ensure that testonly and visibility are forwarded
# explicitly, since this performs recursive scope lookups, which is
# required to ensure their definition from scopes above the caller are
# properly handled. All other variables are forwarded with "*", which
# doesn't perform recursive lookups at all. See https://crbug.com/862232
forward_variables_from(invoker,
[
"testonly",
"visibility",
])
forward_variables_from(invoker,
"*",
[
"testonly",
"visibility",
])
script = "//third_party/wayland_standard/python3_action.py"
_rebased_script = rebase_path(invoker.script, root_build_dir)
inputs = []
inputs = [ invoker.script ]
if (defined(invoker.inputs)) {
inputs += invoker.inputs
}
args = []
args = [ _rebased_script ]
if (defined(invoker.args)) {
args += invoker.args
}
}
}
template("wayland_protocol") {
assert(defined(invoker.sources), "Need sources for wayland_protocol template")
# Calculate the output paths.
protocol_outputs = []
output_dirs = []
foreach(protocol, invoker.sources) {
dir = "$root_gen_dir/" + rebase_path(get_path_info(protocol, "dir"), "//")
name = get_path_info(protocol, "name")
protocol_outputs += [
"${dir}/${name}-protocol.c",
"${dir}/${name}-client-protocol.h",
"${dir}/${name}-server-protocol.h",
]
output_dirs += [ dir ]
}
action_name = "${target_name}_gen"
config_name = "${target_name}_config"
source_set_name = "${target_name}"
# Action which runs wayland-scanner to generate the code.
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python3_action(action_name) {
visibility = [ ":$source_set_name" ]
script = "//third_party/wayland_standard/wayland_scanner_wrapper.py"
sources = invoker.sources
outputs = protocol_outputs
# Paths in invoker.sources are relative to the invoker.
# Make it relative to the src root.
args = rebase_path(invoker.sources, "//")
args += [
"--src-root",
rebase_path("//", root_build_dir),
]
args += [
"--root-gen-dir",
rebase_path(root_gen_dir, root_build_dir),
]
wayland_scanner_label =
"//third_party/wayland_standard:wayland_scanner($host_toolchain)"
deps = [ wayland_scanner_label ]
args += [
"--cmd",
"./" + rebase_path(get_label_info(wayland_scanner_label, "root_out_dir"),
root_build_dir) +
"/graphic/graphic_graphic_2d/wayland_scanner",
]
}
# Config to include the generated headers only with the file names.
# e.g. #include <foo-client-protocol.h>
config(config_name) {
include_dirs = output_dirs
}
# Source set which consists of the generated code.
source_set(source_set_name) {
sources = get_target_outputs(":$action_name")
public_deps = [
":$action_name",
"//third_party/wayland_standard:wayland_util",
]
public_configs = [ ":$config_name" ]
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/Goldgom/third_party_wayland_standard.git
git@gitee.com:Goldgom/third_party_wayland_standard.git
Goldgom
third_party_wayland_standard
third_party_wayland_standard
master

搜索帮助

D67c1975 1850385 1daf7b77 1850385