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.shader.debuginfo.100",
332    "SHDEBUG100_",
333  ],
334]
335
336foreach(table_def, spvtools_vendor_tables) {
337  spvtools_vendor_table(table_def[0]) {
338    name = table_def[0]
339    operand_kind_prefix = table_def[1]
340  }
341}
342
343config("spvtools_public_config") {
344  include_dirs = [ "include" ]
345}
346
347config("spvtools_include_gen_dirs") {
348  include_dirs = [ "$target_gen_dir" ]
349}
350
351config("spvtools_internal_config") {
352  include_dirs = [
353    ".",
354    "${spirv_headers}/include",
355  ]
356
357  configs = [
358    ":spvtools_public_config",
359    ":spvtools_include_gen_dirs",
360  ]
361
362  cflags = []
363  if (is_clang) {
364    cflags += [
365      "-Wno-implicit-fallthrough",
366      "-Wno-newline-eof",
367      "-Wno-unreachable-code-break",
368      "-Wno-unreachable-code-return",
369    ]
370  } else if (!is_win) {
371    # Work around a false-positive on a Skia GCC 10 builder.
372    cflags += [ "-Wno-format-truncation" ]
373  } else {
374    # Make MSVC report the correct value for __cplusplus
375    cflags += [ "/Zc:__cplusplus" ]
376  }
377
378  if (!is_win) {
379    cflags += [ "-std=c++17" ]
380  } else {
381    cflags += [ "/std:c++17" ]
382  }
383}
384
385source_set("spvtools_headers") {
386  sources = [
387    "include/spirv-tools/instrument.hpp",
388    "include/spirv-tools/libspirv.h",
389    "include/spirv-tools/libspirv.hpp",
390    "include/spirv-tools/linker.hpp",
391    "include/spirv-tools/optimizer.hpp",
392  ]
393
394  public_configs = [ ":spvtools_public_config" ]
395}
396
397group("spvtools_language_headers") {
398  public_deps = [
399    ":spvtools_language_header_cldebuginfo100",
400    ":spvtools_language_header_debuginfo",
401    ":spvtools_language_header_vkdebuginfo100",
402  ]
403}
404
405static_library("spvtools") {
406  deps = [
407    ":spvtools_core_tables_unified1",
408    ":spvtools_generators_inc",
409    ":spvtools_glsl_tables_glsl1-0",
410    ":spvtools_language_header_cldebuginfo100",
411    ":spvtools_language_header_debuginfo",
412    ":spvtools_language_header_vkdebuginfo100",
413    ":spvtools_opencl_tables_opencl1-0",
414  ]
415  foreach(table_def, spvtools_vendor_tables) {
416    target_name = table_def[0]
417    deps += [ ":spvtools_vendor_tables_$target_name" ]
418  }
419
420  sources = [
421    "source/assembly_grammar.cpp",
422    "source/assembly_grammar.h",
423    "source/binary.cpp",
424    "source/binary.h",
425    "source/cfa.h",
426    "source/common_debug_info.h",
427    "source/diagnostic.cpp",
428    "source/diagnostic.h",
429    "source/disassemble.cpp",
430    "source/disassemble.h",
431    "source/enum_set.h",
432    "source/enum_string_mapping.cpp",
433    "source/enum_string_mapping.h",
434    "source/ext_inst.cpp",
435    "source/ext_inst.h",
436    "source/extensions.cpp",
437    "source/extensions.h",
438    "source/instruction.h",
439    "source/latest_version_glsl_std_450_header.h",
440    "source/latest_version_opencl_std_header.h",
441    "source/latest_version_spirv_header.h",
442    "source/libspirv.cpp",
443    "source/macro.h",
444    "source/name_mapper.cpp",
445    "source/name_mapper.h",
446    "source/opcode.cpp",
447    "source/opcode.h",
448    "source/operand.cpp",
449    "source/operand.h",
450    "source/parsed_operand.cpp",
451    "source/parsed_operand.h",
452    "source/print.cpp",
453    "source/print.h",
454    "source/spirv_constant.h",
455    "source/spirv_definition.h",
456    "source/spirv_endian.cpp",
457    "source/spirv_endian.h",
458    "source/spirv_fuzzer_options.cpp",
459    "source/spirv_fuzzer_options.h",
460    "source/spirv_optimizer_options.cpp",
461    "source/spirv_optimizer_options.h",
462    "source/spirv_reducer_options.cpp",
463    "source/spirv_reducer_options.h",
464    "source/spirv_target_env.cpp",
465    "source/spirv_target_env.h",
466    "source/spirv_validator_options.cpp",
467    "source/spirv_validator_options.h",
468    "source/table.cpp",
469    "source/table.h",
470    "source/text.cpp",
471    "source/text.h",
472    "source/text_handler.cpp",
473    "source/text_handler.h",
474    "source/util/bit_vector.cpp",
475    "source/util/bit_vector.h",
476    "source/util/bitutils.h",
477    "source/util/hash_combine.h",
478    "source/util/hex_float.h",
479    "source/util/ilist.h",
480    "source/util/ilist_node.h",
481    "source/util/make_unique.h",
482    "source/util/parse_number.cpp",
483    "source/util/parse_number.h",
484    "source/util/small_vector.h",
485    "source/util/string_utils.cpp",
486    "source/util/string_utils.h",
487    "source/util/timer.cpp",
488    "source/util/timer.h",
489  ]
490
491  public_deps = [
492    ":spvtools_core_enums_unified1",
493    ":spvtools_headers",
494    "${spirv_headers}:spv_headers",
495  ]
496
497  if (build_with_chromium) {
498    configs -= [ "//build/config/compiler:chromium_code" ]
499    configs += [ "//build/config/compiler:no_chromium_code" ]
500  }
501  configs += [ ":spvtools_internal_config" ]
502}
503
504static_library("spvtools_val") {
505  sources = [
506    "source/val/basic_block.cpp",
507    "source/val/basic_block.h",
508    "source/val/construct.cpp",
509    "source/val/construct.h",
510    "source/val/decoration.h",
511    "source/val/function.cpp",
512    "source/val/function.h",
513    "source/val/instruction.cpp",
514    "source/val/validate.cpp",
515    "source/val/validate.h",
516    "source/val/validate_adjacency.cpp",
517    "source/val/validate_annotation.cpp",
518    "source/val/validate_arithmetics.cpp",
519    "source/val/validate_atomics.cpp",
520    "source/val/validate_barriers.cpp",
521    "source/val/validate_bitwise.cpp",
522    "source/val/validate_builtins.cpp",
523    "source/val/validate_capability.cpp",
524    "source/val/validate_cfg.cpp",
525    "source/val/validate_composites.cpp",
526    "source/val/validate_constants.cpp",
527    "source/val/validate_conversion.cpp",
528    "source/val/validate_debug.cpp",
529    "source/val/validate_decorations.cpp",
530    "source/val/validate_derivatives.cpp",
531    "source/val/validate_execution_limitations.cpp",
532    "source/val/validate_extensions.cpp",
533    "source/val/validate_function.cpp",
534    "source/val/validate_id.cpp",
535    "source/val/validate_image.cpp",
536    "source/val/validate_instruction.cpp",
537    "source/val/validate_interfaces.cpp",
538    "source/val/validate_layout.cpp",
539    "source/val/validate_literals.cpp",
540    "source/val/validate_logicals.cpp",
541    "source/val/validate_memory.cpp",
542    "source/val/validate_memory_semantics.cpp",
543    "source/val/validate_memory_semantics.h",
544    "source/val/validate_mesh_shading.cpp",
545    "source/val/validate_misc.cpp",
546    "source/val/validate_mode_setting.cpp",
547    "source/val/validate_non_uniform.cpp",
548    "source/val/validate_primitives.cpp",
549    "source/val/validate_ray_query.cpp",
550    "source/val/validate_ray_tracing.cpp",
551    "source/val/validate_ray_tracing_reorder.cpp",
552    "source/val/validate_scopes.cpp",
553    "source/val/validate_scopes.h",
554    "source/val/validate_small_type_uses.cpp",
555    "source/val/validate_type.cpp",
556    "source/val/validation_state.cpp",
557    "source/val/validation_state.h",
558  ]
559
560  deps = [
561    ":spvtools",
562    ":spvtools_language_header_cldebuginfo100",
563    ":spvtools_language_header_debuginfo",
564    ":spvtools_language_header_vkdebuginfo100",
565  ]
566  public_deps = [ ":spvtools_headers" ]
567
568  if (build_with_chromium) {
569    configs -= [ "//build/config/compiler:chromium_code" ]
570    configs += [ "//build/config/compiler:no_chromium_code" ]
571  }
572  configs += [ ":spvtools_internal_config" ]
573}
574
575static_library("spvtools_opt") {
576  sources = [
577    "source/opt/aggressive_dead_code_elim_pass.cpp",
578    "source/opt/aggressive_dead_code_elim_pass.h",
579    "source/opt/amd_ext_to_khr.cpp",
580    "source/opt/amd_ext_to_khr.h",
581    "source/opt/analyze_live_input_pass.cpp",
582    "source/opt/analyze_live_input_pass.h",
583    "source/opt/basic_block.cpp",
584    "source/opt/basic_block.h",
585    "source/opt/block_merge_pass.cpp",
586    "source/opt/block_merge_pass.h",
587    "source/opt/block_merge_util.cpp",
588    "source/opt/block_merge_util.h",
589    "source/opt/build_module.cpp",
590    "source/opt/build_module.h",
591    "source/opt/ccp_pass.cpp",
592    "source/opt/ccp_pass.h",
593    "source/opt/cfg.cpp",
594    "source/opt/cfg.h",
595    "source/opt/cfg_cleanup_pass.cpp",
596    "source/opt/cfg_cleanup_pass.h",
597    "source/opt/code_sink.cpp",
598    "source/opt/code_sink.h",
599    "source/opt/combine_access_chains.cpp",
600    "source/opt/combine_access_chains.h",
601    "source/opt/compact_ids_pass.cpp",
602    "source/opt/compact_ids_pass.h",
603    "source/opt/composite.cpp",
604    "source/opt/composite.h",
605    "source/opt/const_folding_rules.cpp",
606    "source/opt/const_folding_rules.h",
607    "source/opt/constants.cpp",
608    "source/opt/constants.h",
609    "source/opt/control_dependence.cpp",
610    "source/opt/control_dependence.h",
611    "source/opt/convert_to_half_pass.cpp",
612    "source/opt/convert_to_half_pass.h",
613    "source/opt/convert_to_sampled_image_pass.cpp",
614    "source/opt/convert_to_sampled_image_pass.h",
615    "source/opt/copy_prop_arrays.cpp",
616    "source/opt/copy_prop_arrays.h",
617    "source/opt/dataflow.cpp",
618    "source/opt/dataflow.h",
619    "source/opt/dead_branch_elim_pass.cpp",
620    "source/opt/dead_branch_elim_pass.h",
621    "source/opt/dead_insert_elim_pass.cpp",
622    "source/opt/dead_insert_elim_pass.h",
623    "source/opt/dead_variable_elimination.cpp",
624    "source/opt/dead_variable_elimination.h",
625    "source/opt/debug_info_manager.cpp",
626    "source/opt/debug_info_manager.h",
627    "source/opt/decoration_manager.cpp",
628    "source/opt/decoration_manager.h",
629    "source/opt/def_use_manager.cpp",
630    "source/opt/def_use_manager.h",
631    "source/opt/desc_sroa.cpp",
632    "source/opt/desc_sroa.h",
633    "source/opt/desc_sroa_util.cpp",
634    "source/opt/desc_sroa_util.h",
635    "source/opt/dominator_analysis.cpp",
636    "source/opt/dominator_analysis.h",
637    "source/opt/dominator_tree.cpp",
638    "source/opt/dominator_tree.h",
639    "source/opt/eliminate_dead_constant_pass.cpp",
640    "source/opt/eliminate_dead_constant_pass.h",
641    "source/opt/eliminate_dead_functions_pass.cpp",
642    "source/opt/eliminate_dead_functions_pass.h",
643    "source/opt/eliminate_dead_functions_util.cpp",
644    "source/opt/eliminate_dead_functions_util.h",
645    "source/opt/eliminate_dead_io_components_pass.cpp",
646    "source/opt/eliminate_dead_io_components_pass.h",
647    "source/opt/eliminate_dead_members_pass.cpp",
648    "source/opt/eliminate_dead_members_pass.h",
649    "source/opt/eliminate_dead_output_stores_pass.cpp",
650    "source/opt/eliminate_dead_output_stores_pass.h",
651    "source/opt/empty_pass.h",
652    "source/opt/feature_manager.cpp",
653    "source/opt/feature_manager.h",
654    "source/opt/fix_func_call_arguments.cpp",
655    "source/opt/fix_func_call_arguments.h",
656    "source/opt/fix_storage_class.cpp",
657    "source/opt/fix_storage_class.h",
658    "source/opt/flatten_decoration_pass.cpp",
659    "source/opt/flatten_decoration_pass.h",
660    "source/opt/fold.cpp",
661    "source/opt/fold.h",
662    "source/opt/fold_spec_constant_op_and_composite_pass.cpp",
663    "source/opt/fold_spec_constant_op_and_composite_pass.h",
664    "source/opt/folding_rules.cpp",
665    "source/opt/folding_rules.h",
666    "source/opt/freeze_spec_constant_value_pass.cpp",
667    "source/opt/freeze_spec_constant_value_pass.h",
668    "source/opt/function.cpp",
669    "source/opt/function.h",
670    "source/opt/graphics_robust_access_pass.cpp",
671    "source/opt/graphics_robust_access_pass.h",
672    "source/opt/if_conversion.cpp",
673    "source/opt/if_conversion.h",
674    "source/opt/inline_exhaustive_pass.cpp",
675    "source/opt/inline_exhaustive_pass.h",
676    "source/opt/inline_opaque_pass.cpp",
677    "source/opt/inline_opaque_pass.h",
678    "source/opt/inline_pass.cpp",
679    "source/opt/inline_pass.h",
680    "source/opt/inst_bindless_check_pass.cpp",
681    "source/opt/inst_bindless_check_pass.h",
682    "source/opt/inst_buff_addr_check_pass.cpp",
683    "source/opt/inst_buff_addr_check_pass.h",
684    "source/opt/inst_debug_printf_pass.cpp",
685    "source/opt/inst_debug_printf_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/instrument_pass.cpp",
691    "source/opt/instrument_pass.h",
692    "source/opt/interface_var_sroa.cpp",
693    "source/opt/interface_var_sroa.h",
694    "source/opt/interp_fixup_pass.cpp",
695    "source/opt/interp_fixup_pass.h",
696    "source/opt/invocation_interlock_placement_pass.cpp",
697    "source/opt/invocation_interlock_placement_pass.h",
698    "source/opt/ir_builder.h",
699    "source/opt/ir_context.cpp",
700    "source/opt/ir_context.h",
701    "source/opt/ir_loader.cpp",
702    "source/opt/ir_loader.h",
703    "source/opt/iterator.h",
704    "source/opt/licm_pass.cpp",
705    "source/opt/licm_pass.h",
706    "source/opt/liveness.cpp",
707    "source/opt/liveness.h",
708    "source/opt/local_access_chain_convert_pass.cpp",
709    "source/opt/local_access_chain_convert_pass.h",
710    "source/opt/local_redundancy_elimination.cpp",
711    "source/opt/local_redundancy_elimination.h",
712    "source/opt/local_single_block_elim_pass.cpp",
713    "source/opt/local_single_block_elim_pass.h",
714    "source/opt/local_single_store_elim_pass.cpp",
715    "source/opt/local_single_store_elim_pass.h",
716    "source/opt/log.h",
717    "source/opt/loop_dependence.cpp",
718    "source/opt/loop_dependence.h",
719    "source/opt/loop_dependence_helpers.cpp",
720    "source/opt/loop_descriptor.cpp",
721    "source/opt/loop_descriptor.h",
722    "source/opt/loop_fission.cpp",
723    "source/opt/loop_fission.h",
724    "source/opt/loop_fusion.cpp",
725    "source/opt/loop_fusion.h",
726    "source/opt/loop_fusion_pass.cpp",
727    "source/opt/loop_fusion_pass.h",
728    "source/opt/loop_peeling.cpp",
729    "source/opt/loop_peeling.h",
730    "source/opt/loop_unroller.cpp",
731    "source/opt/loop_unroller.h",
732    "source/opt/loop_unswitch_pass.cpp",
733    "source/opt/loop_unswitch_pass.h",
734    "source/opt/loop_utils.cpp",
735    "source/opt/loop_utils.h",
736    "source/opt/mem_pass.cpp",
737    "source/opt/mem_pass.h",
738    "source/opt/merge_return_pass.cpp",
739    "source/opt/merge_return_pass.h",
740    "source/opt/modify_maximal_reconvergence.cpp",
741    "source/opt/modify_maximal_reconvergence.h",
742    "source/opt/module.cpp",
743    "source/opt/module.h",
744    "source/opt/null_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_cfg_analysis.cpp",
795    "source/opt/struct_cfg_analysis.h",
796    "source/opt/switch_descriptorset_pass.cpp",
797    "source/opt/switch_descriptorset_pass.h",
798    "source/opt/tree_iterator.h",
799    "source/opt/trim_capabilities_pass.cpp",
800    "source/opt/trim_capabilities_pass.h",
801    "source/opt/type_manager.cpp",
802    "source/opt/type_manager.h",
803    "source/opt/types.cpp",
804    "source/opt/types.h",
805    "source/opt/unify_const_pass.cpp",
806    "source/opt/unify_const_pass.h",
807    "source/opt/upgrade_memory_model.cpp",
808    "source/opt/upgrade_memory_model.h",
809    "source/opt/value_number_table.cpp",
810    "source/opt/value_number_table.h",
811    "source/opt/vector_dce.cpp",
812    "source/opt/vector_dce.h",
813    "source/opt/workaround1209.cpp",
814    "source/opt/workaround1209.h",
815    "source/opt/wrap_opkill.cpp",
816    "source/opt/wrap_opkill.h",
817  ]
818
819  deps = [
820    ":spvtools",
821    ":spvtools_language_header_debuginfo",
822    ":spvtools_vendor_tables_spv-amd-shader-ballot",
823  ]
824  public_deps = [
825    ":spvtools_headers",
826    ":spvtools_language_header_cldebuginfo100",
827    ":spvtools_language_header_vkdebuginfo100",
828  ]
829
830  if (build_with_chromium) {
831    configs -= [ "//build/config/compiler:chromium_code" ]
832    configs += [ "//build/config/compiler:no_chromium_code" ]
833  }
834  configs += [ ":spvtools_internal_config" ]
835}
836
837static_library("spvtools_link") {
838  sources = [ "source/link/linker.cpp" ]
839  deps = [
840    ":spvtools",
841    ":spvtools_opt",
842    ":spvtools_val",
843  ]
844  public_deps = [ ":spvtools_headers" ]
845  if (build_with_chromium) {
846    configs -= [ "//build/config/compiler:chromium_code" ]
847    configs += [ "//build/config/compiler:no_chromium_code" ]
848  }
849  configs += [ ":spvtools_internal_config" ]
850}
851
852static_library("spvtools_reduce") {
853  sources = [
854    "source/reduce/change_operand_reduction_opportunity.cpp",
855    "source/reduce/change_operand_reduction_opportunity.h",
856    "source/reduce/change_operand_to_undef_reduction_opportunity.cpp",
857    "source/reduce/change_operand_to_undef_reduction_opportunity.h",
858    "source/reduce/conditional_branch_to_simple_conditional_branch_opportunity_finder.cpp",
859    "source/reduce/conditional_branch_to_simple_conditional_branch_opportunity_finder.h",
860    "source/reduce/conditional_branch_to_simple_conditional_branch_reduction_opportunity.cpp",
861    "source/reduce/conditional_branch_to_simple_conditional_branch_reduction_opportunity.h",
862    "source/reduce/merge_blocks_reduction_opportunity.cpp",
863    "source/reduce/merge_blocks_reduction_opportunity.h",
864    "source/reduce/merge_blocks_reduction_opportunity_finder.cpp",
865    "source/reduce/merge_blocks_reduction_opportunity_finder.h",
866    "source/reduce/operand_to_const_reduction_opportunity_finder.cpp",
867    "source/reduce/operand_to_const_reduction_opportunity_finder.h",
868    "source/reduce/operand_to_dominating_id_reduction_opportunity_finder.cpp",
869    "source/reduce/operand_to_dominating_id_reduction_opportunity_finder.h",
870    "source/reduce/operand_to_undef_reduction_opportunity_finder.cpp",
871    "source/reduce/operand_to_undef_reduction_opportunity_finder.h",
872    "source/reduce/reducer.cpp",
873    "source/reduce/reducer.h",
874    "source/reduce/reduction_opportunity.cpp",
875    "source/reduce/reduction_opportunity.h",
876    "source/reduce/reduction_opportunity_finder.cpp",
877    "source/reduce/reduction_opportunity_finder.h",
878    "source/reduce/reduction_pass.cpp",
879    "source/reduce/reduction_pass.h",
880    "source/reduce/reduction_util.cpp",
881    "source/reduce/reduction_util.h",
882    "source/reduce/remove_block_reduction_opportunity.cpp",
883    "source/reduce/remove_block_reduction_opportunity.h",
884    "source/reduce/remove_block_reduction_opportunity_finder.cpp",
885    "source/reduce/remove_block_reduction_opportunity_finder.h",
886    "source/reduce/remove_function_reduction_opportunity.cpp",
887    "source/reduce/remove_function_reduction_opportunity.h",
888    "source/reduce/remove_function_reduction_opportunity_finder.cpp",
889    "source/reduce/remove_function_reduction_opportunity_finder.h",
890    "source/reduce/remove_instruction_reduction_opportunity.cpp",
891    "source/reduce/remove_instruction_reduction_opportunity.h",
892    "source/reduce/remove_selection_reduction_opportunity.cpp",
893    "source/reduce/remove_selection_reduction_opportunity.h",
894    "source/reduce/remove_selection_reduction_opportunity_finder.cpp",
895    "source/reduce/remove_selection_reduction_opportunity_finder.h",
896    "source/reduce/remove_struct_member_reduction_opportunity.cpp",
897    "source/reduce/remove_struct_member_reduction_opportunity.h",
898    "source/reduce/remove_unused_instruction_reduction_opportunity_finder.cpp",
899    "source/reduce/remove_unused_instruction_reduction_opportunity_finder.h",
900    "source/reduce/remove_unused_struct_member_reduction_opportunity_finder.cpp",
901    "source/reduce/remove_unused_struct_member_reduction_opportunity_finder.h",
902    "source/reduce/simple_conditional_branch_to_branch_opportunity_finder.cpp",
903    "source/reduce/simple_conditional_branch_to_branch_opportunity_finder.h",
904    "source/reduce/simple_conditional_branch_to_branch_reduction_opportunity.cpp",
905    "source/reduce/simple_conditional_branch_to_branch_reduction_opportunity.h",
906    "source/reduce/structured_construct_to_block_reduction_opportunity.cpp",
907    "source/reduce/structured_construct_to_block_reduction_opportunity.h",
908    "source/reduce/structured_construct_to_block_reduction_opportunity_finder.cpp",
909    "source/reduce/structured_construct_to_block_reduction_opportunity_finder.h",
910    "source/reduce/structured_loop_to_selection_reduction_opportunity.cpp",
911    "source/reduce/structured_loop_to_selection_reduction_opportunity.h",
912    "source/reduce/structured_loop_to_selection_reduction_opportunity_finder.cpp",
913    "source/reduce/structured_loop_to_selection_reduction_opportunity_finder.h",
914  ]
915  deps = [
916    ":spvtools",
917    ":spvtools_opt",
918  ]
919  public_deps = [ ":spvtools_headers" ]
920  if (build_with_chromium) {
921    configs -= [ "//build/config/compiler:chromium_code" ]
922    configs += [ "//build/config/compiler:no_chromium_code" ]
923  }
924  configs += [ ":spvtools_internal_config" ]
925}
926
927if (build_with_chromium && spvtools_build_executables) {
928  # The spirv-fuzz library is only built when in a Chromium checkout
929  # due to its dependency on protobuf.
930
931  proto_library("spvtools_fuzz_proto") {
932    sources = [ "source/fuzz/protobufs/spvtoolsfuzz.proto" ]
933    generate_python = false
934    use_protobuf_full = true
935  }
936
937  static_library("spvtools_fuzz") {
938    sources = [
939      "source/fuzz/added_function_reducer.cpp",
940      "source/fuzz/added_function_reducer.h",
941      "source/fuzz/available_instructions.cpp",
942      "source/fuzz/available_instructions.h",
943      "source/fuzz/call_graph.cpp",
944      "source/fuzz/call_graph.h",
945      "source/fuzz/comparator_deep_blocks_first.h",
946      "source/fuzz/counter_overflow_id_source.cpp",
947      "source/fuzz/counter_overflow_id_source.h",
948      "source/fuzz/data_descriptor.cpp",
949      "source/fuzz/data_descriptor.h",
950      "source/fuzz/equivalence_relation.h",
951      "source/fuzz/fact_manager/constant_uniform_facts.cpp",
952      "source/fuzz/fact_manager/constant_uniform_facts.h",
953      "source/fuzz/fact_manager/data_synonym_and_id_equation_facts.cpp",
954      "source/fuzz/fact_manager/data_synonym_and_id_equation_facts.h",
955      "source/fuzz/fact_manager/dead_block_facts.cpp",
956      "source/fuzz/fact_manager/dead_block_facts.h",
957      "source/fuzz/fact_manager/fact_manager.cpp",
958      "source/fuzz/fact_manager/fact_manager.h",
959      "source/fuzz/fact_manager/irrelevant_value_facts.cpp",
960      "source/fuzz/fact_manager/irrelevant_value_facts.h",
961      "source/fuzz/fact_manager/livesafe_function_facts.cpp",
962      "source/fuzz/fact_manager/livesafe_function_facts.h",
963      "source/fuzz/force_render_red.cpp",
964      "source/fuzz/force_render_red.h",
965      "source/fuzz/fuzzer.cpp",
966      "source/fuzz/fuzzer.h",
967      "source/fuzz/fuzzer_context.cpp",
968      "source/fuzz/fuzzer_context.h",
969      "source/fuzz/fuzzer_pass.cpp",
970      "source/fuzz/fuzzer_pass.h",
971      "source/fuzz/fuzzer_pass_add_access_chains.cpp",
972      "source/fuzz/fuzzer_pass_add_access_chains.h",
973      "source/fuzz/fuzzer_pass_add_bit_instruction_synonyms.cpp",
974      "source/fuzz/fuzzer_pass_add_bit_instruction_synonyms.h",
975      "source/fuzz/fuzzer_pass_add_composite_extract.cpp",
976      "source/fuzz/fuzzer_pass_add_composite_extract.h",
977      "source/fuzz/fuzzer_pass_add_composite_inserts.cpp",
978      "source/fuzz/fuzzer_pass_add_composite_inserts.h",
979      "source/fuzz/fuzzer_pass_add_composite_types.cpp",
980      "source/fuzz/fuzzer_pass_add_composite_types.h",
981      "source/fuzz/fuzzer_pass_add_copy_memory.cpp",
982      "source/fuzz/fuzzer_pass_add_copy_memory.h",
983      "source/fuzz/fuzzer_pass_add_dead_blocks.cpp",
984      "source/fuzz/fuzzer_pass_add_dead_blocks.h",
985      "source/fuzz/fuzzer_pass_add_dead_breaks.cpp",
986      "source/fuzz/fuzzer_pass_add_dead_breaks.h",
987      "source/fuzz/fuzzer_pass_add_dead_continues.cpp",
988      "source/fuzz/fuzzer_pass_add_dead_continues.h",
989      "source/fuzz/fuzzer_pass_add_equation_instructions.cpp",
990      "source/fuzz/fuzzer_pass_add_equation_instructions.h",
991      "source/fuzz/fuzzer_pass_add_function_calls.cpp",
992      "source/fuzz/fuzzer_pass_add_function_calls.h",
993      "source/fuzz/fuzzer_pass_add_global_variables.cpp",
994      "source/fuzz/fuzzer_pass_add_global_variables.h",
995      "source/fuzz/fuzzer_pass_add_image_sample_unused_components.cpp",
996      "source/fuzz/fuzzer_pass_add_image_sample_unused_components.h",
997      "source/fuzz/fuzzer_pass_add_loads.cpp",
998      "source/fuzz/fuzzer_pass_add_loads.h",
999      "source/fuzz/fuzzer_pass_add_local_variables.cpp",
1000      "source/fuzz/fuzzer_pass_add_local_variables.h",
1001      "source/fuzz/fuzzer_pass_add_loop_preheaders.cpp",
1002      "source/fuzz/fuzzer_pass_add_loop_preheaders.h",
1003      "source/fuzz/fuzzer_pass_add_loops_to_create_int_constant_synonyms.cpp",
1004      "source/fuzz/fuzzer_pass_add_loops_to_create_int_constant_synonyms.h",
1005      "source/fuzz/fuzzer_pass_add_no_contraction_decorations.cpp",
1006      "source/fuzz/fuzzer_pass_add_no_contraction_decorations.h",
1007      "source/fuzz/fuzzer_pass_add_opphi_synonyms.cpp",
1008      "source/fuzz/fuzzer_pass_add_opphi_synonyms.h",
1009      "source/fuzz/fuzzer_pass_add_parameters.cpp",
1010      "source/fuzz/fuzzer_pass_add_parameters.h",
1011      "source/fuzz/fuzzer_pass_add_relaxed_decorations.cpp",
1012      "source/fuzz/fuzzer_pass_add_relaxed_decorations.h",
1013      "source/fuzz/fuzzer_pass_add_stores.cpp",
1014      "source/fuzz/fuzzer_pass_add_stores.h",
1015      "source/fuzz/fuzzer_pass_add_synonyms.cpp",
1016      "source/fuzz/fuzzer_pass_add_synonyms.h",
1017      "source/fuzz/fuzzer_pass_add_vector_shuffle_instructions.cpp",
1018      "source/fuzz/fuzzer_pass_add_vector_shuffle_instructions.h",
1019      "source/fuzz/fuzzer_pass_adjust_branch_weights.cpp",
1020      "source/fuzz/fuzzer_pass_adjust_branch_weights.h",
1021      "source/fuzz/fuzzer_pass_adjust_function_controls.cpp",
1022      "source/fuzz/fuzzer_pass_adjust_function_controls.h",
1023      "source/fuzz/fuzzer_pass_adjust_loop_controls.cpp",
1024      "source/fuzz/fuzzer_pass_adjust_loop_controls.h",
1025      "source/fuzz/fuzzer_pass_adjust_memory_operands_masks.cpp",
1026      "source/fuzz/fuzzer_pass_adjust_memory_operands_masks.h",
1027      "source/fuzz/fuzzer_pass_adjust_selection_controls.cpp",
1028      "source/fuzz/fuzzer_pass_adjust_selection_controls.h",
1029      "source/fuzz/fuzzer_pass_apply_id_synonyms.cpp",
1030      "source/fuzz/fuzzer_pass_apply_id_synonyms.h",
1031      "source/fuzz/fuzzer_pass_construct_composites.cpp",
1032      "source/fuzz/fuzzer_pass_construct_composites.h",
1033      "source/fuzz/fuzzer_pass_copy_objects.cpp",
1034      "source/fuzz/fuzzer_pass_copy_objects.h",
1035      "source/fuzz/fuzzer_pass_donate_modules.cpp",
1036      "source/fuzz/fuzzer_pass_donate_modules.h",
1037      "source/fuzz/fuzzer_pass_duplicate_regions_with_selections.cpp",
1038      "source/fuzz/fuzzer_pass_duplicate_regions_with_selections.h",
1039      "source/fuzz/fuzzer_pass_expand_vector_reductions.cpp",
1040      "source/fuzz/fuzzer_pass_expand_vector_reductions.h",
1041      "source/fuzz/fuzzer_pass_flatten_conditional_branches.cpp",
1042      "source/fuzz/fuzzer_pass_flatten_conditional_branches.h",
1043      "source/fuzz/fuzzer_pass_inline_functions.cpp",
1044      "source/fuzz/fuzzer_pass_inline_functions.h",
1045      "source/fuzz/fuzzer_pass_interchange_signedness_of_integer_operands.cpp",
1046      "source/fuzz/fuzzer_pass_interchange_signedness_of_integer_operands.h",
1047      "source/fuzz/fuzzer_pass_interchange_zero_like_constants.cpp",
1048      "source/fuzz/fuzzer_pass_interchange_zero_like_constants.h",
1049      "source/fuzz/fuzzer_pass_invert_comparison_operators.cpp",
1050      "source/fuzz/fuzzer_pass_invert_comparison_operators.h",
1051      "source/fuzz/fuzzer_pass_make_vector_operations_dynamic.cpp",
1052      "source/fuzz/fuzzer_pass_make_vector_operations_dynamic.h",
1053      "source/fuzz/fuzzer_pass_merge_blocks.cpp",
1054      "source/fuzz/fuzzer_pass_merge_blocks.h",
1055      "source/fuzz/fuzzer_pass_merge_function_returns.cpp",
1056      "source/fuzz/fuzzer_pass_merge_function_returns.h",
1057      "source/fuzz/fuzzer_pass_mutate_pointers.cpp",
1058      "source/fuzz/fuzzer_pass_mutate_pointers.h",
1059      "source/fuzz/fuzzer_pass_obfuscate_constants.cpp",
1060      "source/fuzz/fuzzer_pass_obfuscate_constants.h",
1061      "source/fuzz/fuzzer_pass_outline_functions.cpp",
1062      "source/fuzz/fuzzer_pass_outline_functions.h",
1063      "source/fuzz/fuzzer_pass_permute_blocks.cpp",
1064      "source/fuzz/fuzzer_pass_permute_blocks.h",
1065      "source/fuzz/fuzzer_pass_permute_function_parameters.cpp",
1066      "source/fuzz/fuzzer_pass_permute_function_parameters.h",
1067      "source/fuzz/fuzzer_pass_permute_function_variables.cpp",
1068      "source/fuzz/fuzzer_pass_permute_function_variables.h",
1069      "source/fuzz/fuzzer_pass_permute_instructions.cpp",
1070      "source/fuzz/fuzzer_pass_permute_instructions.h",
1071      "source/fuzz/fuzzer_pass_permute_phi_operands.cpp",
1072      "source/fuzz/fuzzer_pass_permute_phi_operands.h",
1073      "source/fuzz/fuzzer_pass_propagate_instructions_down.cpp",
1074      "source/fuzz/fuzzer_pass_propagate_instructions_down.h",
1075      "source/fuzz/fuzzer_pass_propagate_instructions_up.cpp",
1076      "source/fuzz/fuzzer_pass_propagate_instructions_up.h",
1077      "source/fuzz/fuzzer_pass_push_ids_through_variables.cpp",
1078      "source/fuzz/fuzzer_pass_push_ids_through_variables.h",
1079      "source/fuzz/fuzzer_pass_replace_adds_subs_muls_with_carrying_extended.cpp",
1080      "source/fuzz/fuzzer_pass_replace_adds_subs_muls_with_carrying_extended.h",
1081      "source/fuzz/fuzzer_pass_replace_branches_from_dead_blocks_with_exits.cpp",
1082      "source/fuzz/fuzzer_pass_replace_branches_from_dead_blocks_with_exits.h",
1083      "source/fuzz/fuzzer_pass_replace_copy_memories_with_loads_stores.cpp",
1084      "source/fuzz/fuzzer_pass_replace_copy_memories_with_loads_stores.h",
1085      "source/fuzz/fuzzer_pass_replace_copy_objects_with_stores_loads.cpp",
1086      "source/fuzz/fuzzer_pass_replace_copy_objects_with_stores_loads.h",
1087      "source/fuzz/fuzzer_pass_replace_irrelevant_ids.cpp",
1088      "source/fuzz/fuzzer_pass_replace_irrelevant_ids.h",
1089      "source/fuzz/fuzzer_pass_replace_linear_algebra_instructions.cpp",
1090      "source/fuzz/fuzzer_pass_replace_linear_algebra_instructions.h",
1091      "source/fuzz/fuzzer_pass_replace_loads_stores_with_copy_memories.cpp",
1092      "source/fuzz/fuzzer_pass_replace_loads_stores_with_copy_memories.h",
1093      "source/fuzz/fuzzer_pass_replace_opphi_ids_from_dead_predecessors.cpp",
1094      "source/fuzz/fuzzer_pass_replace_opphi_ids_from_dead_predecessors.h",
1095      "source/fuzz/fuzzer_pass_replace_opselects_with_conditional_branches.cpp",
1096      "source/fuzz/fuzzer_pass_replace_opselects_with_conditional_branches.h",
1097      "source/fuzz/fuzzer_pass_replace_parameter_with_global.cpp",
1098      "source/fuzz/fuzzer_pass_replace_parameter_with_global.h",
1099      "source/fuzz/fuzzer_pass_replace_params_with_struct.cpp",
1100      "source/fuzz/fuzzer_pass_replace_params_with_struct.h",
1101      "source/fuzz/fuzzer_pass_split_blocks.cpp",
1102      "source/fuzz/fuzzer_pass_split_blocks.h",
1103      "source/fuzz/fuzzer_pass_swap_commutable_operands.cpp",
1104      "source/fuzz/fuzzer_pass_swap_commutable_operands.h",
1105      "source/fuzz/fuzzer_pass_swap_conditional_branch_operands.cpp",
1106      "source/fuzz/fuzzer_pass_swap_conditional_branch_operands.h",
1107      "source/fuzz/fuzzer_pass_swap_functions.cpp",
1108      "source/fuzz/fuzzer_pass_swap_functions.h",
1109      "source/fuzz/fuzzer_pass_toggle_access_chain_instruction.cpp",
1110      "source/fuzz/fuzzer_pass_toggle_access_chain_instruction.h",
1111      "source/fuzz/fuzzer_pass_wrap_regions_in_selections.cpp",
1112      "source/fuzz/fuzzer_pass_wrap_regions_in_selections.h",
1113      "source/fuzz/fuzzer_pass_wrap_vector_synonym.cpp",
1114      "source/fuzz/fuzzer_pass_wrap_vector_synonym.h",
1115      "source/fuzz/fuzzer_util.cpp",
1116      "source/fuzz/fuzzer_util.h",
1117      "source/fuzz/id_use_descriptor.cpp",
1118      "source/fuzz/id_use_descriptor.h",
1119      "source/fuzz/instruction_descriptor.cpp",
1120      "source/fuzz/instruction_descriptor.h",
1121      "source/fuzz/instruction_message.cpp",
1122      "source/fuzz/instruction_message.h",
1123      "source/fuzz/overflow_id_source.cpp",
1124      "source/fuzz/overflow_id_source.h",
1125      "source/fuzz/pass_management/repeated_pass_instances.h",
1126      "source/fuzz/pass_management/repeated_pass_manager.cpp",
1127      "source/fuzz/pass_management/repeated_pass_manager.h",
1128      "source/fuzz/pass_management/repeated_pass_manager_looped_with_recommendations.cpp",
1129      "source/fuzz/pass_management/repeated_pass_manager_looped_with_recommendations.h",
1130      "source/fuzz/pass_management/repeated_pass_manager_random_with_recommendations.cpp",
1131      "source/fuzz/pass_management/repeated_pass_manager_random_with_recommendations.h",
1132      "source/fuzz/pass_management/repeated_pass_manager_simple.cpp",
1133      "source/fuzz/pass_management/repeated_pass_manager_simple.h",
1134      "source/fuzz/pass_management/repeated_pass_recommender.cpp",
1135      "source/fuzz/pass_management/repeated_pass_recommender.h",
1136      "source/fuzz/pass_management/repeated_pass_recommender_standard.cpp",
1137      "source/fuzz/pass_management/repeated_pass_recommender_standard.h",
1138      "source/fuzz/protobufs/spirvfuzz_protobufs.h",
1139      "source/fuzz/pseudo_random_generator.cpp",
1140      "source/fuzz/pseudo_random_generator.h",
1141      "source/fuzz/random_generator.cpp",
1142      "source/fuzz/random_generator.h",
1143      "source/fuzz/replayer.cpp",
1144      "source/fuzz/replayer.h",
1145      "source/fuzz/shrinker.cpp",
1146      "source/fuzz/shrinker.h",
1147      "source/fuzz/transformation.cpp",
1148      "source/fuzz/transformation.h",
1149      "source/fuzz/transformation_access_chain.cpp",
1150      "source/fuzz/transformation_access_chain.h",
1151      "source/fuzz/transformation_add_bit_instruction_synonym.cpp",
1152      "source/fuzz/transformation_add_bit_instruction_synonym.h",
1153      "source/fuzz/transformation_add_constant_boolean.cpp",
1154      "source/fuzz/transformation_add_constant_boolean.h",
1155      "source/fuzz/transformation_add_constant_composite.cpp",
1156      "source/fuzz/transformation_add_constant_composite.h",
1157      "source/fuzz/transformation_add_constant_null.cpp",
1158      "source/fuzz/transformation_add_constant_null.h",
1159      "source/fuzz/transformation_add_constant_scalar.cpp",
1160      "source/fuzz/transformation_add_constant_scalar.h",
1161      "source/fuzz/transformation_add_copy_memory.cpp",
1162      "source/fuzz/transformation_add_copy_memory.h",
1163      "source/fuzz/transformation_add_dead_block.cpp",
1164      "source/fuzz/transformation_add_dead_block.h",
1165      "source/fuzz/transformation_add_dead_break.cpp",
1166      "source/fuzz/transformation_add_dead_break.h",
1167      "source/fuzz/transformation_add_dead_continue.cpp",
1168      "source/fuzz/transformation_add_dead_continue.h",
1169      "source/fuzz/transformation_add_early_terminator_wrapper.cpp",
1170      "source/fuzz/transformation_add_early_terminator_wrapper.h",
1171      "source/fuzz/transformation_add_function.cpp",
1172      "source/fuzz/transformation_add_function.h",
1173      "source/fuzz/transformation_add_global_undef.cpp",
1174      "source/fuzz/transformation_add_global_undef.h",
1175      "source/fuzz/transformation_add_global_variable.cpp",
1176      "source/fuzz/transformation_add_global_variable.h",
1177      "source/fuzz/transformation_add_image_sample_unused_components.cpp",
1178      "source/fuzz/transformation_add_image_sample_unused_components.h",
1179      "source/fuzz/transformation_add_local_variable.cpp",
1180      "source/fuzz/transformation_add_local_variable.h",
1181      "source/fuzz/transformation_add_loop_preheader.cpp",
1182      "source/fuzz/transformation_add_loop_preheader.h",
1183      "source/fuzz/transformation_add_loop_to_create_int_constant_synonym.cpp",
1184      "source/fuzz/transformation_add_loop_to_create_int_constant_synonym.h",
1185      "source/fuzz/transformation_add_no_contraction_decoration.cpp",
1186      "source/fuzz/transformation_add_no_contraction_decoration.h",
1187      "source/fuzz/transformation_add_opphi_synonym.cpp",
1188      "source/fuzz/transformation_add_opphi_synonym.h",
1189      "source/fuzz/transformation_add_parameter.cpp",
1190      "source/fuzz/transformation_add_parameter.h",
1191      "source/fuzz/transformation_add_relaxed_decoration.cpp",
1192      "source/fuzz/transformation_add_relaxed_decoration.h",
1193      "source/fuzz/transformation_add_spec_constant_op.cpp",
1194      "source/fuzz/transformation_add_spec_constant_op.h",
1195      "source/fuzz/transformation_add_synonym.cpp",
1196      "source/fuzz/transformation_add_synonym.h",
1197      "source/fuzz/transformation_add_type_array.cpp",
1198      "source/fuzz/transformation_add_type_array.h",
1199      "source/fuzz/transformation_add_type_boolean.cpp",
1200      "source/fuzz/transformation_add_type_boolean.h",
1201      "source/fuzz/transformation_add_type_float.cpp",
1202      "source/fuzz/transformation_add_type_float.h",
1203      "source/fuzz/transformation_add_type_function.cpp",
1204      "source/fuzz/transformation_add_type_function.h",
1205      "source/fuzz/transformation_add_type_int.cpp",
1206      "source/fuzz/transformation_add_type_int.h",
1207      "source/fuzz/transformation_add_type_matrix.cpp",
1208      "source/fuzz/transformation_add_type_matrix.h",
1209      "source/fuzz/transformation_add_type_pointer.cpp",
1210      "source/fuzz/transformation_add_type_pointer.h",
1211      "source/fuzz/transformation_add_type_struct.cpp",
1212      "source/fuzz/transformation_add_type_struct.h",
1213      "source/fuzz/transformation_add_type_vector.cpp",
1214      "source/fuzz/transformation_add_type_vector.h",
1215      "source/fuzz/transformation_adjust_branch_weights.cpp",
1216      "source/fuzz/transformation_adjust_branch_weights.h",
1217      "source/fuzz/transformation_composite_construct.cpp",
1218      "source/fuzz/transformation_composite_construct.h",
1219      "source/fuzz/transformation_composite_extract.cpp",
1220      "source/fuzz/transformation_composite_extract.h",
1221      "source/fuzz/transformation_composite_insert.cpp",
1222      "source/fuzz/transformation_composite_insert.h",
1223      "source/fuzz/transformation_compute_data_synonym_fact_closure.cpp",
1224      "source/fuzz/transformation_compute_data_synonym_fact_closure.h",
1225      "source/fuzz/transformation_context.cpp",
1226      "source/fuzz/transformation_context.h",
1227      "source/fuzz/transformation_duplicate_region_with_selection.cpp",
1228      "source/fuzz/transformation_duplicate_region_with_selection.h",
1229      "source/fuzz/transformation_equation_instruction.cpp",
1230      "source/fuzz/transformation_equation_instruction.h",
1231      "source/fuzz/transformation_expand_vector_reduction.cpp",
1232      "source/fuzz/transformation_expand_vector_reduction.h",
1233      "source/fuzz/transformation_flatten_conditional_branch.cpp",
1234      "source/fuzz/transformation_flatten_conditional_branch.h",
1235      "source/fuzz/transformation_function_call.cpp",
1236      "source/fuzz/transformation_function_call.h",
1237      "source/fuzz/transformation_inline_function.cpp",
1238      "source/fuzz/transformation_inline_function.h",
1239      "source/fuzz/transformation_invert_comparison_operator.cpp",
1240      "source/fuzz/transformation_invert_comparison_operator.h",
1241      "source/fuzz/transformation_load.cpp",
1242      "source/fuzz/transformation_load.h",
1243      "source/fuzz/transformation_make_vector_operation_dynamic.cpp",
1244      "source/fuzz/transformation_make_vector_operation_dynamic.h",
1245      "source/fuzz/transformation_merge_blocks.cpp",
1246      "source/fuzz/transformation_merge_blocks.h",
1247      "source/fuzz/transformation_merge_function_returns.cpp",
1248      "source/fuzz/transformation_merge_function_returns.h",
1249      "source/fuzz/transformation_move_block_down.cpp",
1250      "source/fuzz/transformation_move_block_down.h",
1251      "source/fuzz/transformation_move_instruction_down.cpp",
1252      "source/fuzz/transformation_move_instruction_down.h",
1253      "source/fuzz/transformation_mutate_pointer.cpp",
1254      "source/fuzz/transformation_mutate_pointer.h",
1255      "source/fuzz/transformation_outline_function.cpp",
1256      "source/fuzz/transformation_outline_function.h",
1257      "source/fuzz/transformation_permute_function_parameters.cpp",
1258      "source/fuzz/transformation_permute_function_parameters.h",
1259      "source/fuzz/transformation_permute_phi_operands.cpp",
1260      "source/fuzz/transformation_permute_phi_operands.h",
1261      "source/fuzz/transformation_propagate_instruction_down.cpp",
1262      "source/fuzz/transformation_propagate_instruction_down.h",
1263      "source/fuzz/transformation_propagate_instruction_up.cpp",
1264      "source/fuzz/transformation_propagate_instruction_up.h",
1265      "source/fuzz/transformation_push_id_through_variable.cpp",
1266      "source/fuzz/transformation_push_id_through_variable.h",
1267      "source/fuzz/transformation_record_synonymous_constants.cpp",
1268      "source/fuzz/transformation_record_synonymous_constants.h",
1269      "source/fuzz/transformation_replace_add_sub_mul_with_carrying_extended.cpp",
1270      "source/fuzz/transformation_replace_add_sub_mul_with_carrying_extended.h",
1271      "source/fuzz/transformation_replace_boolean_constant_with_constant_binary.cpp",
1272      "source/fuzz/transformation_replace_boolean_constant_with_constant_binary.h",
1273      "source/fuzz/transformation_replace_branch_from_dead_block_with_exit.cpp",
1274      "source/fuzz/transformation_replace_branch_from_dead_block_with_exit.h",
1275      "source/fuzz/transformation_replace_constant_with_uniform.cpp",
1276      "source/fuzz/transformation_replace_constant_with_uniform.h",
1277      "source/fuzz/transformation_replace_copy_memory_with_load_store.cpp",
1278      "source/fuzz/transformation_replace_copy_memory_with_load_store.h",
1279      "source/fuzz/transformation_replace_copy_object_with_store_load.cpp",
1280      "source/fuzz/transformation_replace_copy_object_with_store_load.h",
1281      "source/fuzz/transformation_replace_id_with_synonym.cpp",
1282      "source/fuzz/transformation_replace_id_with_synonym.h",
1283      "source/fuzz/transformation_replace_irrelevant_id.cpp",
1284      "source/fuzz/transformation_replace_irrelevant_id.h",
1285      "source/fuzz/transformation_replace_linear_algebra_instruction.cpp",
1286      "source/fuzz/transformation_replace_linear_algebra_instruction.h",
1287      "source/fuzz/transformation_replace_load_store_with_copy_memory.cpp",
1288      "source/fuzz/transformation_replace_load_store_with_copy_memory.h",
1289      "source/fuzz/transformation_replace_opphi_id_from_dead_predecessor.cpp",
1290      "source/fuzz/transformation_replace_opphi_id_from_dead_predecessor.h",
1291      "source/fuzz/transformation_replace_opselect_with_conditional_branch.cpp",
1292      "source/fuzz/transformation_replace_opselect_with_conditional_branch.h",
1293      "source/fuzz/transformation_replace_parameter_with_global.cpp",
1294      "source/fuzz/transformation_replace_parameter_with_global.h",
1295      "source/fuzz/transformation_replace_params_with_struct.cpp",
1296      "source/fuzz/transformation_replace_params_with_struct.h",
1297      "source/fuzz/transformation_set_function_control.cpp",
1298      "source/fuzz/transformation_set_function_control.h",
1299      "source/fuzz/transformation_set_loop_control.cpp",
1300      "source/fuzz/transformation_set_loop_control.h",
1301      "source/fuzz/transformation_set_memory_operands_mask.cpp",
1302      "source/fuzz/transformation_set_memory_operands_mask.h",
1303      "source/fuzz/transformation_set_selection_control.cpp",
1304      "source/fuzz/transformation_set_selection_control.h",
1305      "source/fuzz/transformation_split_block.cpp",
1306      "source/fuzz/transformation_split_block.h",
1307      "source/fuzz/transformation_store.cpp",
1308      "source/fuzz/transformation_store.h",
1309      "source/fuzz/transformation_swap_commutable_operands.cpp",
1310      "source/fuzz/transformation_swap_commutable_operands.h",
1311      "source/fuzz/transformation_swap_conditional_branch_operands.cpp",
1312      "source/fuzz/transformation_swap_conditional_branch_operands.h",
1313      "source/fuzz/transformation_swap_function_variables.cpp",
1314      "source/fuzz/transformation_swap_function_variables.h",
1315      "source/fuzz/transformation_swap_two_functions.cpp",
1316      "source/fuzz/transformation_swap_two_functions.h",
1317      "source/fuzz/transformation_toggle_access_chain_instruction.cpp",
1318      "source/fuzz/transformation_toggle_access_chain_instruction.h",
1319      "source/fuzz/transformation_vector_shuffle.cpp",
1320      "source/fuzz/transformation_vector_shuffle.h",
1321      "source/fuzz/transformation_wrap_early_terminator_in_function.cpp",
1322      "source/fuzz/transformation_wrap_early_terminator_in_function.h",
1323      "source/fuzz/transformation_wrap_region_in_selection.cpp",
1324      "source/fuzz/transformation_wrap_region_in_selection.h",
1325      "source/fuzz/transformation_wrap_vector_synonym.cpp",
1326      "source/fuzz/transformation_wrap_vector_synonym.h",
1327      "source/fuzz/uniform_buffer_element_descriptor.cpp",
1328      "source/fuzz/uniform_buffer_element_descriptor.h",
1329    ]
1330    deps = [
1331      ":spvtools",
1332      ":spvtools_fuzz_proto",
1333      ":spvtools_opt",
1334      ":spvtools_reduce",
1335      "//third_party/protobuf:protobuf_full",
1336    ]
1337    public_deps = [ ":spvtools_headers" ]
1338    configs -= [ "//build/config/compiler:chromium_code" ]
1339    configs += [ "//build/config/compiler:no_chromium_code" ]
1340    configs += [ ":spvtools_internal_config" ]
1341  }
1342}
1343
1344group("SPIRV-Tools") {
1345  public_deps = [
1346    ":spvtools",
1347    ":spvtools_link",
1348    ":spvtools_opt",
1349    ":spvtools_reduce",
1350    ":spvtools_val",
1351  ]
1352}
1353
1354# The tests are scoped to Chromium to avoid needing to write gtest integration.
1355# See Chromium's third_party/googletest/BUILD.gn for a complete integration.
1356if (build_with_chromium && spvtools_build_executables) {
1357  test("spvtools_test") {
1358    sources = [
1359      "test/assembly_context_test.cpp",
1360      "test/assembly_format_test.cpp",
1361      "test/binary_destroy_test.cpp",
1362      "test/binary_endianness_test.cpp",
1363      "test/binary_header_get_test.cpp",
1364      "test/binary_parse_test.cpp",
1365      "test/binary_strnlen_s_test.cpp",
1366      "test/binary_to_text.literal_test.cpp",
1367      "test/binary_to_text_test.cpp",
1368      "test/comment_test.cpp",
1369      "test/enum_set_test.cpp",
1370      "test/enum_string_mapping_test.cpp",
1371      "test/ext_inst.cldebug100_test.cpp",
1372      "test/ext_inst.debuginfo_test.cpp",
1373      "test/ext_inst.glsl_test.cpp",
1374      "test/ext_inst.opencl_test.cpp",
1375      "test/fix_word_test.cpp",
1376      "test/generator_magic_number_test.cpp",
1377      "test/hex_float_test.cpp",
1378      "test/immediate_int_test.cpp",
1379      "test/libspirv_macros_test.cpp",
1380      "test/name_mapper_test.cpp",
1381      "test/named_id_test.cpp",
1382      "test/opcode_make_test.cpp",
1383      "test/opcode_require_capabilities_test.cpp",
1384      "test/opcode_split_test.cpp",
1385      "test/opcode_table_get_test.cpp",
1386      "test/operand_capabilities_test.cpp",
1387      "test/operand_pattern_test.cpp",
1388      "test/operand_test.cpp",
1389      "test/target_env_test.cpp",
1390      "test/test_fixture.h",
1391      "test/text_advance_test.cpp",
1392      "test/text_destroy_test.cpp",
1393      "test/text_literal_test.cpp",
1394      "test/text_start_new_inst_test.cpp",
1395      "test/text_to_binary.annotation_test.cpp",
1396      "test/text_to_binary.barrier_test.cpp",
1397      "test/text_to_binary.constant_test.cpp",
1398      "test/text_to_binary.control_flow_test.cpp",
1399      "test/text_to_binary.debug_test.cpp",
1400      "test/text_to_binary.device_side_enqueue_test.cpp",
1401      "test/text_to_binary.extension_test.cpp",
1402      "test/text_to_binary.function_test.cpp",
1403      "test/text_to_binary.group_test.cpp",
1404      "test/text_to_binary.image_test.cpp",
1405      "test/text_to_binary.literal_test.cpp",
1406      "test/text_to_binary.memory_test.cpp",
1407      "test/text_to_binary.misc_test.cpp",
1408      "test/text_to_binary.mode_setting_test.cpp",
1409      "test/text_to_binary.pipe_storage_test.cpp",
1410      "test/text_to_binary.reserved_sampling_test.cpp",
1411      "test/text_to_binary.subgroup_dispatch_test.cpp",
1412      "test/text_to_binary.type_declaration_test.cpp",
1413      "test/text_to_binary_test.cpp",
1414      "test/text_word_get_test.cpp",
1415      "test/unit_spirv.cpp",
1416      "test/unit_spirv.h",
1417    ]
1418
1419    deps = [
1420      ":spvtools",
1421      ":spvtools_language_header_cldebuginfo100",
1422      ":spvtools_language_header_debuginfo",
1423      ":spvtools_language_header_vkdebuginfo100",
1424      ":spvtools_val",
1425      "//testing/gmock",
1426      "//testing/gtest",
1427      "//testing/gtest:gtest_main",
1428      "//third_party/googletest:gmock",
1429      "//third_party/googletest:gtest",
1430    ]
1431
1432    if (is_clang) {
1433      cflags_cc = [ "-Wno-self-assign" ]
1434    }
1435
1436    configs += [ ":spvtools_internal_config" ]
1437  }
1438}
1439
1440if (spirv_tools_standalone) {
1441  group("fuzzers") {
1442    testonly = true
1443    deps = [ "test/fuzzers" ]
1444  }
1445}
1446
1447source_set("spvtools_software_version") {
1448  sources = [ "source/software_version.cpp" ]
1449  deps = [
1450    ":spvtools_build_version",
1451    ":spvtools_headers",
1452  ]
1453  configs += [ ":spvtools_internal_config" ]
1454}
1455
1456source_set("spvtools_tools_util") {
1457  sources = [
1458    "tools/util/flags.cpp",
1459    "tools/util/cli_consumer.cpp",
1460    "tools/util/cli_consumer.h",
1461  ]
1462  deps = [ ":spvtools_headers" ]
1463  configs += [ ":spvtools_internal_config" ]
1464}
1465
1466if (spvtools_build_executables) {
1467  executable("spirv-as") {
1468    sources = [ "tools/as/as.cpp" ]
1469    deps = [
1470      ":spvtools",
1471      ":spvtools_software_version",
1472      ":spvtools_tools_util",
1473    ]
1474    configs += [ ":spvtools_internal_config" ]
1475  }
1476
1477  executable("spirv-dis") {
1478    sources = [ "tools/dis/dis.cpp" ]
1479    deps = [
1480      ":spvtools",
1481      ":spvtools_software_version",
1482      ":spvtools_tools_util",
1483    ]
1484    configs += [ ":spvtools_internal_config" ]
1485  }
1486
1487  executable("spirv-val") {
1488    sources = [ "tools/val/val.cpp" ]
1489    deps = [
1490      ":spvtools",
1491      ":spvtools_software_version",
1492      ":spvtools_tools_util",
1493      ":spvtools_val",
1494    ]
1495    configs += [ ":spvtools_internal_config" ]
1496  }
1497
1498  executable("spirv-cfg") {
1499    sources = [
1500      "tools/cfg/bin_to_dot.cpp",
1501      "tools/cfg/bin_to_dot.h",
1502      "tools/cfg/cfg.cpp",
1503    ]
1504    deps = [
1505      ":spvtools",
1506      ":spvtools_software_version",
1507      ":spvtools_tools_util",
1508    ]
1509    configs += [ ":spvtools_internal_config" ]
1510  }
1511
1512  executable("spirv-opt") {
1513    sources = [ "tools/opt/opt.cpp" ]
1514    deps = [
1515      ":spvtools",
1516      ":spvtools_opt",
1517      ":spvtools_software_version",
1518      ":spvtools_tools_util",
1519      ":spvtools_val",
1520    ]
1521    configs += [ ":spvtools_internal_config" ]
1522  }
1523
1524  executable("spirv-link") {
1525    sources = [ "tools/link/linker.cpp" ]
1526    deps = [
1527      ":spvtools",
1528      ":spvtools_link",
1529      ":spvtools_opt",
1530      ":spvtools_software_version",
1531      ":spvtools_tools_util",
1532      ":spvtools_val",
1533    ]
1534    configs += [ ":spvtools_internal_config" ]
1535  }
1536}
1537
1538if (!is_ios && !spirv_is_winuwp && build_with_chromium && spvtools_build_executables) {
1539  # iOS and UWP do not allow std::system calls which spirv-fuzz
1540  # requires. Additionally, spirv-fuzz is only built when in a
1541  # Chromium checkout due to its dependency on protobuf.
1542
1543  executable("spirv-fuzz") {
1544    sources = [ "tools/fuzz/fuzz.cpp" ]
1545    deps = [
1546      ":spvtools",
1547      ":spvtools_fuzz",
1548      ":spvtools_opt",
1549      ":spvtools_reduce",
1550      ":spvtools_software_version",
1551      ":spvtools_tools_util",
1552      ":spvtools_val",
1553      "//third_party/protobuf:protobuf_full",
1554    ]
1555    configs += [ ":spvtools_internal_config" ]
1556  }
1557}
1558
1559if (!is_ios && !spirv_is_winuwp && spvtools_build_executables) {
1560  # iOS and UWP do not allow std::system calls which spirv-reduce
1561  # requires.
1562
1563  executable("spirv-reduce") {
1564    sources = [ "tools/reduce/reduce.cpp" ]
1565    deps = [
1566      ":spvtools",
1567      ":spvtools_opt",
1568      ":spvtools_reduce",
1569      ":spvtools_software_version",
1570      ":spvtools_tools_util",
1571      ":spvtools_val",
1572    ]
1573    configs += [ ":spvtools_internal_config" ]
1574  }
1575}
1576
1577if (spvtools_build_executables){
1578  group("all_spirv_tools") {
1579    deps = [
1580      ":spirv-as",
1581      ":spirv-cfg",
1582      ":spirv-dis",
1583      ":spirv-link",
1584      ":spirv-opt",
1585      ":spirv-val",
1586    ]
1587    if (!is_ios && !spirv_is_winuwp && build_with_chromium) {
1588      deps += [ ":spirv-fuzz" ]
1589    }
1590    if (!is_ios && !spirv_is_winuwp) {
1591      deps += [ ":spirv-reduce" ]
1592    }
1593  }
1594}
1595