xref: /aosp_15_r20/external/angle/third_party/spirv-tools/src/BUILD.gn (revision 8975f5c5ed3d1c378011245431ada316dfb6f244)
1# Copyright 2018 Google Inc. All rights reserved.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#     http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15import("//build_overrides/build.gni")
16import("//build_overrides/spirv_tools.gni")
17if (build_with_chromium) {
18  import("//testing/test.gni")
19  import("//third_party/protobuf/proto_library.gni")
20}
21
22# SPIRV-Tools may be part of multiple projects in the Chromium tree.
23# Only enable building executables if this is the main copy.
24abspath = get_path_info(".", "abspath")
25spvtools_chromium_third_party = (abspath == "//third_party/vulkan-deps/spirv-tools/src/")
26spvtools_build_executables = build_with_chromium && spvtools_chromium_third_party
27# Fuchsia also requires building the executables.
28# TODO(b/158002593): Avoid the use of dependent-specific variables.
29if (defined(is_fuchsia_tree) && is_fuchsia_tree) {
30  spvtools_build_executables = true
31}
32
33spirv_headers = spirv_tools_spirv_headers_dir
34spirv_is_winuwp = is_win && target_os == "winuwp"
35
36template("spvtools_core_tables") {
37  assert(defined(invoker.version), "Need version in $target_name generation.")
38
39  action("spvtools_core_tables_" + target_name) {
40    script = "utils/generate_grammar_tables.py"
41
42    version = invoker.version
43
44    core_json_file =
45        "${spirv_headers}/include/spirv/$version/spirv.core.grammar.json"
46    core_insts_file = "${target_gen_dir}/core.insts-$version.inc"
47    operand_kinds_file = "${target_gen_dir}/operand.kinds-$version.inc"
48    debuginfo_insts_file =
49        "${spirv_headers}/include/spirv/unified1/extinst.debuginfo.grammar.json"
50    cldebuginfo100_insts_file = "${spirv_headers}/include/spirv/unified1/extinst.opencl.debuginfo.100.grammar.json"
51
52    sources = [
53      cldebuginfo100_insts_file,
54      core_json_file,
55      debuginfo_insts_file,
56    ]
57    outputs = [
58      core_insts_file,
59      operand_kinds_file,
60    ]
61    args = [
62      "--spirv-core-grammar",
63      rebase_path(core_json_file, root_build_dir),
64      "--core-insts-output",
65      rebase_path(core_insts_file, root_build_dir),
66      "--extinst-debuginfo-grammar",
67      rebase_path(debuginfo_insts_file, root_build_dir),
68      "--extinst-cldebuginfo100-grammar",
69      rebase_path(cldebuginfo100_insts_file, root_build_dir),
70      "--operand-kinds-output",
71      rebase_path(operand_kinds_file, root_build_dir),
72      "--output-language",
73      "c++"
74    ]
75  }
76}
77
78template("spvtools_core_enums") {
79  assert(defined(invoker.version), "Need version in $target_name generation.")
80
81  action("spvtools_core_enums_" + target_name) {
82    script = "utils/generate_grammar_tables.py"
83
84    version = invoker.version
85
86    core_json_file =
87        "${spirv_headers}/include/spirv/$version/spirv.core.grammar.json"
88    debuginfo_insts_file =
89        "${spirv_headers}/include/spirv/unified1/extinst.debuginfo.grammar.json"
90    cldebuginfo100_insts_file = "${spirv_headers}/include/spirv/unified1/extinst.opencl.debuginfo.100.grammar.json"
91
92    extension_enum_file = "${target_gen_dir}/extension_enum.inc"
93    extension_map_file = "${target_gen_dir}/enum_string_mapping.inc"
94
95    args = [
96      "--spirv-core-grammar",
97      rebase_path(core_json_file, root_build_dir),
98      "--extinst-debuginfo-grammar",
99      rebase_path(debuginfo_insts_file, root_build_dir),
100      "--extinst-cldebuginfo100-grammar",
101      rebase_path(cldebuginfo100_insts_file, root_build_dir),
102      "--extension-enum-output",
103      rebase_path(extension_enum_file, root_build_dir),
104      "--enum-string-mapping-output",
105      rebase_path(extension_map_file, root_build_dir),
106      "--output-language",
107      "c++"
108    ]
109    inputs = [
110      core_json_file,
111      debuginfo_insts_file,
112      cldebuginfo100_insts_file,
113    ]
114    outputs = [
115      extension_enum_file,
116      extension_map_file,
117    ]
118  }
119}
120
121template("spvtools_glsl_tables") {
122  assert(defined(invoker.version), "Need version in $target_name generation.")
123
124  action("spvtools_glsl_tables_" + target_name) {
125    script = "utils/generate_grammar_tables.py"
126
127    version = invoker.version
128
129    core_json_file =
130        "${spirv_headers}/include/spirv/$version/spirv.core.grammar.json"
131    glsl_json_file = "${spirv_headers}/include/spirv/${version}/extinst.glsl.std.450.grammar.json"
132    debuginfo_insts_file =
133        "${spirv_headers}/include/spirv/unified1/extinst.debuginfo.grammar.json"
134    cldebuginfo100_insts_file = "${spirv_headers}/include/spirv/unified1/extinst.opencl.debuginfo.100.grammar.json"
135
136    glsl_insts_file = "${target_gen_dir}/glsl.std.450.insts.inc"
137
138    args = [
139      "--spirv-core-grammar",
140      rebase_path(core_json_file, root_build_dir),
141      "--extinst-debuginfo-grammar",
142      rebase_path(debuginfo_insts_file, root_build_dir),
143      "--extinst-cldebuginfo100-grammar",
144      rebase_path(cldebuginfo100_insts_file, root_build_dir),
145      "--extinst-glsl-grammar",
146      rebase_path(glsl_json_file, root_build_dir),
147      "--glsl-insts-output",
148      rebase_path(glsl_insts_file, root_build_dir),
149      "--output-language",
150      "c++"
151    ]
152    inputs = [
153      core_json_file,
154      glsl_json_file,
155      debuginfo_insts_file,
156      cldebuginfo100_insts_file,
157    ]
158    outputs = [ glsl_insts_file ]
159  }
160}
161
162template("spvtools_opencl_tables") {
163  assert(defined(invoker.version), "Need version in $target_name generation.")
164
165  action("spvtools_opencl_tables_" + target_name) {
166    script = "utils/generate_grammar_tables.py"
167
168    version = invoker.version
169
170    core_json_file =
171        "${spirv_headers}/include/spirv/$version/spirv.core.grammar.json"
172    opencl_json_file = "${spirv_headers}/include/spirv/${version}/extinst.opencl.std.100.grammar.json"
173    debuginfo_insts_file =
174        "${spirv_headers}/include/spirv/unified1/extinst.debuginfo.grammar.json"
175    cldebuginfo100_insts_file = "${spirv_headers}/include/spirv/unified1/extinst.opencl.debuginfo.100.grammar.json"
176
177    opencl_insts_file = "${target_gen_dir}/opencl.std.insts.inc"
178
179    args = [
180      "--spirv-core-grammar",
181      rebase_path(core_json_file, root_build_dir),
182      "--extinst-debuginfo-grammar",
183      rebase_path(debuginfo_insts_file, root_build_dir),
184      "--extinst-cldebuginfo100-grammar",
185      rebase_path(cldebuginfo100_insts_file, root_build_dir),
186      "--extinst-opencl-grammar",
187      rebase_path(opencl_json_file, root_build_dir),
188      "--opencl-insts-output",
189      rebase_path(opencl_insts_file, root_build_dir),
190    ]
191    inputs = [
192      core_json_file,
193      opencl_json_file,
194      debuginfo_insts_file,
195      cldebuginfo100_insts_file,
196    ]
197    outputs = [ opencl_insts_file ]
198  }
199}
200
201template("spvtools_language_header") {
202  assert(defined(invoker.name), "Need name in $target_name generation.")
203
204  action("spvtools_language_header_" + target_name) {
205    script = "utils/generate_language_headers.py"
206
207    name = invoker.name
208    extinst_output_path = "${target_gen_dir}/${name}.h"
209
210    args = [
211      "--extinst-grammar",
212      rebase_path(invoker.grammar_file, root_build_dir),
213      "--extinst-output-path",
214      rebase_path(extinst_output_path, root_build_dir),
215    ]
216    inputs = [ invoker.grammar_file ]
217    outputs = [ "${extinst_output_path}" ]
218  }
219}
220
221template("spvtools_vendor_table") {
222  assert(defined(invoker.name), "Need name in $target_name generation.")
223
224  action("spvtools_vendor_tables_" + target_name) {
225    script = "utils/generate_grammar_tables.py"
226
227    name = invoker.name
228    extinst_vendor_grammar =
229        "${spirv_headers}/include/spirv/unified1/extinst.${name}.grammar.json"
230    extinst_file = "${target_gen_dir}/${name}.insts.inc"
231
232    args = [
233      "--extinst-vendor-grammar",
234      rebase_path(extinst_vendor_grammar, root_build_dir),
235      "--vendor-insts-output",
236      rebase_path(extinst_file, root_build_dir),
237      "--vendor-operand-kind-prefix",
238      invoker.operand_kind_prefix,
239    ]
240    inputs = [ extinst_vendor_grammar ]
241    outputs = [ extinst_file ]
242  }
243}
244
245action("spvtools_generators_inc") {
246  script = "utils/generate_registry_tables.py"
247
248  # TODO(dsinclair): Make work for chrome
249  xml_file = "${spirv_headers}/include/spirv/spir-v.xml"
250  inc_file = "${target_gen_dir}/generators.inc"
251
252  sources = [ xml_file ]
253  outputs = [ inc_file ]
254  args = [
255    "--xml",
256    rebase_path(xml_file, root_build_dir),
257    "--generator",
258    rebase_path(inc_file, root_build_dir),
259  ]
260}
261
262action("spvtools_build_version") {
263  script = "utils/update_build_version.py"
264
265  changes_file = "CHANGES"
266  inc_file = "${target_gen_dir}/build-version.inc"
267
268  outputs = [ inc_file ]
269  args = [
270    rebase_path(changes_file, root_build_dir),
271    rebase_path(inc_file, root_build_dir),
272  ]
273}
274
275spvtools_core_tables("unified1") {
276  version = "unified1"
277}
278spvtools_core_enums("unified1") {
279  version = "unified1"
280}
281spvtools_glsl_tables("glsl1-0") {
282  version = "1.0"
283}
284spvtools_opencl_tables("opencl1-0") {
285  version = "1.0"
286}
287spvtools_language_header("debuginfo") {
288  name = "DebugInfo"
289  grammar_file =
290      "${spirv_headers}/include/spirv/unified1/extinst.debuginfo.grammar.json"
291}
292spvtools_language_header("cldebuginfo100") {
293  name = "OpenCLDebugInfo100"
294  grammar_file = "${spirv_headers}/include/spirv/unified1/extinst.opencl.debuginfo.100.grammar.json"
295}
296spvtools_language_header("vkdebuginfo100") {
297  name = "NonSemanticShaderDebugInfo100"
298  grammar_file = "${spirv_headers}/include/spirv/unified1/extinst.nonsemantic.shader.debuginfo.100.grammar.json"
299}
300
301spvtools_vendor_tables = [
302  [
303    "spv-amd-shader-explicit-vertex-parameter",
304    "...nil...",
305  ],
306  [
307    "spv-amd-shader-trinary-minmax",
308    "...nil...",
309  ],
310  [
311    "spv-amd-gcn-shader",
312    "...nil...",
313  ],
314  [
315    "spv-amd-shader-ballot",
316    "...nil...",
317  ],
318  [
319    "debuginfo",
320    "...nil...",
321  ],
322  [
323    "opencl.debuginfo.100",
324    "CLDEBUG100_",
325  ],
326  [
327    "nonsemantic.clspvreflection",
328    "...nil...",
329  ],
330  [
331    "nonsemantic.vkspreflection",
332    "...nil...",
333  ],
334  [
335    "nonsemantic.shader.debuginfo.100",
336    "SHDEBUG100_",
337  ],
338]
339
340foreach(table_def, spvtools_vendor_tables) {
341  spvtools_vendor_table(table_def[0]) {
342    name = table_def[0]
343    operand_kind_prefix = table_def[1]
344  }
345}
346
347config("spvtools_public_config") {
348  include_dirs = [ "include" ]
349}
350
351config("spvtools_include_gen_dirs") {
352  include_dirs = [ "$target_gen_dir" ]
353}
354
355config("spvtools_internal_config") {
356  include_dirs = [
357    ".",
358    "${spirv_headers}/include",
359  ]
360
361  configs = [
362    ":spvtools_public_config",
363    ":spvtools_include_gen_dirs",
364  ]
365
366  cflags = []
367  if (is_clang) {
368    cflags += [
369      "-Wno-implicit-fallthrough",
370      "-Wno-newline-eof",
371      "-Wno-unreachable-code-break",
372      "-Wno-unreachable-code-return",
373    ]
374  } else if (!is_win) {
375    # Work around a false-positive on a Skia GCC 10 builder.
376    cflags += [ "-Wno-format-truncation" ]
377  } else {
378    # Make MSVC report the correct value for __cplusplus
379    cflags += [ "/Zc:__cplusplus" ]
380  }
381
382  if (!is_win) {
383    cflags += [ "-std=c++17" ]
384  } else {
385    cflags += [ "/std:c++17" ]
386  }
387}
388
389source_set("spvtools_headers") {
390  sources = [
391    "include/spirv-tools/libspirv.h",
392    "include/spirv-tools/libspirv.hpp",
393    "include/spirv-tools/linker.hpp",
394    "include/spirv-tools/optimizer.hpp",
395  ]
396
397  public_configs = [ ":spvtools_public_config" ]
398}
399
400group("spvtools_language_headers") {
401  public_deps = [
402    ":spvtools_language_header_cldebuginfo100",
403    ":spvtools_language_header_debuginfo",
404    ":spvtools_language_header_vkdebuginfo100",
405  ]
406}
407
408static_library("spvtools") {
409  deps = [
410    ":spvtools_core_tables_unified1",
411    ":spvtools_generators_inc",
412    ":spvtools_glsl_tables_glsl1-0",
413    ":spvtools_language_header_cldebuginfo100",
414    ":spvtools_language_header_debuginfo",
415    ":spvtools_language_header_vkdebuginfo100",
416    ":spvtools_opencl_tables_opencl1-0",
417  ]
418  foreach(table_def, spvtools_vendor_tables) {
419    target_name = table_def[0]
420    deps += [ ":spvtools_vendor_tables_$target_name" ]
421  }
422
423  sources = [
424    "source/assembly_grammar.cpp",
425    "source/assembly_grammar.h",
426    "source/binary.cpp",
427    "source/binary.h",
428    "source/cfa.h",
429    "source/common_debug_info.h",
430    "source/diagnostic.cpp",
431    "source/diagnostic.h",
432    "source/disassemble.cpp",
433    "source/disassemble.h",
434    "source/enum_set.h",
435    "source/enum_string_mapping.cpp",
436    "source/enum_string_mapping.h",
437    "source/ext_inst.cpp",
438    "source/ext_inst.h",
439    "source/extensions.cpp",
440    "source/extensions.h",
441    "source/instruction.h",
442    "source/latest_version_glsl_std_450_header.h",
443    "source/latest_version_opencl_std_header.h",
444    "source/latest_version_spirv_header.h",
445    "source/libspirv.cpp",
446    "source/macro.h",
447    "source/name_mapper.cpp",
448    "source/name_mapper.h",
449    "source/opcode.cpp",
450    "source/opcode.h",
451    "source/operand.cpp",
452    "source/operand.h",
453    "source/parsed_operand.cpp",
454    "source/parsed_operand.h",
455    "source/print.cpp",
456    "source/print.h",
457    "source/spirv_constant.h",
458    "source/spirv_definition.h",
459    "source/spirv_endian.cpp",
460    "source/spirv_endian.h",
461    "source/spirv_fuzzer_options.cpp",
462    "source/spirv_fuzzer_options.h",
463    "source/spirv_optimizer_options.cpp",
464    "source/spirv_optimizer_options.h",
465    "source/spirv_reducer_options.cpp",
466    "source/spirv_reducer_options.h",
467    "source/spirv_target_env.cpp",
468    "source/spirv_target_env.h",
469    "source/spirv_validator_options.cpp",
470    "source/spirv_validator_options.h",
471    "source/table.cpp",
472    "source/table.h",
473    "source/text.cpp",
474    "source/text.h",
475    "source/text_handler.cpp",
476    "source/text_handler.h",
477    "source/to_string.cpp",
478    "source/to_string.h",
479    "source/util/bit_vector.cpp",
480    "source/util/bit_vector.h",
481    "source/util/bitutils.h",
482    "source/util/hash_combine.h",
483    "source/util/hex_float.h",
484    "source/util/ilist.h",
485    "source/util/ilist_node.h",
486    "source/util/make_unique.h",
487    "source/util/parse_number.cpp",
488    "source/util/parse_number.h",
489    "source/util/small_vector.h",
490    "source/util/string_utils.cpp",
491    "source/util/string_utils.h",
492    "source/util/timer.cpp",
493    "source/util/timer.h",
494  ]
495
496  public_deps = [
497    ":spvtools_core_enums_unified1",
498    ":spvtools_headers",
499    "${spirv_headers}:spv_headers",
500  ]
501
502  if (build_with_chromium) {
503    configs -= [ "//build/config/compiler:chromium_code" ]
504    configs += [ "//build/config/compiler:no_chromium_code" ]
505  }
506  configs += [ ":spvtools_internal_config" ]
507}
508
509static_library("spvtools_val") {
510  sources = [
511    "source/val/basic_block.cpp",
512    "source/val/basic_block.h",
513    "source/val/construct.cpp",
514    "source/val/construct.h",
515    "source/val/decoration.h",
516    "source/val/function.cpp",
517    "source/val/function.h",
518    "source/val/instruction.cpp",
519    "source/val/validate.cpp",
520    "source/val/validate.h",
521    "source/val/validate_adjacency.cpp",
522    "source/val/validate_annotation.cpp",
523    "source/val/validate_arithmetics.cpp",
524    "source/val/validate_atomics.cpp",
525    "source/val/validate_barriers.cpp",
526    "source/val/validate_bitwise.cpp",
527    "source/val/validate_builtins.cpp",
528    "source/val/validate_capability.cpp",
529    "source/val/validate_cfg.cpp",
530    "source/val/validate_composites.cpp",
531    "source/val/validate_constants.cpp",
532    "source/val/validate_conversion.cpp",
533    "source/val/validate_debug.cpp",
534    "source/val/validate_decorations.cpp",
535    "source/val/validate_derivatives.cpp",
536    "source/val/validate_execution_limitations.cpp",
537    "source/val/validate_extensions.cpp",
538    "source/val/validate_function.cpp",
539    "source/val/validate_id.cpp",
540    "source/val/validate_image.cpp",
541    "source/val/validate_instruction.cpp",
542    "source/val/validate_interfaces.cpp",
543    "source/val/validate_layout.cpp",
544    "source/val/validate_literals.cpp",
545    "source/val/validate_logicals.cpp",
546    "source/val/validate_memory.cpp",
547    "source/val/validate_memory_semantics.cpp",
548    "source/val/validate_memory_semantics.h",
549    "source/val/validate_mesh_shading.cpp",
550    "source/val/validate_misc.cpp",
551    "source/val/validate_mode_setting.cpp",
552    "source/val/validate_non_uniform.cpp",
553    "source/val/validate_primitives.cpp",
554    "source/val/validate_ray_query.cpp",
555    "source/val/validate_ray_tracing.cpp",
556    "source/val/validate_ray_tracing_reorder.cpp",
557    "source/val/validate_scopes.cpp",
558    "source/val/validate_scopes.h",
559    "source/val/validate_small_type_uses.cpp",
560    "source/val/validate_tensor_layout.cpp",
561    "source/val/validate_type.cpp",
562    "source/val/validation_state.cpp",
563    "source/val/validation_state.h",
564  ]
565
566  deps = [
567    ":spvtools",
568    ":spvtools_language_header_cldebuginfo100",
569    ":spvtools_language_header_debuginfo",
570    ":spvtools_language_header_vkdebuginfo100",
571  ]
572  public_deps = [ ":spvtools_headers" ]
573
574  if (build_with_chromium) {
575    configs -= [ "//build/config/compiler:chromium_code" ]
576    configs += [ "//build/config/compiler:no_chromium_code" ]
577  }
578  configs += [ ":spvtools_internal_config" ]
579}
580
581static_library("spvtools_opt") {
582  sources = [
583    "source/opt/aggressive_dead_code_elim_pass.cpp",
584    "source/opt/aggressive_dead_code_elim_pass.h",
585    "source/opt/amd_ext_to_khr.cpp",
586    "source/opt/amd_ext_to_khr.h",
587    "source/opt/analyze_live_input_pass.cpp",
588    "source/opt/analyze_live_input_pass.h",
589    "source/opt/basic_block.cpp",
590    "source/opt/basic_block.h",
591    "source/opt/block_merge_pass.cpp",
592    "source/opt/block_merge_pass.h",
593    "source/opt/block_merge_util.cpp",
594    "source/opt/block_merge_util.h",
595    "source/opt/build_module.cpp",
596    "source/opt/build_module.h",
597    "source/opt/ccp_pass.cpp",
598    "source/opt/ccp_pass.h",
599    "source/opt/cfg.cpp",
600    "source/opt/cfg.h",
601    "source/opt/cfg_cleanup_pass.cpp",
602    "source/opt/cfg_cleanup_pass.h",
603    "source/opt/code_sink.cpp",
604    "source/opt/code_sink.h",
605    "source/opt/combine_access_chains.cpp",
606    "source/opt/combine_access_chains.h",
607    "source/opt/compact_ids_pass.cpp",
608    "source/opt/compact_ids_pass.h",
609    "source/opt/composite.cpp",
610    "source/opt/composite.h",
611    "source/opt/const_folding_rules.cpp",
612    "source/opt/const_folding_rules.h",
613    "source/opt/constants.cpp",
614    "source/opt/constants.h",
615    "source/opt/control_dependence.cpp",
616    "source/opt/control_dependence.h",
617    "source/opt/convert_to_half_pass.cpp",
618    "source/opt/convert_to_half_pass.h",
619    "source/opt/convert_to_sampled_image_pass.cpp",
620    "source/opt/convert_to_sampled_image_pass.h",
621    "source/opt/copy_prop_arrays.cpp",
622    "source/opt/copy_prop_arrays.h",
623    "source/opt/dataflow.cpp",
624    "source/opt/dataflow.h",
625    "source/opt/dead_branch_elim_pass.cpp",
626    "source/opt/dead_branch_elim_pass.h",
627    "source/opt/dead_insert_elim_pass.cpp",
628    "source/opt/dead_insert_elim_pass.h",
629    "source/opt/dead_variable_elimination.cpp",
630    "source/opt/dead_variable_elimination.h",
631    "source/opt/debug_info_manager.cpp",
632    "source/opt/debug_info_manager.h",
633    "source/opt/decoration_manager.cpp",
634    "source/opt/decoration_manager.h",
635    "source/opt/def_use_manager.cpp",
636    "source/opt/def_use_manager.h",
637    "source/opt/desc_sroa.cpp",
638    "source/opt/desc_sroa.h",
639    "source/opt/desc_sroa_util.cpp",
640    "source/opt/desc_sroa_util.h",
641    "source/opt/dominator_analysis.cpp",
642    "source/opt/dominator_analysis.h",
643    "source/opt/dominator_tree.cpp",
644    "source/opt/dominator_tree.h",
645    "source/opt/eliminate_dead_constant_pass.cpp",
646    "source/opt/eliminate_dead_constant_pass.h",
647    "source/opt/eliminate_dead_functions_pass.cpp",
648    "source/opt/eliminate_dead_functions_pass.h",
649    "source/opt/eliminate_dead_functions_util.cpp",
650    "source/opt/eliminate_dead_functions_util.h",
651    "source/opt/eliminate_dead_io_components_pass.cpp",
652    "source/opt/eliminate_dead_io_components_pass.h",
653    "source/opt/eliminate_dead_members_pass.cpp",
654    "source/opt/eliminate_dead_members_pass.h",
655    "source/opt/eliminate_dead_output_stores_pass.cpp",
656    "source/opt/eliminate_dead_output_stores_pass.h",
657    "source/opt/empty_pass.h",
658    "source/opt/feature_manager.cpp",
659    "source/opt/feature_manager.h",
660    "source/opt/fix_func_call_arguments.cpp",
661    "source/opt/fix_func_call_arguments.h",
662    "source/opt/fix_storage_class.cpp",
663    "source/opt/fix_storage_class.h",
664    "source/opt/flatten_decoration_pass.cpp",
665    "source/opt/flatten_decoration_pass.h",
666    "source/opt/fold.cpp",
667    "source/opt/fold.h",
668    "source/opt/fold_spec_constant_op_and_composite_pass.cpp",
669    "source/opt/fold_spec_constant_op_and_composite_pass.h",
670    "source/opt/folding_rules.cpp",
671    "source/opt/folding_rules.h",
672    "source/opt/freeze_spec_constant_value_pass.cpp",
673    "source/opt/freeze_spec_constant_value_pass.h",
674    "source/opt/function.cpp",
675    "source/opt/function.h",
676    "source/opt/graphics_robust_access_pass.cpp",
677    "source/opt/graphics_robust_access_pass.h",
678    "source/opt/if_conversion.cpp",
679    "source/opt/if_conversion.h",
680    "source/opt/inline_exhaustive_pass.cpp",
681    "source/opt/inline_exhaustive_pass.h",
682    "source/opt/inline_opaque_pass.cpp",
683    "source/opt/inline_opaque_pass.h",
684    "source/opt/inline_pass.cpp",
685    "source/opt/inline_pass.h",
686    "source/opt/instruction.cpp",
687    "source/opt/instruction.h",
688    "source/opt/instruction_list.cpp",
689    "source/opt/instruction_list.h",
690    "source/opt/interface_var_sroa.cpp",
691    "source/opt/interface_var_sroa.h",
692    "source/opt/interp_fixup_pass.cpp",
693    "source/opt/interp_fixup_pass.h",
694    "source/opt/invocation_interlock_placement_pass.cpp",
695    "source/opt/invocation_interlock_placement_pass.h",
696    "source/opt/ir_builder.h",
697    "source/opt/ir_context.cpp",
698    "source/opt/ir_context.h",
699    "source/opt/ir_loader.cpp",
700    "source/opt/ir_loader.h",
701    "source/opt/iterator.h",
702    "source/opt/licm_pass.cpp",
703    "source/opt/licm_pass.h",
704    "source/opt/liveness.cpp",
705    "source/opt/liveness.h",
706    "source/opt/local_access_chain_convert_pass.cpp",
707    "source/opt/local_access_chain_convert_pass.h",
708    "source/opt/local_redundancy_elimination.cpp",
709    "source/opt/local_redundancy_elimination.h",
710    "source/opt/local_single_block_elim_pass.cpp",
711    "source/opt/local_single_block_elim_pass.h",
712    "source/opt/local_single_store_elim_pass.cpp",
713    "source/opt/local_single_store_elim_pass.h",
714    "source/opt/log.h",
715    "source/opt/loop_dependence.cpp",
716    "source/opt/loop_dependence.h",
717    "source/opt/loop_dependence_helpers.cpp",
718    "source/opt/loop_descriptor.cpp",
719    "source/opt/loop_descriptor.h",
720    "source/opt/loop_fission.cpp",
721    "source/opt/loop_fission.h",
722    "source/opt/loop_fusion.cpp",
723    "source/opt/loop_fusion.h",
724    "source/opt/loop_fusion_pass.cpp",
725    "source/opt/loop_fusion_pass.h",
726    "source/opt/loop_peeling.cpp",
727    "source/opt/loop_peeling.h",
728    "source/opt/loop_unroller.cpp",
729    "source/opt/loop_unroller.h",
730    "source/opt/loop_unswitch_pass.cpp",
731    "source/opt/loop_unswitch_pass.h",
732    "source/opt/loop_utils.cpp",
733    "source/opt/loop_utils.h",
734    "source/opt/mem_pass.cpp",
735    "source/opt/mem_pass.h",
736    "source/opt/merge_return_pass.cpp",
737    "source/opt/merge_return_pass.h",
738    "source/opt/modify_maximal_reconvergence.cpp",
739    "source/opt/modify_maximal_reconvergence.h",
740    "source/opt/module.cpp",
741    "source/opt/module.h",
742    "source/opt/null_pass.h",
743    "source/opt/opextinst_forward_ref_fixup_pass.cpp",
744    "source/opt/opextinst_forward_ref_fixup_pass.h",
745    "source/opt/optimizer.cpp",
746    "source/opt/pass.cpp",
747    "source/opt/pass.h",
748    "source/opt/pass_manager.cpp",
749    "source/opt/pass_manager.h",
750    "source/opt/passes.h",
751    "source/opt/private_to_local_pass.cpp",
752    "source/opt/private_to_local_pass.h",
753    "source/opt/propagator.cpp",
754    "source/opt/propagator.h",
755    "source/opt/reduce_load_size.cpp",
756    "source/opt/reduce_load_size.h",
757    "source/opt/redundancy_elimination.cpp",
758    "source/opt/redundancy_elimination.h",
759    "source/opt/reflect.h",
760    "source/opt/register_pressure.cpp",
761    "source/opt/register_pressure.h",
762    "source/opt/relax_float_ops_pass.cpp",
763    "source/opt/relax_float_ops_pass.h",
764    "source/opt/remove_dontinline_pass.cpp",
765    "source/opt/remove_dontinline_pass.h",
766    "source/opt/remove_duplicates_pass.cpp",
767    "source/opt/remove_duplicates_pass.h",
768    "source/opt/remove_unused_interface_variables_pass.cpp",
769    "source/opt/remove_unused_interface_variables_pass.h",
770    "source/opt/replace_desc_array_access_using_var_index.cpp",
771    "source/opt/replace_desc_array_access_using_var_index.h",
772    "source/opt/replace_invalid_opc.cpp",
773    "source/opt/replace_invalid_opc.h",
774    "source/opt/scalar_analysis.cpp",
775    "source/opt/scalar_analysis.h",
776    "source/opt/scalar_analysis_nodes.h",
777    "source/opt/scalar_analysis_simplification.cpp",
778    "source/opt/scalar_replacement_pass.cpp",
779    "source/opt/scalar_replacement_pass.h",
780    "source/opt/set_spec_constant_default_value_pass.cpp",
781    "source/opt/set_spec_constant_default_value_pass.h",
782    "source/opt/simplification_pass.cpp",
783    "source/opt/simplification_pass.h",
784    "source/opt/spread_volatile_semantics.cpp",
785    "source/opt/spread_volatile_semantics.h",
786    "source/opt/ssa_rewrite_pass.cpp",
787    "source/opt/ssa_rewrite_pass.h",
788    "source/opt/strength_reduction_pass.cpp",
789    "source/opt/strength_reduction_pass.h",
790    "source/opt/strip_debug_info_pass.cpp",
791    "source/opt/strip_debug_info_pass.h",
792    "source/opt/strip_nonsemantic_info_pass.cpp",
793    "source/opt/strip_nonsemantic_info_pass.h",
794    "source/opt/struct_packing_pass.cpp",
795    "source/opt/struct_packing_pass.h",
796    "source/opt/struct_cfg_analysis.cpp",
797    "source/opt/struct_cfg_analysis.h",
798    "source/opt/switch_descriptorset_pass.cpp",
799    "source/opt/switch_descriptorset_pass.h",
800    "source/opt/tree_iterator.h",
801    "source/opt/trim_capabilities_pass.cpp",
802    "source/opt/trim_capabilities_pass.h",
803    "source/opt/type_manager.cpp",
804    "source/opt/type_manager.h",
805    "source/opt/types.cpp",
806    "source/opt/types.h",
807    "source/opt/unify_const_pass.cpp",
808    "source/opt/unify_const_pass.h",
809    "source/opt/upgrade_memory_model.cpp",
810    "source/opt/upgrade_memory_model.h",
811    "source/opt/value_number_table.cpp",
812    "source/opt/value_number_table.h",
813    "source/opt/vector_dce.cpp",
814    "source/opt/vector_dce.h",
815    "source/opt/workaround1209.cpp",
816    "source/opt/workaround1209.h",
817    "source/opt/wrap_opkill.cpp",
818    "source/opt/wrap_opkill.h",
819  ]
820
821  deps = [
822    ":spvtools",
823    ":spvtools_language_header_debuginfo",
824    ":spvtools_vendor_tables_spv-amd-shader-ballot",
825  ]
826  public_deps = [
827    ":spvtools_headers",
828    ":spvtools_language_header_cldebuginfo100",
829    ":spvtools_language_header_vkdebuginfo100",
830  ]
831
832  if (build_with_chromium) {
833    configs -= [ "//build/config/compiler:chromium_code" ]
834    configs += [ "//build/config/compiler:no_chromium_code" ]
835  }
836  configs += [ ":spvtools_internal_config" ]
837}
838
839static_library("spvtools_link") {
840  sources = [ "source/link/linker.cpp" ]
841  deps = [
842    ":spvtools",
843    ":spvtools_opt",
844    ":spvtools_val",
845  ]
846  public_deps = [ ":spvtools_headers" ]
847  if (build_with_chromium) {
848    configs -= [ "//build/config/compiler:chromium_code" ]
849    configs += [ "//build/config/compiler:no_chromium_code" ]
850  }
851  configs += [ ":spvtools_internal_config" ]
852}
853
854static_library("spvtools_reduce") {
855  sources = [
856    "source/reduce/change_operand_reduction_opportunity.cpp",
857    "source/reduce/change_operand_reduction_opportunity.h",
858    "source/reduce/change_operand_to_undef_reduction_opportunity.cpp",
859    "source/reduce/change_operand_to_undef_reduction_opportunity.h",
860    "source/reduce/conditional_branch_to_simple_conditional_branch_opportunity_finder.cpp",
861    "source/reduce/conditional_branch_to_simple_conditional_branch_opportunity_finder.h",
862    "source/reduce/conditional_branch_to_simple_conditional_branch_reduction_opportunity.cpp",
863    "source/reduce/conditional_branch_to_simple_conditional_branch_reduction_opportunity.h",
864    "source/reduce/merge_blocks_reduction_opportunity.cpp",
865    "source/reduce/merge_blocks_reduction_opportunity.h",
866    "source/reduce/merge_blocks_reduction_opportunity_finder.cpp",
867    "source/reduce/merge_blocks_reduction_opportunity_finder.h",
868    "source/reduce/operand_to_const_reduction_opportunity_finder.cpp",
869    "source/reduce/operand_to_const_reduction_opportunity_finder.h",
870    "source/reduce/operand_to_dominating_id_reduction_opportunity_finder.cpp",
871    "source/reduce/operand_to_dominating_id_reduction_opportunity_finder.h",
872    "source/reduce/operand_to_undef_reduction_opportunity_finder.cpp",
873    "source/reduce/operand_to_undef_reduction_opportunity_finder.h",
874    "source/reduce/reducer.cpp",
875    "source/reduce/reducer.h",
876    "source/reduce/reduction_opportunity.cpp",
877    "source/reduce/reduction_opportunity.h",
878    "source/reduce/reduction_opportunity_finder.cpp",
879    "source/reduce/reduction_opportunity_finder.h",
880    "source/reduce/reduction_pass.cpp",
881    "source/reduce/reduction_pass.h",
882    "source/reduce/reduction_util.cpp",
883    "source/reduce/reduction_util.h",
884    "source/reduce/remove_block_reduction_opportunity.cpp",
885    "source/reduce/remove_block_reduction_opportunity.h",
886    "source/reduce/remove_block_reduction_opportunity_finder.cpp",
887    "source/reduce/remove_block_reduction_opportunity_finder.h",
888    "source/reduce/remove_function_reduction_opportunity.cpp",
889    "source/reduce/remove_function_reduction_opportunity.h",
890    "source/reduce/remove_function_reduction_opportunity_finder.cpp",
891    "source/reduce/remove_function_reduction_opportunity_finder.h",
892    "source/reduce/remove_instruction_reduction_opportunity.cpp",
893    "source/reduce/remove_instruction_reduction_opportunity.h",
894    "source/reduce/remove_selection_reduction_opportunity.cpp",
895    "source/reduce/remove_selection_reduction_opportunity.h",
896    "source/reduce/remove_selection_reduction_opportunity_finder.cpp",
897    "source/reduce/remove_selection_reduction_opportunity_finder.h",
898    "source/reduce/remove_struct_member_reduction_opportunity.cpp",
899    "source/reduce/remove_struct_member_reduction_opportunity.h",
900    "source/reduce/remove_unused_instruction_reduction_opportunity_finder.cpp",
901    "source/reduce/remove_unused_instruction_reduction_opportunity_finder.h",
902    "source/reduce/remove_unused_struct_member_reduction_opportunity_finder.cpp",
903    "source/reduce/remove_unused_struct_member_reduction_opportunity_finder.h",
904    "source/reduce/simple_conditional_branch_to_branch_opportunity_finder.cpp",
905    "source/reduce/simple_conditional_branch_to_branch_opportunity_finder.h",
906    "source/reduce/simple_conditional_branch_to_branch_reduction_opportunity.cpp",
907    "source/reduce/simple_conditional_branch_to_branch_reduction_opportunity.h",
908    "source/reduce/structured_construct_to_block_reduction_opportunity.cpp",
909    "source/reduce/structured_construct_to_block_reduction_opportunity.h",
910    "source/reduce/structured_construct_to_block_reduction_opportunity_finder.cpp",
911    "source/reduce/structured_construct_to_block_reduction_opportunity_finder.h",
912    "source/reduce/structured_loop_to_selection_reduction_opportunity.cpp",
913    "source/reduce/structured_loop_to_selection_reduction_opportunity.h",
914    "source/reduce/structured_loop_to_selection_reduction_opportunity_finder.cpp",
915    "source/reduce/structured_loop_to_selection_reduction_opportunity_finder.h",
916  ]
917  deps = [
918    ":spvtools",
919    ":spvtools_opt",
920  ]
921  public_deps = [ ":spvtools_headers" ]
922  if (build_with_chromium) {
923    configs -= [ "//build/config/compiler:chromium_code" ]
924    configs += [ "//build/config/compiler:no_chromium_code" ]
925  }
926  configs += [ ":spvtools_internal_config" ]
927}
928
929if (build_with_chromium && spvtools_build_executables) {
930  # The spirv-fuzz library is only built when in a Chromium checkout
931  # due to its dependency on protobuf.
932
933  proto_library("spvtools_fuzz_proto") {
934    sources = [ "source/fuzz/protobufs/spvtoolsfuzz.proto" ]
935    generate_python = false
936    use_protobuf_full = true
937  }
938
939  static_library("spvtools_fuzz") {
940    sources = [
941      "source/fuzz/added_function_reducer.cpp",
942      "source/fuzz/added_function_reducer.h",
943      "source/fuzz/available_instructions.cpp",
944      "source/fuzz/available_instructions.h",
945      "source/fuzz/call_graph.cpp",
946      "source/fuzz/call_graph.h",
947      "source/fuzz/comparator_deep_blocks_first.h",
948      "source/fuzz/counter_overflow_id_source.cpp",
949      "source/fuzz/counter_overflow_id_source.h",
950      "source/fuzz/data_descriptor.cpp",
951      "source/fuzz/data_descriptor.h",
952      "source/fuzz/equivalence_relation.h",
953      "source/fuzz/fact_manager/constant_uniform_facts.cpp",
954      "source/fuzz/fact_manager/constant_uniform_facts.h",
955      "source/fuzz/fact_manager/data_synonym_and_id_equation_facts.cpp",
956      "source/fuzz/fact_manager/data_synonym_and_id_equation_facts.h",
957      "source/fuzz/fact_manager/dead_block_facts.cpp",
958      "source/fuzz/fact_manager/dead_block_facts.h",
959      "source/fuzz/fact_manager/fact_manager.cpp",
960      "source/fuzz/fact_manager/fact_manager.h",
961      "source/fuzz/fact_manager/irrelevant_value_facts.cpp",
962      "source/fuzz/fact_manager/irrelevant_value_facts.h",
963      "source/fuzz/fact_manager/livesafe_function_facts.cpp",
964      "source/fuzz/fact_manager/livesafe_function_facts.h",
965      "source/fuzz/force_render_red.cpp",
966      "source/fuzz/force_render_red.h",
967      "source/fuzz/fuzzer.cpp",
968      "source/fuzz/fuzzer.h",
969      "source/fuzz/fuzzer_context.cpp",
970      "source/fuzz/fuzzer_context.h",
971      "source/fuzz/fuzzer_pass.cpp",
972      "source/fuzz/fuzzer_pass.h",
973      "source/fuzz/fuzzer_pass_add_access_chains.cpp",
974      "source/fuzz/fuzzer_pass_add_access_chains.h",
975      "source/fuzz/fuzzer_pass_add_bit_instruction_synonyms.cpp",
976      "source/fuzz/fuzzer_pass_add_bit_instruction_synonyms.h",
977      "source/fuzz/fuzzer_pass_add_composite_extract.cpp",
978      "source/fuzz/fuzzer_pass_add_composite_extract.h",
979      "source/fuzz/fuzzer_pass_add_composite_inserts.cpp",
980      "source/fuzz/fuzzer_pass_add_composite_inserts.h",
981      "source/fuzz/fuzzer_pass_add_composite_types.cpp",
982      "source/fuzz/fuzzer_pass_add_composite_types.h",
983      "source/fuzz/fuzzer_pass_add_copy_memory.cpp",
984      "source/fuzz/fuzzer_pass_add_copy_memory.h",
985      "source/fuzz/fuzzer_pass_add_dead_blocks.cpp",
986      "source/fuzz/fuzzer_pass_add_dead_blocks.h",
987      "source/fuzz/fuzzer_pass_add_dead_breaks.cpp",
988      "source/fuzz/fuzzer_pass_add_dead_breaks.h",
989      "source/fuzz/fuzzer_pass_add_dead_continues.cpp",
990      "source/fuzz/fuzzer_pass_add_dead_continues.h",
991      "source/fuzz/fuzzer_pass_add_equation_instructions.cpp",
992      "source/fuzz/fuzzer_pass_add_equation_instructions.h",
993      "source/fuzz/fuzzer_pass_add_function_calls.cpp",
994      "source/fuzz/fuzzer_pass_add_function_calls.h",
995      "source/fuzz/fuzzer_pass_add_global_variables.cpp",
996      "source/fuzz/fuzzer_pass_add_global_variables.h",
997      "source/fuzz/fuzzer_pass_add_image_sample_unused_components.cpp",
998      "source/fuzz/fuzzer_pass_add_image_sample_unused_components.h",
999      "source/fuzz/fuzzer_pass_add_loads.cpp",
1000      "source/fuzz/fuzzer_pass_add_loads.h",
1001      "source/fuzz/fuzzer_pass_add_local_variables.cpp",
1002      "source/fuzz/fuzzer_pass_add_local_variables.h",
1003      "source/fuzz/fuzzer_pass_add_loop_preheaders.cpp",
1004      "source/fuzz/fuzzer_pass_add_loop_preheaders.h",
1005      "source/fuzz/fuzzer_pass_add_loops_to_create_int_constant_synonyms.cpp",
1006      "source/fuzz/fuzzer_pass_add_loops_to_create_int_constant_synonyms.h",
1007      "source/fuzz/fuzzer_pass_add_no_contraction_decorations.cpp",
1008      "source/fuzz/fuzzer_pass_add_no_contraction_decorations.h",
1009      "source/fuzz/fuzzer_pass_add_opphi_synonyms.cpp",
1010      "source/fuzz/fuzzer_pass_add_opphi_synonyms.h",
1011      "source/fuzz/fuzzer_pass_add_parameters.cpp",
1012      "source/fuzz/fuzzer_pass_add_parameters.h",
1013      "source/fuzz/fuzzer_pass_add_relaxed_decorations.cpp",
1014      "source/fuzz/fuzzer_pass_add_relaxed_decorations.h",
1015      "source/fuzz/fuzzer_pass_add_stores.cpp",
1016      "source/fuzz/fuzzer_pass_add_stores.h",
1017      "source/fuzz/fuzzer_pass_add_synonyms.cpp",
1018      "source/fuzz/fuzzer_pass_add_synonyms.h",
1019      "source/fuzz/fuzzer_pass_add_vector_shuffle_instructions.cpp",
1020      "source/fuzz/fuzzer_pass_add_vector_shuffle_instructions.h",
1021      "source/fuzz/fuzzer_pass_adjust_branch_weights.cpp",
1022      "source/fuzz/fuzzer_pass_adjust_branch_weights.h",
1023      "source/fuzz/fuzzer_pass_adjust_function_controls.cpp",
1024      "source/fuzz/fuzzer_pass_adjust_function_controls.h",
1025      "source/fuzz/fuzzer_pass_adjust_loop_controls.cpp",
1026      "source/fuzz/fuzzer_pass_adjust_loop_controls.h",
1027      "source/fuzz/fuzzer_pass_adjust_memory_operands_masks.cpp",
1028      "source/fuzz/fuzzer_pass_adjust_memory_operands_masks.h",
1029      "source/fuzz/fuzzer_pass_adjust_selection_controls.cpp",
1030      "source/fuzz/fuzzer_pass_adjust_selection_controls.h",
1031      "source/fuzz/fuzzer_pass_apply_id_synonyms.cpp",
1032      "source/fuzz/fuzzer_pass_apply_id_synonyms.h",
1033      "source/fuzz/fuzzer_pass_construct_composites.cpp",
1034      "source/fuzz/fuzzer_pass_construct_composites.h",
1035      "source/fuzz/fuzzer_pass_copy_objects.cpp",
1036      "source/fuzz/fuzzer_pass_copy_objects.h",
1037      "source/fuzz/fuzzer_pass_donate_modules.cpp",
1038      "source/fuzz/fuzzer_pass_donate_modules.h",
1039      "source/fuzz/fuzzer_pass_duplicate_regions_with_selections.cpp",
1040      "source/fuzz/fuzzer_pass_duplicate_regions_with_selections.h",
1041      "source/fuzz/fuzzer_pass_expand_vector_reductions.cpp",
1042      "source/fuzz/fuzzer_pass_expand_vector_reductions.h",
1043      "source/fuzz/fuzzer_pass_flatten_conditional_branches.cpp",
1044      "source/fuzz/fuzzer_pass_flatten_conditional_branches.h",
1045      "source/fuzz/fuzzer_pass_inline_functions.cpp",
1046      "source/fuzz/fuzzer_pass_inline_functions.h",
1047      "source/fuzz/fuzzer_pass_interchange_signedness_of_integer_operands.cpp",
1048      "source/fuzz/fuzzer_pass_interchange_signedness_of_integer_operands.h",
1049      "source/fuzz/fuzzer_pass_interchange_zero_like_constants.cpp",
1050      "source/fuzz/fuzzer_pass_interchange_zero_like_constants.h",
1051      "source/fuzz/fuzzer_pass_invert_comparison_operators.cpp",
1052      "source/fuzz/fuzzer_pass_invert_comparison_operators.h",
1053      "source/fuzz/fuzzer_pass_make_vector_operations_dynamic.cpp",
1054      "source/fuzz/fuzzer_pass_make_vector_operations_dynamic.h",
1055      "source/fuzz/fuzzer_pass_merge_blocks.cpp",
1056      "source/fuzz/fuzzer_pass_merge_blocks.h",
1057      "source/fuzz/fuzzer_pass_merge_function_returns.cpp",
1058      "source/fuzz/fuzzer_pass_merge_function_returns.h",
1059      "source/fuzz/fuzzer_pass_mutate_pointers.cpp",
1060      "source/fuzz/fuzzer_pass_mutate_pointers.h",
1061      "source/fuzz/fuzzer_pass_obfuscate_constants.cpp",
1062      "source/fuzz/fuzzer_pass_obfuscate_constants.h",
1063      "source/fuzz/fuzzer_pass_outline_functions.cpp",
1064      "source/fuzz/fuzzer_pass_outline_functions.h",
1065      "source/fuzz/fuzzer_pass_permute_blocks.cpp",
1066      "source/fuzz/fuzzer_pass_permute_blocks.h",
1067      "source/fuzz/fuzzer_pass_permute_function_parameters.cpp",
1068      "source/fuzz/fuzzer_pass_permute_function_parameters.h",
1069      "source/fuzz/fuzzer_pass_permute_function_variables.cpp",
1070      "source/fuzz/fuzzer_pass_permute_function_variables.h",
1071      "source/fuzz/fuzzer_pass_permute_instructions.cpp",
1072      "source/fuzz/fuzzer_pass_permute_instructions.h",
1073      "source/fuzz/fuzzer_pass_permute_phi_operands.cpp",
1074      "source/fuzz/fuzzer_pass_permute_phi_operands.h",
1075      "source/fuzz/fuzzer_pass_propagate_instructions_down.cpp",
1076      "source/fuzz/fuzzer_pass_propagate_instructions_down.h",
1077      "source/fuzz/fuzzer_pass_propagate_instructions_up.cpp",
1078      "source/fuzz/fuzzer_pass_propagate_instructions_up.h",
1079      "source/fuzz/fuzzer_pass_push_ids_through_variables.cpp",
1080      "source/fuzz/fuzzer_pass_push_ids_through_variables.h",
1081      "source/fuzz/fuzzer_pass_replace_adds_subs_muls_with_carrying_extended.cpp",
1082      "source/fuzz/fuzzer_pass_replace_adds_subs_muls_with_carrying_extended.h",
1083      "source/fuzz/fuzzer_pass_replace_branches_from_dead_blocks_with_exits.cpp",
1084      "source/fuzz/fuzzer_pass_replace_branches_from_dead_blocks_with_exits.h",
1085      "source/fuzz/fuzzer_pass_replace_copy_memories_with_loads_stores.cpp",
1086      "source/fuzz/fuzzer_pass_replace_copy_memories_with_loads_stores.h",
1087      "source/fuzz/fuzzer_pass_replace_copy_objects_with_stores_loads.cpp",
1088      "source/fuzz/fuzzer_pass_replace_copy_objects_with_stores_loads.h",
1089      "source/fuzz/fuzzer_pass_replace_irrelevant_ids.cpp",
1090      "source/fuzz/fuzzer_pass_replace_irrelevant_ids.h",
1091      "source/fuzz/fuzzer_pass_replace_linear_algebra_instructions.cpp",
1092      "source/fuzz/fuzzer_pass_replace_linear_algebra_instructions.h",
1093      "source/fuzz/fuzzer_pass_replace_loads_stores_with_copy_memories.cpp",
1094      "source/fuzz/fuzzer_pass_replace_loads_stores_with_copy_memories.h",
1095      "source/fuzz/fuzzer_pass_replace_opphi_ids_from_dead_predecessors.cpp",
1096      "source/fuzz/fuzzer_pass_replace_opphi_ids_from_dead_predecessors.h",
1097      "source/fuzz/fuzzer_pass_replace_opselects_with_conditional_branches.cpp",
1098      "source/fuzz/fuzzer_pass_replace_opselects_with_conditional_branches.h",
1099      "source/fuzz/fuzzer_pass_replace_parameter_with_global.cpp",
1100      "source/fuzz/fuzzer_pass_replace_parameter_with_global.h",
1101      "source/fuzz/fuzzer_pass_replace_params_with_struct.cpp",
1102      "source/fuzz/fuzzer_pass_replace_params_with_struct.h",
1103      "source/fuzz/fuzzer_pass_split_blocks.cpp",
1104      "source/fuzz/fuzzer_pass_split_blocks.h",
1105      "source/fuzz/fuzzer_pass_swap_commutable_operands.cpp",
1106      "source/fuzz/fuzzer_pass_swap_commutable_operands.h",
1107      "source/fuzz/fuzzer_pass_swap_conditional_branch_operands.cpp",
1108      "source/fuzz/fuzzer_pass_swap_conditional_branch_operands.h",
1109      "source/fuzz/fuzzer_pass_swap_functions.cpp",
1110      "source/fuzz/fuzzer_pass_swap_functions.h",
1111      "source/fuzz/fuzzer_pass_toggle_access_chain_instruction.cpp",
1112      "source/fuzz/fuzzer_pass_toggle_access_chain_instruction.h",
1113      "source/fuzz/fuzzer_pass_wrap_regions_in_selections.cpp",
1114      "source/fuzz/fuzzer_pass_wrap_regions_in_selections.h",
1115      "source/fuzz/fuzzer_pass_wrap_vector_synonym.cpp",
1116      "source/fuzz/fuzzer_pass_wrap_vector_synonym.h",
1117      "source/fuzz/fuzzer_util.cpp",
1118      "source/fuzz/fuzzer_util.h",
1119      "source/fuzz/id_use_descriptor.cpp",
1120      "source/fuzz/id_use_descriptor.h",
1121      "source/fuzz/instruction_descriptor.cpp",
1122      "source/fuzz/instruction_descriptor.h",
1123      "source/fuzz/instruction_message.cpp",
1124      "source/fuzz/instruction_message.h",
1125      "source/fuzz/overflow_id_source.cpp",
1126      "source/fuzz/overflow_id_source.h",
1127      "source/fuzz/pass_management/repeated_pass_instances.h",
1128      "source/fuzz/pass_management/repeated_pass_manager.cpp",
1129      "source/fuzz/pass_management/repeated_pass_manager.h",
1130      "source/fuzz/pass_management/repeated_pass_manager_looped_with_recommendations.cpp",
1131      "source/fuzz/pass_management/repeated_pass_manager_looped_with_recommendations.h",
1132      "source/fuzz/pass_management/repeated_pass_manager_random_with_recommendations.cpp",
1133      "source/fuzz/pass_management/repeated_pass_manager_random_with_recommendations.h",
1134      "source/fuzz/pass_management/repeated_pass_manager_simple.cpp",
1135      "source/fuzz/pass_management/repeated_pass_manager_simple.h",
1136      "source/fuzz/pass_management/repeated_pass_recommender.cpp",
1137      "source/fuzz/pass_management/repeated_pass_recommender.h",
1138      "source/fuzz/pass_management/repeated_pass_recommender_standard.cpp",
1139      "source/fuzz/pass_management/repeated_pass_recommender_standard.h",
1140      "source/fuzz/protobufs/spirvfuzz_protobufs.h",
1141      "source/fuzz/pseudo_random_generator.cpp",
1142      "source/fuzz/pseudo_random_generator.h",
1143      "source/fuzz/random_generator.cpp",
1144      "source/fuzz/random_generator.h",
1145      "source/fuzz/replayer.cpp",
1146      "source/fuzz/replayer.h",
1147      "source/fuzz/shrinker.cpp",
1148      "source/fuzz/shrinker.h",
1149      "source/fuzz/transformation.cpp",
1150      "source/fuzz/transformation.h",
1151      "source/fuzz/transformation_access_chain.cpp",
1152      "source/fuzz/transformation_access_chain.h",
1153      "source/fuzz/transformation_add_bit_instruction_synonym.cpp",
1154      "source/fuzz/transformation_add_bit_instruction_synonym.h",
1155      "source/fuzz/transformation_add_constant_boolean.cpp",
1156      "source/fuzz/transformation_add_constant_boolean.h",
1157      "source/fuzz/transformation_add_constant_composite.cpp",
1158      "source/fuzz/transformation_add_constant_composite.h",
1159      "source/fuzz/transformation_add_constant_null.cpp",
1160      "source/fuzz/transformation_add_constant_null.h",
1161      "source/fuzz/transformation_add_constant_scalar.cpp",
1162      "source/fuzz/transformation_add_constant_scalar.h",
1163      "source/fuzz/transformation_add_copy_memory.cpp",
1164      "source/fuzz/transformation_add_copy_memory.h",
1165      "source/fuzz/transformation_add_dead_block.cpp",
1166      "source/fuzz/transformation_add_dead_block.h",
1167      "source/fuzz/transformation_add_dead_break.cpp",
1168      "source/fuzz/transformation_add_dead_break.h",
1169      "source/fuzz/transformation_add_dead_continue.cpp",
1170      "source/fuzz/transformation_add_dead_continue.h",
1171      "source/fuzz/transformation_add_early_terminator_wrapper.cpp",
1172      "source/fuzz/transformation_add_early_terminator_wrapper.h",
1173      "source/fuzz/transformation_add_function.cpp",
1174      "source/fuzz/transformation_add_function.h",
1175      "source/fuzz/transformation_add_global_undef.cpp",
1176      "source/fuzz/transformation_add_global_undef.h",
1177      "source/fuzz/transformation_add_global_variable.cpp",
1178      "source/fuzz/transformation_add_global_variable.h",
1179      "source/fuzz/transformation_add_image_sample_unused_components.cpp",
1180      "source/fuzz/transformation_add_image_sample_unused_components.h",
1181      "source/fuzz/transformation_add_local_variable.cpp",
1182      "source/fuzz/transformation_add_local_variable.h",
1183      "source/fuzz/transformation_add_loop_preheader.cpp",
1184      "source/fuzz/transformation_add_loop_preheader.h",
1185      "source/fuzz/transformation_add_loop_to_create_int_constant_synonym.cpp",
1186      "source/fuzz/transformation_add_loop_to_create_int_constant_synonym.h",
1187      "source/fuzz/transformation_add_no_contraction_decoration.cpp",
1188      "source/fuzz/transformation_add_no_contraction_decoration.h",
1189      "source/fuzz/transformation_add_opphi_synonym.cpp",
1190      "source/fuzz/transformation_add_opphi_synonym.h",
1191      "source/fuzz/transformation_add_parameter.cpp",
1192      "source/fuzz/transformation_add_parameter.h",
1193      "source/fuzz/transformation_add_relaxed_decoration.cpp",
1194      "source/fuzz/transformation_add_relaxed_decoration.h",
1195      "source/fuzz/transformation_add_spec_constant_op.cpp",
1196      "source/fuzz/transformation_add_spec_constant_op.h",
1197      "source/fuzz/transformation_add_synonym.cpp",
1198      "source/fuzz/transformation_add_synonym.h",
1199      "source/fuzz/transformation_add_type_array.cpp",
1200      "source/fuzz/transformation_add_type_array.h",
1201      "source/fuzz/transformation_add_type_boolean.cpp",
1202      "source/fuzz/transformation_add_type_boolean.h",
1203      "source/fuzz/transformation_add_type_float.cpp",
1204      "source/fuzz/transformation_add_type_float.h",
1205      "source/fuzz/transformation_add_type_function.cpp",
1206      "source/fuzz/transformation_add_type_function.h",
1207      "source/fuzz/transformation_add_type_int.cpp",
1208      "source/fuzz/transformation_add_type_int.h",
1209      "source/fuzz/transformation_add_type_matrix.cpp",
1210      "source/fuzz/transformation_add_type_matrix.h",
1211      "source/fuzz/transformation_add_type_pointer.cpp",
1212      "source/fuzz/transformation_add_type_pointer.h",
1213      "source/fuzz/transformation_add_type_struct.cpp",
1214      "source/fuzz/transformation_add_type_struct.h",
1215      "source/fuzz/transformation_add_type_vector.cpp",
1216      "source/fuzz/transformation_add_type_vector.h",
1217      "source/fuzz/transformation_adjust_branch_weights.cpp",
1218      "source/fuzz/transformation_adjust_branch_weights.h",
1219      "source/fuzz/transformation_composite_construct.cpp",
1220      "source/fuzz/transformation_composite_construct.h",
1221      "source/fuzz/transformation_composite_extract.cpp",
1222      "source/fuzz/transformation_composite_extract.h",
1223      "source/fuzz/transformation_composite_insert.cpp",
1224      "source/fuzz/transformation_composite_insert.h",
1225      "source/fuzz/transformation_compute_data_synonym_fact_closure.cpp",
1226      "source/fuzz/transformation_compute_data_synonym_fact_closure.h",
1227      "source/fuzz/transformation_context.cpp",
1228      "source/fuzz/transformation_context.h",
1229      "source/fuzz/transformation_duplicate_region_with_selection.cpp",
1230      "source/fuzz/transformation_duplicate_region_with_selection.h",
1231      "source/fuzz/transformation_equation_instruction.cpp",
1232      "source/fuzz/transformation_equation_instruction.h",
1233      "source/fuzz/transformation_expand_vector_reduction.cpp",
1234      "source/fuzz/transformation_expand_vector_reduction.h",
1235      "source/fuzz/transformation_flatten_conditional_branch.cpp",
1236      "source/fuzz/transformation_flatten_conditional_branch.h",
1237      "source/fuzz/transformation_function_call.cpp",
1238      "source/fuzz/transformation_function_call.h",
1239      "source/fuzz/transformation_inline_function.cpp",
1240      "source/fuzz/transformation_inline_function.h",
1241      "source/fuzz/transformation_invert_comparison_operator.cpp",
1242      "source/fuzz/transformation_invert_comparison_operator.h",
1243      "source/fuzz/transformation_load.cpp",
1244      "source/fuzz/transformation_load.h",
1245      "source/fuzz/transformation_make_vector_operation_dynamic.cpp",
1246      "source/fuzz/transformation_make_vector_operation_dynamic.h",
1247      "source/fuzz/transformation_merge_blocks.cpp",
1248      "source/fuzz/transformation_merge_blocks.h",
1249      "source/fuzz/transformation_merge_function_returns.cpp",
1250      "source/fuzz/transformation_merge_function_returns.h",
1251      "source/fuzz/transformation_move_block_down.cpp",
1252      "source/fuzz/transformation_move_block_down.h",
1253      "source/fuzz/transformation_move_instruction_down.cpp",
1254      "source/fuzz/transformation_move_instruction_down.h",
1255      "source/fuzz/transformation_mutate_pointer.cpp",
1256      "source/fuzz/transformation_mutate_pointer.h",
1257      "source/fuzz/transformation_outline_function.cpp",
1258      "source/fuzz/transformation_outline_function.h",
1259      "source/fuzz/transformation_permute_function_parameters.cpp",
1260      "source/fuzz/transformation_permute_function_parameters.h",
1261      "source/fuzz/transformation_permute_phi_operands.cpp",
1262      "source/fuzz/transformation_permute_phi_operands.h",
1263      "source/fuzz/transformation_propagate_instruction_down.cpp",
1264      "source/fuzz/transformation_propagate_instruction_down.h",
1265      "source/fuzz/transformation_propagate_instruction_up.cpp",
1266      "source/fuzz/transformation_propagate_instruction_up.h",
1267      "source/fuzz/transformation_push_id_through_variable.cpp",
1268      "source/fuzz/transformation_push_id_through_variable.h",
1269      "source/fuzz/transformation_record_synonymous_constants.cpp",
1270      "source/fuzz/transformation_record_synonymous_constants.h",
1271      "source/fuzz/transformation_replace_add_sub_mul_with_carrying_extended.cpp",
1272      "source/fuzz/transformation_replace_add_sub_mul_with_carrying_extended.h",
1273      "source/fuzz/transformation_replace_boolean_constant_with_constant_binary.cpp",
1274      "source/fuzz/transformation_replace_boolean_constant_with_constant_binary.h",
1275      "source/fuzz/transformation_replace_branch_from_dead_block_with_exit.cpp",
1276      "source/fuzz/transformation_replace_branch_from_dead_block_with_exit.h",
1277      "source/fuzz/transformation_replace_constant_with_uniform.cpp",
1278      "source/fuzz/transformation_replace_constant_with_uniform.h",
1279      "source/fuzz/transformation_replace_copy_memory_with_load_store.cpp",
1280      "source/fuzz/transformation_replace_copy_memory_with_load_store.h",
1281      "source/fuzz/transformation_replace_copy_object_with_store_load.cpp",
1282      "source/fuzz/transformation_replace_copy_object_with_store_load.h",
1283      "source/fuzz/transformation_replace_id_with_synonym.cpp",
1284      "source/fuzz/transformation_replace_id_with_synonym.h",
1285      "source/fuzz/transformation_replace_irrelevant_id.cpp",
1286      "source/fuzz/transformation_replace_irrelevant_id.h",
1287      "source/fuzz/transformation_replace_linear_algebra_instruction.cpp",
1288      "source/fuzz/transformation_replace_linear_algebra_instruction.h",
1289      "source/fuzz/transformation_replace_load_store_with_copy_memory.cpp",
1290      "source/fuzz/transformation_replace_load_store_with_copy_memory.h",
1291      "source/fuzz/transformation_replace_opphi_id_from_dead_predecessor.cpp",
1292      "source/fuzz/transformation_replace_opphi_id_from_dead_predecessor.h",
1293      "source/fuzz/transformation_replace_opselect_with_conditional_branch.cpp",
1294      "source/fuzz/transformation_replace_opselect_with_conditional_branch.h",
1295      "source/fuzz/transformation_replace_parameter_with_global.cpp",
1296      "source/fuzz/transformation_replace_parameter_with_global.h",
1297      "source/fuzz/transformation_replace_params_with_struct.cpp",
1298      "source/fuzz/transformation_replace_params_with_struct.h",
1299      "source/fuzz/transformation_set_function_control.cpp",
1300      "source/fuzz/transformation_set_function_control.h",
1301      "source/fuzz/transformation_set_loop_control.cpp",
1302      "source/fuzz/transformation_set_loop_control.h",
1303      "source/fuzz/transformation_set_memory_operands_mask.cpp",
1304      "source/fuzz/transformation_set_memory_operands_mask.h",
1305      "source/fuzz/transformation_set_selection_control.cpp",
1306      "source/fuzz/transformation_set_selection_control.h",
1307      "source/fuzz/transformation_split_block.cpp",
1308      "source/fuzz/transformation_split_block.h",
1309      "source/fuzz/transformation_store.cpp",
1310      "source/fuzz/transformation_store.h",
1311      "source/fuzz/transformation_swap_commutable_operands.cpp",
1312      "source/fuzz/transformation_swap_commutable_operands.h",
1313      "source/fuzz/transformation_swap_conditional_branch_operands.cpp",
1314      "source/fuzz/transformation_swap_conditional_branch_operands.h",
1315      "source/fuzz/transformation_swap_function_variables.cpp",
1316      "source/fuzz/transformation_swap_function_variables.h",
1317      "source/fuzz/transformation_swap_two_functions.cpp",
1318      "source/fuzz/transformation_swap_two_functions.h",
1319      "source/fuzz/transformation_toggle_access_chain_instruction.cpp",
1320      "source/fuzz/transformation_toggle_access_chain_instruction.h",
1321      "source/fuzz/transformation_vector_shuffle.cpp",
1322      "source/fuzz/transformation_vector_shuffle.h",
1323      "source/fuzz/transformation_wrap_early_terminator_in_function.cpp",
1324      "source/fuzz/transformation_wrap_early_terminator_in_function.h",
1325      "source/fuzz/transformation_wrap_region_in_selection.cpp",
1326      "source/fuzz/transformation_wrap_region_in_selection.h",
1327      "source/fuzz/transformation_wrap_vector_synonym.cpp",
1328      "source/fuzz/transformation_wrap_vector_synonym.h",
1329      "source/fuzz/uniform_buffer_element_descriptor.cpp",
1330      "source/fuzz/uniform_buffer_element_descriptor.h",
1331    ]
1332    deps = [
1333      ":spvtools",
1334      ":spvtools_fuzz_proto",
1335      ":spvtools_opt",
1336      ":spvtools_reduce",
1337      "//third_party/protobuf:protobuf_full",
1338    ]
1339    public_deps = [ ":spvtools_headers" ]
1340    configs -= [ "//build/config/compiler:chromium_code" ]
1341    configs += [ "//build/config/compiler:no_chromium_code" ]
1342    configs += [ ":spvtools_internal_config" ]
1343  }
1344}
1345
1346group("SPIRV-Tools") {
1347  public_deps = [
1348    ":spvtools",
1349    ":spvtools_link",
1350    ":spvtools_opt",
1351    ":spvtools_reduce",
1352    ":spvtools_val",
1353  ]
1354}
1355
1356# The tests are scoped to Chromium to avoid needing to write gtest integration.
1357# See Chromium's third_party/googletest/BUILD.gn for a complete integration.
1358if (build_with_chromium && spvtools_build_executables) {
1359  test("spvtools_test") {
1360    sources = [
1361      "test/assembly_context_test.cpp",
1362      "test/assembly_format_test.cpp",
1363      "test/binary_destroy_test.cpp",
1364      "test/binary_endianness_test.cpp",
1365      "test/binary_header_get_test.cpp",
1366      "test/binary_parse_test.cpp",
1367      "test/binary_strnlen_s_test.cpp",
1368      "test/binary_to_text.literal_test.cpp",
1369      "test/binary_to_text_test.cpp",
1370      "test/comment_test.cpp",
1371      "test/enum_set_test.cpp",
1372      "test/enum_string_mapping_test.cpp",
1373      "test/ext_inst.cldebug100_test.cpp",
1374      "test/ext_inst.debuginfo_test.cpp",
1375      "test/ext_inst.glsl_test.cpp",
1376      "test/ext_inst.opencl_test.cpp",
1377      "test/fix_word_test.cpp",
1378      "test/generator_magic_number_test.cpp",
1379      "test/hex_float_test.cpp",
1380      "test/hex_to_text_test.cpp",
1381      "test/immediate_int_test.cpp",
1382      "test/libspirv_macros_test.cpp",
1383      "test/name_mapper_test.cpp",
1384      "test/named_id_test.cpp",
1385      "test/opcode_make_test.cpp",
1386      "test/opcode_require_capabilities_test.cpp",
1387      "test/opcode_split_test.cpp",
1388      "test/opcode_table_get_test.cpp",
1389      "test/operand_capabilities_test.cpp",
1390      "test/operand_pattern_test.cpp",
1391      "test/operand_test.cpp",
1392      "test/target_env_test.cpp",
1393      "test/test_fixture.h",
1394      "test/text_advance_test.cpp",
1395      "test/text_destroy_test.cpp",
1396      "test/text_literal_test.cpp",
1397      "test/text_start_new_inst_test.cpp",
1398      "test/text_to_binary.annotation_test.cpp",
1399      "test/text_to_binary.barrier_test.cpp",
1400      "test/text_to_binary.constant_test.cpp",
1401      "test/text_to_binary.control_flow_test.cpp",
1402      "test/text_to_binary.debug_test.cpp",
1403      "test/text_to_binary.device_side_enqueue_test.cpp",
1404      "test/text_to_binary.extension_test.cpp",
1405      "test/text_to_binary.function_test.cpp",
1406      "test/text_to_binary.group_test.cpp",
1407      "test/text_to_binary.image_test.cpp",
1408      "test/text_to_binary.literal_test.cpp",
1409      "test/text_to_binary.memory_test.cpp",
1410      "test/text_to_binary.misc_test.cpp",
1411      "test/text_to_binary.mode_setting_test.cpp",
1412      "test/text_to_binary.pipe_storage_test.cpp",
1413      "test/text_to_binary.reserved_sampling_test.cpp",
1414      "test/text_to_binary.subgroup_dispatch_test.cpp",
1415      "test/text_to_binary.type_declaration_test.cpp",
1416      "test/text_to_binary_test.cpp",
1417      "test/text_word_get_test.cpp",
1418      "test/to_string_test.cpp",
1419      "test/unit_spirv.cpp",
1420      "test/unit_spirv.h",
1421    ]
1422
1423    deps = [
1424      ":spvtools",
1425      ":spvtools_language_header_cldebuginfo100",
1426      ":spvtools_language_header_debuginfo",
1427      ":spvtools_language_header_vkdebuginfo100",
1428      ":spvtools_tools_io",
1429      ":spvtools_val",
1430      "//testing/gmock",
1431      "//testing/gtest",
1432      "//testing/gtest:gtest_main",
1433      "//third_party/googletest:gmock",
1434      "//third_party/googletest:gtest",
1435    ]
1436
1437    if (is_clang) {
1438      cflags_cc = [ "-Wno-self-assign" ]
1439    }
1440
1441    configs += [ ":spvtools_internal_config" ]
1442  }
1443}
1444
1445if (spirv_tools_standalone) {
1446  group("fuzzers") {
1447    testonly = true
1448    deps = [ "test/fuzzers" ]
1449  }
1450}
1451
1452source_set("spvtools_software_version") {
1453  sources = [ "source/software_version.cpp" ]
1454  deps = [
1455    ":spvtools_build_version",
1456    ":spvtools_headers",
1457  ]
1458  configs += [ ":spvtools_internal_config" ]
1459}
1460
1461source_set("spvtools_tools_util") {
1462  sources = [
1463    "tools/util/flags.cpp",
1464    "tools/util/cli_consumer.cpp",
1465    "tools/util/cli_consumer.h",
1466  ]
1467  deps = [ ":spvtools_headers" ]
1468  configs += [ ":spvtools_internal_config" ]
1469}
1470
1471source_set("spvtools_tools_io") {
1472  sources = [
1473    "tools/io.cpp",
1474    "tools/io.h",
1475  ]
1476  deps = [ ":spvtools_headers" ]
1477  configs += [ ":spvtools_internal_config" ]
1478}
1479
1480if (spvtools_build_executables) {
1481  executable("spirv-as") {
1482    sources = [ "tools/as/as.cpp" ]
1483    deps = [
1484      ":spvtools",
1485      ":spvtools_software_version",
1486      ":spvtools_tools_util",
1487      ":spvtools_tools_io",
1488    ]
1489    configs += [ ":spvtools_internal_config" ]
1490  }
1491
1492  executable("spirv-dis") {
1493    sources = [ "tools/dis/dis.cpp" ]
1494    deps = [
1495      ":spvtools",
1496      ":spvtools_software_version",
1497      ":spvtools_tools_util",
1498      ":spvtools_tools_io",
1499    ]
1500    configs += [ ":spvtools_internal_config" ]
1501  }
1502
1503  executable("spirv-val") {
1504    sources = [ "tools/val/val.cpp" ]
1505    deps = [
1506      ":spvtools",
1507      ":spvtools_software_version",
1508      ":spvtools_tools_util",
1509      ":spvtools_tools_io",
1510      ":spvtools_val",
1511    ]
1512    configs += [ ":spvtools_internal_config" ]
1513  }
1514
1515  executable("spirv-cfg") {
1516    sources = [
1517      "tools/cfg/bin_to_dot.cpp",
1518      "tools/cfg/bin_to_dot.h",
1519      "tools/cfg/cfg.cpp",
1520    ]
1521    deps = [
1522      ":spvtools",
1523      ":spvtools_software_version",
1524      ":spvtools_tools_util",
1525      ":spvtools_tools_io",
1526    ]
1527    configs += [ ":spvtools_internal_config" ]
1528  }
1529
1530  executable("spirv-opt") {
1531    sources = [ "tools/opt/opt.cpp" ]
1532    deps = [
1533      ":spvtools",
1534      ":spvtools_opt",
1535      ":spvtools_software_version",
1536      ":spvtools_tools_util",
1537      ":spvtools_tools_io",
1538      ":spvtools_val",
1539    ]
1540    configs += [ ":spvtools_internal_config" ]
1541  }
1542
1543  executable("spirv-link") {
1544    sources = [ "tools/link/linker.cpp" ]
1545    deps = [
1546      ":spvtools",
1547      ":spvtools_link",
1548      ":spvtools_opt",
1549      ":spvtools_software_version",
1550      ":spvtools_tools_util",
1551      ":spvtools_tools_io",
1552      ":spvtools_val",
1553    ]
1554    configs += [ ":spvtools_internal_config" ]
1555  }
1556}
1557
1558if (!is_ios && !spirv_is_winuwp && build_with_chromium && spvtools_build_executables) {
1559  # iOS and UWP do not allow std::system calls which spirv-fuzz
1560  # requires. Additionally, spirv-fuzz is only built when in a
1561  # Chromium checkout due to its dependency on protobuf.
1562
1563  executable("spirv-fuzz") {
1564    sources = [ "tools/fuzz/fuzz.cpp" ]
1565    deps = [
1566      ":spvtools",
1567      ":spvtools_fuzz",
1568      ":spvtools_opt",
1569      ":spvtools_reduce",
1570      ":spvtools_software_version",
1571      ":spvtools_tools_util",
1572      ":spvtools_tools_io",
1573      ":spvtools_val",
1574      "//third_party/protobuf:protobuf_full",
1575    ]
1576    configs += [ ":spvtools_internal_config" ]
1577  }
1578}
1579
1580if (!is_ios && !spirv_is_winuwp && spvtools_build_executables) {
1581  # iOS and UWP do not allow std::system calls which spirv-reduce
1582  # requires.
1583
1584  executable("spirv-reduce") {
1585    sources = [ "tools/reduce/reduce.cpp" ]
1586    deps = [
1587      ":spvtools",
1588      ":spvtools_opt",
1589      ":spvtools_reduce",
1590      ":spvtools_software_version",
1591      ":spvtools_tools_util",
1592      ":spvtools_tools_io",
1593      ":spvtools_val",
1594    ]
1595    configs += [ ":spvtools_internal_config" ]
1596  }
1597}
1598
1599if (spvtools_build_executables){
1600  group("all_spirv_tools") {
1601    deps = [
1602      ":spirv-as",
1603      ":spirv-cfg",
1604      ":spirv-dis",
1605      ":spirv-link",
1606      ":spirv-opt",
1607      ":spirv-val",
1608    ]
1609    if (!is_ios && !spirv_is_winuwp && build_with_chromium) {
1610      deps += [ ":spirv-fuzz" ]
1611    }
1612    if (!is_ios && !spirv_is_winuwp) {
1613      deps += [ ":spirv-reduce" ]
1614    }
1615  }
1616}
1617