Ethan Nicholas | a6ae1f7 | 2017-03-16 09:56:54 -0400 | [diff] [blame] | 1 | import("../third_party.gni") |
| 2 | |
| 3 | template("spirv_core_tables") { |
| 4 | version = invoker.version |
| 5 | action("spirv_core_tables_" + target_name) { |
| 6 | script = "../externals/spirv-tools/utils/generate_grammar_tables.py" |
| 7 | sources = [ |
| 8 | "../externals/spirv-headers/include/spirv/$version/spirv.core.grammar.json", |
| 9 | ] |
| 10 | outputs = [ |
| 11 | "$root_out_dir/spirv-tools/core.insts-$version.inc", |
| 12 | "$root_out_dir/spirv-tools/operand.kinds-$version.inc", |
| 13 | ] |
| 14 | args = [ |
| 15 | "--spirv-core-grammar=" + rebase_path( |
Wei-Yin Chen (陳威尹) | 56a1e6a | 2017-05-24 00:59:19 -0700 | [diff] [blame] | 16 | "../externals/spirv-headers/include/spirv/$version/spirv.core.grammar.json", |
| 17 | root_build_dir), |
Ethan Nicholas | a6ae1f7 | 2017-03-16 09:56:54 -0400 | [diff] [blame] | 18 | "--core-insts-output=" + |
Wei-Yin Chen (陳威尹) | 56a1e6a | 2017-05-24 00:59:19 -0700 | [diff] [blame] | 19 | rebase_path("$root_out_dir/spirv-tools/core.insts-$version.inc", |
| 20 | root_build_dir), |
Ethan Nicholas | a6ae1f7 | 2017-03-16 09:56:54 -0400 | [diff] [blame] | 21 | "--operand-kinds-output=" + |
Wei-Yin Chen (陳威尹) | 56a1e6a | 2017-05-24 00:59:19 -0700 | [diff] [blame] | 22 | rebase_path("$root_out_dir/spirv-tools/operand.kinds-$version.inc", |
| 23 | root_build_dir), |
Ethan Nicholas | a6ae1f7 | 2017-03-16 09:56:54 -0400 | [diff] [blame] | 24 | ] |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | spirv_core_tables("1.0") { |
| 29 | version = "1.0" |
| 30 | } |
Ethan Nicholas | 0d67faf | 2017-07-20 10:26:28 -0400 | [diff] [blame] | 31 | |
Ethan Nicholas | a6ae1f7 | 2017-03-16 09:56:54 -0400 | [diff] [blame] | 32 | spirv_core_tables("1.1") { |
| 33 | version = "1.1" |
| 34 | } |
| 35 | |
Ethan Nicholas | 0d67faf | 2017-07-20 10:26:28 -0400 | [diff] [blame] | 36 | spirv_core_tables("1.2") { |
| 37 | version = "1.2" |
| 38 | } |
| 39 | |
Ethan Nicholas | a6ae1f7 | 2017-03-16 09:56:54 -0400 | [diff] [blame] | 40 | action("spirv_glsl_tables") { |
| 41 | script = "../externals/spirv-tools/utils/generate_grammar_tables.py" |
| 42 | sources = [ |
| 43 | "../externals/spirv-headers/include/spirv/1.0/extinst.glsl.std.450.grammar.json", |
| 44 | "../externals/spirv-headers/include/spirv/1.0/spirv.core.grammar.json", |
| 45 | ] |
| 46 | outputs = [ |
| 47 | "$root_out_dir/spirv-tools/glsl.std.450.insts-1.0.inc", |
| 48 | ] |
| 49 | args = [ |
| 50 | "--spirv-core-grammar=" + rebase_path( |
Wei-Yin Chen (陳威尹) | 56a1e6a | 2017-05-24 00:59:19 -0700 | [diff] [blame] | 51 | "../externals/spirv-headers/include/spirv/1.0/spirv.core.grammar.json", |
| 52 | root_build_dir), |
Ethan Nicholas | a6ae1f7 | 2017-03-16 09:56:54 -0400 | [diff] [blame] | 53 | "--extinst-glsl-grammar=" + |
| 54 | rebase_path("../externals/spirv-headers/include/spirv/1.0/" + |
Wei-Yin Chen (陳威尹) | 56a1e6a | 2017-05-24 00:59:19 -0700 | [diff] [blame] | 55 | "extinst.glsl.std.450.grammar.json", |
| 56 | root_build_dir), |
Ethan Nicholas | a6ae1f7 | 2017-03-16 09:56:54 -0400 | [diff] [blame] | 57 | "--glsl-insts-output=" + |
Wei-Yin Chen (陳威尹) | 56a1e6a | 2017-05-24 00:59:19 -0700 | [diff] [blame] | 58 | rebase_path("$root_out_dir/spirv-tools/glsl.std.450.insts-1.0.inc", |
| 59 | root_build_dir), |
Ethan Nicholas | a6ae1f7 | 2017-03-16 09:56:54 -0400 | [diff] [blame] | 60 | ] |
| 61 | } |
| 62 | |
Ethan Nicholas | 0d67faf | 2017-07-20 10:26:28 -0400 | [diff] [blame] | 63 | action("spirv_extension_enum") { |
| 64 | script = "../externals/spirv-tools/utils/generate_grammar_tables.py" |
| 65 | sources = [ |
| 66 | "../externals/spirv-headers/include/spirv/1.0/extinst.glsl.std.450.grammar.json", |
| 67 | "../externals/spirv-headers/include/spirv/1.0/spirv.core.grammar.json", |
| 68 | ] |
| 69 | outputs = [ |
| 70 | "$root_out_dir/spirv-tools/extension_enum.inc", |
| 71 | ] |
| 72 | args = [ |
| 73 | "--spirv-core-grammar=" + rebase_path( |
| 74 | "../externals/spirv-headers/include/spirv/1.0/spirv.core.grammar.json", |
| 75 | root_build_dir), |
| 76 | "--extension-enum-output=" + |
| 77 | rebase_path("$root_out_dir/spirv-tools/extension_enum.inc", |
| 78 | root_build_dir), |
| 79 | "--enum-string-mapping-output=" + |
| 80 | rebase_path("$root_out_dir/spirv-tools/enum_string_mapping.inc", |
| 81 | root_build_dir), |
| 82 | ] |
| 83 | } |
| 84 | |
Ethan Nicholas | a6ae1f7 | 2017-03-16 09:56:54 -0400 | [diff] [blame] | 85 | action("spirv_opencl_tables") { |
| 86 | script = "../externals/spirv-tools/utils/generate_grammar_tables.py" |
| 87 | sources = [ |
| 88 | "../externals/spirv-headers/include/spirv/1.0/extinst.opencl.std.100.grammar.json", |
| 89 | "../externals/spirv-headers/include/spirv/1.0/spirv.core.grammar.json", |
| 90 | ] |
| 91 | outputs = [ |
| 92 | "$root_out_dir/spirv-tools/opencl.std.insts-1.0.inc", |
| 93 | ] |
| 94 | args = [ |
| 95 | "--spirv-core-grammar=" + rebase_path( |
Wei-Yin Chen (陳威尹) | 56a1e6a | 2017-05-24 00:59:19 -0700 | [diff] [blame] | 96 | "../externals/spirv-headers/include/spirv/1.0/spirv.core.grammar.json", |
| 97 | root_build_dir), |
Ethan Nicholas | a6ae1f7 | 2017-03-16 09:56:54 -0400 | [diff] [blame] | 98 | "--extinst-opencl-grammar=" + |
| 99 | rebase_path("../externals/spirv-headers/include/spirv/1.0/" + |
Wei-Yin Chen (陳威尹) | 56a1e6a | 2017-05-24 00:59:19 -0700 | [diff] [blame] | 100 | "extinst.glsl.std.450.grammar.json", |
| 101 | root_build_dir), |
Ethan Nicholas | a6ae1f7 | 2017-03-16 09:56:54 -0400 | [diff] [blame] | 102 | "--opencl-insts-output=" + |
Wei-Yin Chen (陳威尹) | 56a1e6a | 2017-05-24 00:59:19 -0700 | [diff] [blame] | 103 | rebase_path("$root_out_dir/spirv-tools/opencl.std.insts-1.0.inc", |
| 104 | root_build_dir), |
Ethan Nicholas | a6ae1f7 | 2017-03-16 09:56:54 -0400 | [diff] [blame] | 105 | ] |
| 106 | } |
| 107 | |
Ethan Nicholas | 0d67faf | 2017-07-20 10:26:28 -0400 | [diff] [blame] | 108 | template("spirv_vendor_tables") { |
| 109 | vendor_table = invoker.vendor_table |
| 110 | action("spirv_vendor_tables_" + target_name) { |
| 111 | script = "../externals/spirv-tools/utils/generate_grammar_tables.py" |
| 112 | sources = [ |
| 113 | "../externals/spirv-tools/source/extinst.$vendor_table.grammar.json", |
| 114 | ] |
| 115 | outputs = [ |
| 116 | "$root_out_dir/spirv-tools/$vendor_table.insts.inc", |
| 117 | ] |
| 118 | args = [ |
| 119 | "--extinst-vendor-grammar=" + rebase_path( |
| 120 | "../externals/spirv-tools/source/extinst.$vendor_table.grammar.json", |
| 121 | root_build_dir), |
| 122 | "--vendor-insts-output=" + |
| 123 | rebase_path("$root_out_dir/spirv-tools/$vendor_table.insts.inc", |
| 124 | root_build_dir), |
| 125 | ] |
| 126 | } |
| 127 | } |
| 128 | |
| 129 | spirv_vendor_tables("amd_shader_explicit_vertex_parameter") { |
| 130 | vendor_table = "spv-amd-shader-explicit-vertex-parameter" |
| 131 | } |
| 132 | |
| 133 | spirv_vendor_tables("amd_shader_trinary_minmax") { |
| 134 | vendor_table = "spv-amd-shader-trinary-minmax" |
| 135 | } |
| 136 | |
| 137 | spirv_vendor_tables("amd_shader_gcn_shader") { |
| 138 | vendor_table = "spv-amd-gcn-shader" |
| 139 | } |
| 140 | |
| 141 | spirv_vendor_tables("amd_shader_ballot") { |
| 142 | vendor_table = "spv-amd-shader-ballot" |
| 143 | } |
| 144 | |
Ethan Nicholas | a6ae1f7 | 2017-03-16 09:56:54 -0400 | [diff] [blame] | 145 | action("spirv_build_version") { |
| 146 | script = "../externals/spirv-tools/utils/update_build_version.py" |
| 147 | sources = [ |
| 148 | "../externals/spirv-tools/CHANGES", |
| 149 | ] |
| 150 | outputs = [ |
Ethan Nicholas | 0e4e410 | 2017-09-22 17:06:35 -0400 | [diff] [blame] | 151 | "$root_out_dir/spirv-tools/build-version.inc", |
Ethan Nicholas | a6ae1f7 | 2017-03-16 09:56:54 -0400 | [diff] [blame] | 152 | ] |
| 153 | args = [ |
Wei-Yin Chen (陳威尹) | 56a1e6a | 2017-05-24 00:59:19 -0700 | [diff] [blame] | 154 | rebase_path("../externals/spirv-tools", root_build_dir), |
| 155 | rebase_path("$root_out_dir/spirv-tools/build-version.inc", root_build_dir), |
Ethan Nicholas | a6ae1f7 | 2017-03-16 09:56:54 -0400 | [diff] [blame] | 156 | ] |
| 157 | } |
| 158 | |
| 159 | action("spirv_generators") { |
| 160 | script = "../externals/spirv-tools/utils/generate_registry_tables.py" |
| 161 | sources = [ |
| 162 | "../externals/spirv-headers/include/spirv/spir-v.xml", |
| 163 | ] |
| 164 | outputs = [ |
| 165 | "$root_out_dir/spirv-tools/generators.inc", |
| 166 | ] |
| 167 | args = [ |
| 168 | "--xml=" + |
Wei-Yin Chen (陳威尹) | 56a1e6a | 2017-05-24 00:59:19 -0700 | [diff] [blame] | 169 | rebase_path("../externals/spirv-headers/include/spirv/spir-v.xml", |
| 170 | root_build_dir), |
Ethan Nicholas | a6ae1f7 | 2017-03-16 09:56:54 -0400 | [diff] [blame] | 171 | "--generator-output=" + |
Wei-Yin Chen (陳威尹) | 56a1e6a | 2017-05-24 00:59:19 -0700 | [diff] [blame] | 172 | rebase_path("$root_out_dir/spirv-tools/generators.inc", |
| 173 | root_build_dir, |
| 174 | root_build_dir), |
Ethan Nicholas | a6ae1f7 | 2017-03-16 09:56:54 -0400 | [diff] [blame] | 175 | ] |
| 176 | } |
| 177 | |
| 178 | third_party("spirv-tools") { |
| 179 | public_include_dirs = [ |
| 180 | "../externals/spirv-tools/include", |
| 181 | "../externals/spirv-tools/source", |
| 182 | "$root_out_dir/spirv-tools", |
| 183 | ] |
| 184 | deps = [ |
| 185 | ":spirv_build_version", |
| 186 | ":spirv_core_tables_1.0", |
| 187 | ":spirv_core_tables_1.1", |
Ethan Nicholas | 0d67faf | 2017-07-20 10:26:28 -0400 | [diff] [blame] | 188 | ":spirv_core_tables_1.2", |
| 189 | ":spirv_extension_enum", |
Ethan Nicholas | dc3c336 | 2017-03-16 12:16:20 -0400 | [diff] [blame] | 190 | ":spirv_generators", |
Ethan Nicholas | a6ae1f7 | 2017-03-16 09:56:54 -0400 | [diff] [blame] | 191 | ":spirv_glsl_tables", |
| 192 | ":spirv_opencl_tables", |
Ethan Nicholas | 0d67faf | 2017-07-20 10:26:28 -0400 | [diff] [blame] | 193 | ":spirv_vendor_tables_amd_shader_ballot", |
| 194 | ":spirv_vendor_tables_amd_shader_explicit_vertex_parameter", |
| 195 | ":spirv_vendor_tables_amd_shader_gcn_shader", |
| 196 | ":spirv_vendor_tables_amd_shader_trinary_minmax", |
Ethan Nicholas | a6ae1f7 | 2017-03-16 09:56:54 -0400 | [diff] [blame] | 197 | "//third_party/spirv-headers", |
| 198 | ] |
| 199 | sources = [ |
| 200 | "../externals/spirv-tools/source/assembly_grammar.cpp", |
| 201 | "../externals/spirv-tools/source/binary.cpp", |
| 202 | "../externals/spirv-tools/source/diagnostic.cpp", |
| 203 | "../externals/spirv-tools/source/disassemble.cpp", |
Ethan Nicholas | 0d67faf | 2017-07-20 10:26:28 -0400 | [diff] [blame] | 204 | "../externals/spirv-tools/source/enum_string_mapping.cpp", |
Ethan Nicholas | a6ae1f7 | 2017-03-16 09:56:54 -0400 | [diff] [blame] | 205 | "../externals/spirv-tools/source/ext_inst.cpp", |
| 206 | "../externals/spirv-tools/source/extensions.cpp", |
| 207 | "../externals/spirv-tools/source/libspirv.cpp", |
| 208 | "../externals/spirv-tools/source/message.cpp", |
| 209 | "../externals/spirv-tools/source/name_mapper.cpp", |
| 210 | "../externals/spirv-tools/source/opcode.cpp", |
| 211 | "../externals/spirv-tools/source/operand.cpp", |
Ethan Nicholas | 0d67faf | 2017-07-20 10:26:28 -0400 | [diff] [blame] | 212 | "../externals/spirv-tools/source/opt/aggressive_dead_code_elim_pass.cpp", |
| 213 | "../externals/spirv-tools/source/opt/basic_block.cpp", |
| 214 | "../externals/spirv-tools/source/opt/block_merge_pass.cpp", |
Ethan Nicholas | a6ae1f7 | 2017-03-16 09:56:54 -0400 | [diff] [blame] | 215 | "../externals/spirv-tools/source/opt/build_module.cpp", |
Ethan Nicholas | 0d67faf | 2017-07-20 10:26:28 -0400 | [diff] [blame] | 216 | "../externals/spirv-tools/source/opt/compact_ids_pass.cpp", |
| 217 | "../externals/spirv-tools/source/opt/dead_branch_elim_pass.cpp", |
Ethan Nicholas | a6ae1f7 | 2017-03-16 09:56:54 -0400 | [diff] [blame] | 218 | "../externals/spirv-tools/source/opt/def_use_manager.cpp", |
| 219 | "../externals/spirv-tools/source/opt/eliminate_dead_constant_pass.cpp", |
Ethan Nicholas | 0d67faf | 2017-07-20 10:26:28 -0400 | [diff] [blame] | 220 | "../externals/spirv-tools/source/opt/flatten_decoration_pass.cpp", |
Ethan Nicholas | a6ae1f7 | 2017-03-16 09:56:54 -0400 | [diff] [blame] | 221 | "../externals/spirv-tools/source/opt/fold_spec_constant_op_and_composite_pass.cpp", |
| 222 | "../externals/spirv-tools/source/opt/freeze_spec_constant_value_pass.cpp", |
| 223 | "../externals/spirv-tools/source/opt/function.cpp", |
Ethan Nicholas | 0d67faf | 2017-07-20 10:26:28 -0400 | [diff] [blame] | 224 | "../externals/spirv-tools/source/opt/inline_pass.cpp", |
| 225 | "../externals/spirv-tools/source/opt/insert_extract_elim.cpp", |
Ethan Nicholas | a6ae1f7 | 2017-03-16 09:56:54 -0400 | [diff] [blame] | 226 | "../externals/spirv-tools/source/opt/instruction.cpp", |
| 227 | "../externals/spirv-tools/source/opt/ir_loader.cpp", |
Ethan Nicholas | 0d67faf | 2017-07-20 10:26:28 -0400 | [diff] [blame] | 228 | "../externals/spirv-tools/source/opt/local_access_chain_convert_pass.cpp", |
| 229 | "../externals/spirv-tools/source/opt/local_single_block_elim_pass.cpp", |
| 230 | "../externals/spirv-tools/source/opt/local_single_store_elim_pass.cpp", |
| 231 | "../externals/spirv-tools/source/opt/local_ssa_elim_pass.cpp", |
Ethan Nicholas | a6ae1f7 | 2017-03-16 09:56:54 -0400 | [diff] [blame] | 232 | "../externals/spirv-tools/source/opt/module.cpp", |
| 233 | "../externals/spirv-tools/source/opt/optimizer.cpp", |
| 234 | "../externals/spirv-tools/source/opt/pass_manager.cpp", |
| 235 | "../externals/spirv-tools/source/opt/set_spec_constant_default_value_pass.cpp", |
| 236 | "../externals/spirv-tools/source/opt/strip_debug_info_pass.cpp", |
| 237 | "../externals/spirv-tools/source/opt/type_manager.cpp", |
| 238 | "../externals/spirv-tools/source/opt/types.cpp", |
| 239 | "../externals/spirv-tools/source/opt/unify_const_pass.cpp", |
| 240 | "../externals/spirv-tools/source/parsed_operand.cpp", |
| 241 | "../externals/spirv-tools/source/print.cpp", |
| 242 | "../externals/spirv-tools/source/software_version.cpp", |
| 243 | "../externals/spirv-tools/source/spirv_endian.cpp", |
| 244 | "../externals/spirv-tools/source/spirv_target_env.cpp", |
| 245 | "../externals/spirv-tools/source/spirv_validator_options.cpp", |
| 246 | "../externals/spirv-tools/source/table.cpp", |
| 247 | "../externals/spirv-tools/source/text.cpp", |
| 248 | "../externals/spirv-tools/source/text_handler.cpp", |
| 249 | "../externals/spirv-tools/source/util/parse_number.cpp", |
Ethan Nicholas | 0d67faf | 2017-07-20 10:26:28 -0400 | [diff] [blame] | 250 | "../externals/spirv-tools/source/util/string_utils.cpp", |
Ethan Nicholas | a6ae1f7 | 2017-03-16 09:56:54 -0400 | [diff] [blame] | 251 | "../externals/spirv-tools/source/val/basic_block.cpp", |
| 252 | "../externals/spirv-tools/source/val/construct.cpp", |
| 253 | "../externals/spirv-tools/source/val/function.cpp", |
| 254 | "../externals/spirv-tools/source/val/instruction.cpp", |
| 255 | "../externals/spirv-tools/source/val/validation_state.cpp", |
| 256 | "../externals/spirv-tools/source/validate.cpp", |
Ethan Nicholas | 0d67faf | 2017-07-20 10:26:28 -0400 | [diff] [blame] | 257 | "../externals/spirv-tools/source/validate_capability.cpp", |
Ethan Nicholas | a6ae1f7 | 2017-03-16 09:56:54 -0400 | [diff] [blame] | 258 | "../externals/spirv-tools/source/validate_cfg.cpp", |
| 259 | "../externals/spirv-tools/source/validate_datarules.cpp", |
| 260 | "../externals/spirv-tools/source/validate_decorations.cpp", |
| 261 | "../externals/spirv-tools/source/validate_id.cpp", |
| 262 | "../externals/spirv-tools/source/validate_instruction.cpp", |
| 263 | "../externals/spirv-tools/source/validate_layout.cpp", |
| 264 | "../externals/spirv-tools/source/validate_type_unique.cpp", |
| 265 | ] |
| 266 | } |