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