blob: 24b1a2eb7e37d93ebf26caef31cda9e16aad5911 [file] [log] [blame]
# Copyright 2024 Google, LLC
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice (including the next
# paragraph) shall be included in all copies or substantial portions of the
# Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
import("//build/python/python_action.gni")
import("//build/python/python_binary.gni")
import("../../../mesa.gni")
util = "$mesa_source_root/src/vulkan/util"
config("config_util") {
include_dirs = [
target_gen_dir,
util,
]
defines = [ "VK_NO_NIR=1" ]
}
mesa_source_set("util") {
public_configs = [ ":config_util" ]
public_deps = [
"$mesa_build_root/include:c_compat",
"$mesa_build_root/include:vulkan",
"$mesa_build_root/src/util",
]
sources = [
"$target_gen_dir/vk_dispatch_table.c",
"$target_gen_dir/vk_dispatch_table.h",
"$target_gen_dir/vk_enum_to_str.c",
"$target_gen_dir/vk_extensions.c",
"$target_gen_dir/vk_extensions.h",
"$util/vk_alloc.c",
"$util/vk_alloc.h",
"$util/vk_enum_to_str.h",
"$util/vk_format.c",
"$util/vk_format.h",
"$util/vk_util.c",
"$util/vk_util.h",
]
deps = [
":gen_enum_to_str",
":vk_dispatch_table",
":vk_extensions",
":vk_struct_type_cast_header",
]
}
python_binary("gen_enum_to_str_gen_bin") {
main_source = "$util/gen_enum_to_str.py"
sources = [ "$util/vk_extensions.py" ]
deps = [ "//third_party/mako" ]
}
python_action("gen_enum_to_str") {
binary_label = ":gen_enum_to_str_gen_bin"
outputs = [
"$target_gen_dir/vk_enum_to_str.h",
"$target_gen_dir/vk_enum_to_str.c",
"$target_gen_dir/vk_enum_defines.h",
]
inputs = [ mesa_vk_xml ]
args = [
"--xml",
rebase_path(mesa_vk_xml, root_build_dir),
"--outdir",
rebase_path(target_gen_dir, root_build_dir),
"--beta",
"false",
]
}
python_binary("vk_dispatch_table_gen_bin") {
main_source = "$util/vk_dispatch_table_gen.py"
sources = [
"$util/vk_entrypoints.py",
"$util/vk_extensions.py",
]
deps = [ "//third_party/mako" ]
}
python_action("vk_dispatch_table") {
binary_label = ":vk_dispatch_table_gen_bin"
h_file = "$target_gen_dir/vk_dispatch_table.h"
c_file = "$target_gen_dir/vk_dispatch_table.c"
outputs = [
h_file,
c_file,
]
script = "$util/vk_dispatch_table_gen.py"
inputs = [
"$util/vk_extensions.py",
mesa_vk_xml,
]
args = [
"--xml",
rebase_path(mesa_vk_xml, root_build_dir),
"--out-h",
rebase_path(h_file, root_build_dir),
"--out-c",
rebase_path(c_file, root_build_dir),
"--beta",
"false",
]
}
python_binary("vk_extensions_gen_bin") {
main_source = "$util/vk_extensions_gen.py"
sources = [
"$util/vk_entrypoints.py",
"$util/vk_extensions.py",
]
deps = [ "//third_party/mako" ]
}
python_action("vk_extensions") {
binary_label = ":vk_extensions_gen_bin"
h_file = "$target_gen_dir/vk_extensions.h"
c_file = "$target_gen_dir/vk_extensions.c"
outputs = [
h_file,
c_file,
]
inputs = [
"$util/vk_extensions.py",
mesa_vk_xml,
]
args = [
"--xml",
rebase_path(mesa_vk_xml, root_build_dir),
"--out-h",
rebase_path(h_file, root_build_dir),
"--out-c",
rebase_path(c_file, root_build_dir),
]
}
python_binary("vk_struct_type_cast_gen_bin") {
main_source = "$util/vk_struct_type_cast_gen.py"
sources = [
"$util/vk_entrypoints.py",
"$util/vk_extensions.py",
]
deps = [ "//third_party/mako" ]
}
python_action("vk_struct_type_cast_header") {
binary_label = ":vk_struct_type_cast_gen_bin"
outputs = [ "$target_gen_dir/vk_struct_type_cast.h" ]
inputs = [
"$util/vk_extensions.py",
mesa_vk_xml,
]
args = [
"--xml",
rebase_path(mesa_vk_xml, root_build_dir),
"--outdir",
rebase_path("$target_gen_dir", root_build_dir),
"--beta",
"false",
]
}