1# Copyright 2024 Google, LLC 2# 3# Permission is hereby granted, free of charge, to any person obtaining a 4# copy of this software and associated documentation files (the "Software"), 5# to deal in the Software without restriction, including without limitation 6# the rights to use, copy, modify, merge, publish, distribute, sublicense, 7# and/or sell copies of the Software, and to permit persons to whom the 8# Software is furnished to do so, subject to the following conditions: 9# 10# The above copyright notice and this permission notice (including the next 11# paragraph) shall be included in all copies or substantial portions of the 12# Software. 13# 14# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20# IN THE SOFTWARE. 21 22import("//build/python/python_action.gni") 23import("//build/python/python_binary.gni") 24import("../../../mesa.gni") 25 26util = "$mesa_source_root/src/vulkan/util" 27 28config("config_util") { 29 include_dirs = [ 30 target_gen_dir, 31 util, 32 ] 33 34 defines = [ "VK_NO_NIR=1" ] 35} 36 37mesa_source_set("util") { 38 public_configs = [ ":config_util" ] 39 40 public_deps = [ 41 "$mesa_build_root/include:c_compat", 42 "$mesa_build_root/include:vulkan", 43 "$mesa_build_root/src/util", 44 ] 45 46 sources = [ 47 "$target_gen_dir/vk_dispatch_table.c", 48 "$target_gen_dir/vk_dispatch_table.h", 49 "$target_gen_dir/vk_enum_to_str.c", 50 "$target_gen_dir/vk_extensions.c", 51 "$target_gen_dir/vk_extensions.h", 52 "$util/vk_alloc.c", 53 "$util/vk_alloc.h", 54 "$util/vk_enum_to_str.h", 55 "$util/vk_format.c", 56 "$util/vk_format.h", 57 "$util/vk_util.c", 58 "$util/vk_util.h", 59 ] 60 61 deps = [ 62 ":gen_enum_to_str", 63 ":vk_dispatch_table", 64 ":vk_extensions", 65 ":vk_struct_type_cast_header", 66 ] 67} 68 69python_binary("gen_enum_to_str_gen_bin") { 70 main_source = "$util/gen_enum_to_str.py" 71 72 sources = [ "$util/vk_extensions.py" ] 73 deps = [ "//third_party/mako" ] 74} 75 76python_action("gen_enum_to_str") { 77 binary_label = ":gen_enum_to_str_gen_bin" 78 79 outputs = [ 80 "$target_gen_dir/vk_enum_to_str.h", 81 "$target_gen_dir/vk_enum_to_str.c", 82 "$target_gen_dir/vk_enum_defines.h", 83 ] 84 85 inputs = [ mesa_vk_xml ] 86 87 args = [ 88 "--xml", 89 rebase_path(mesa_vk_xml, root_build_dir), 90 "--outdir", 91 rebase_path(target_gen_dir, root_build_dir), 92 "--beta", 93 "false", 94 ] 95} 96 97python_binary("vk_dispatch_table_gen_bin") { 98 main_source = "$util/vk_dispatch_table_gen.py" 99 100 sources = [ 101 "$util/vk_entrypoints.py", 102 "$util/vk_extensions.py", 103 ] 104 deps = [ "//third_party/mako" ] 105} 106 107python_action("vk_dispatch_table") { 108 binary_label = ":vk_dispatch_table_gen_bin" 109 110 h_file = "$target_gen_dir/vk_dispatch_table.h" 111 c_file = "$target_gen_dir/vk_dispatch_table.c" 112 113 outputs = [ 114 h_file, 115 c_file, 116 ] 117 118 script = "$util/vk_dispatch_table_gen.py" 119 120 inputs = [ 121 "$util/vk_extensions.py", 122 mesa_vk_xml, 123 ] 124 125 args = [ 126 "--xml", 127 rebase_path(mesa_vk_xml, root_build_dir), 128 "--out-h", 129 rebase_path(h_file, root_build_dir), 130 "--out-c", 131 rebase_path(c_file, root_build_dir), 132 "--beta", 133 "false", 134 ] 135} 136 137python_binary("vk_extensions_gen_bin") { 138 main_source = "$util/vk_extensions_gen.py" 139 140 sources = [ 141 "$util/vk_entrypoints.py", 142 "$util/vk_extensions.py", 143 ] 144 deps = [ "//third_party/mako" ] 145} 146 147python_action("vk_extensions") { 148 binary_label = ":vk_extensions_gen_bin" 149 150 h_file = "$target_gen_dir/vk_extensions.h" 151 c_file = "$target_gen_dir/vk_extensions.c" 152 153 outputs = [ 154 h_file, 155 c_file, 156 ] 157 158 inputs = [ 159 "$util/vk_extensions.py", 160 mesa_vk_xml, 161 ] 162 163 args = [ 164 "--xml", 165 rebase_path(mesa_vk_xml, root_build_dir), 166 "--out-h", 167 rebase_path(h_file, root_build_dir), 168 "--out-c", 169 rebase_path(c_file, root_build_dir), 170 ] 171} 172 173python_binary("vk_struct_type_cast_gen_bin") { 174 main_source = "$util/vk_struct_type_cast_gen.py" 175 176 sources = [ 177 "$util/vk_entrypoints.py", 178 "$util/vk_extensions.py", 179 ] 180 deps = [ "//third_party/mako" ] 181} 182 183python_action("vk_struct_type_cast_header") { 184 binary_label = ":vk_struct_type_cast_gen_bin" 185 186 outputs = [ "$target_gen_dir/vk_struct_type_cast.h" ] 187 188 inputs = [ 189 "$util/vk_extensions.py", 190 mesa_vk_xml, 191 ] 192 193 args = [ 194 "--xml", 195 rebase_path(mesa_vk_xml, root_build_dir), 196 "--outdir", 197 rebase_path("$target_gen_dir", root_build_dir), 198 "--beta", 199 "false", 200 ] 201} 202