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/spirv_tools.gni") 16 17import("//testing/test.gni") 18import("//build_overrides/build.gni") 19 20spirv_headers = spirv_tools_spirv_headers_dir 21 22template("spvtools_core_tables") { 23 assert(defined(invoker.version), "Need version in $target_name generation.") 24 25 action("spvtools_core_tables_" + target_name) { 26 script = "utils/generate_grammar_tables.py" 27 28 version = invoker.version 29 30 core_json_file = 31 "${spirv_headers}/include/spirv/$version/spirv.core.grammar.json" 32 core_insts_file = "${target_gen_dir}/core.insts-$version.inc" 33 operand_kinds_file = "${target_gen_dir}/operand.kinds-$version.inc" 34 extinst_file = "source/extinst.debuginfo.grammar.json" 35 36 sources = [ 37 core_json_file, 38 ] 39 outputs = [ 40 core_insts_file, 41 operand_kinds_file, 42 ] 43 args = [ 44 "--spirv-core-grammar", 45 rebase_path(core_json_file, root_build_dir), 46 "--core-insts-output", 47 rebase_path(core_insts_file, root_build_dir), 48 "--extinst-debuginfo-grammar", 49 rebase_path(extinst_file, root_build_dir), 50 "--operand-kinds-output", 51 rebase_path(operand_kinds_file, root_build_dir), 52 ] 53 } 54} 55 56template("spvtools_core_enums") { 57 assert(defined(invoker.version), "Need version in $target_name generation.") 58 59 action("spvtools_core_enums_" + target_name) { 60 script = "utils/generate_grammar_tables.py" 61 62 version = invoker.version 63 64 core_json_file = 65 "${spirv_headers}/include/spirv/$version/spirv.core.grammar.json" 66 debug_insts_file = "source/extinst.debuginfo.grammar.json" 67 extension_enum_file = "${target_gen_dir}/extension_enum.inc" 68 extension_map_file = "${target_gen_dir}/enum_string_mapping.inc" 69 70 args = [ 71 "--spirv-core-grammar", 72 rebase_path(core_json_file, root_build_dir), 73 "--extinst-debuginfo-grammar", 74 rebase_path(debug_insts_file, root_build_dir), 75 "--extension-enum-output", 76 rebase_path(extension_enum_file, root_build_dir), 77 "--enum-string-mapping-output", 78 rebase_path(extension_map_file, root_build_dir), 79 ] 80 inputs = [ 81 core_json_file, 82 ] 83 outputs = [ 84 extension_enum_file, 85 extension_map_file, 86 ] 87 } 88} 89 90template("spvtools_glsl_tables") { 91 assert(defined(invoker.version), "Need version in $target_name generation.") 92 93 action("spvtools_glsl_tables_" + target_name) { 94 script = "utils/generate_grammar_tables.py" 95 96 version = invoker.version 97 98 core_json_file = 99 "${spirv_headers}/include/spirv/$version/spirv.core.grammar.json" 100 glsl_json_file = "${spirv_headers}/include/spirv/${version}/extinst.glsl.std.450.grammar.json" 101 glsl_insts_file = "${target_gen_dir}/glsl.std.450.insts.inc" 102 debug_insts_file = "source/extinst.debuginfo.grammar.json" 103 104 args = [ 105 "--spirv-core-grammar", 106 rebase_path(core_json_file, root_build_dir), 107 "--extinst-glsl-grammar", 108 rebase_path(glsl_json_file, root_build_dir), 109 "--glsl-insts-output", 110 rebase_path(glsl_insts_file, root_build_dir), 111 "--extinst-debuginfo-grammar", 112 rebase_path(debug_insts_file, root_build_dir), 113 ] 114 inputs = [ 115 core_json_file, 116 glsl_json_file, 117 ] 118 outputs = [ 119 glsl_insts_file, 120 ] 121 } 122} 123 124template("spvtools_opencl_tables") { 125 assert(defined(invoker.version), "Need version in $target_name generation.") 126 127 action("spvtools_opencl_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 opengl_json_file = "${spirv_headers}/include/spirv/${version}/extinst.opencl.std.100.grammar.json" 135 opencl_insts_file = "${target_gen_dir}/opencl.std.insts.inc" 136 debug_insts_file = "source/extinst.debuginfo.grammar.json" 137 138 args = [ 139 "--spirv-core-grammar", 140 rebase_path(core_json_file, root_build_dir), 141 "--extinst-opencl-grammar", 142 rebase_path(opengl_json_file, root_build_dir), 143 "--opencl-insts-output", 144 rebase_path(opencl_insts_file, root_build_dir), 145 "--extinst-debuginfo-grammar", 146 rebase_path(debug_insts_file, root_build_dir), 147 ] 148 inputs = [ 149 core_json_file, 150 opengl_json_file, 151 ] 152 outputs = [ 153 opencl_insts_file, 154 ] 155 } 156} 157 158template("spvtools_language_header") { 159 assert(defined(invoker.name), "Need name in $target_name generation.") 160 161 action("spvtools_language_header_" + target_name) { 162 script = "utils/generate_language_headers.py" 163 164 name = invoker.name 165 extinst_output_base = "${target_gen_dir}/${name}" 166 debug_insts_file = "source/extinst.debuginfo.grammar.json" 167 168 args = [ 169 "--extinst-name", 170 "${name}", 171 "--extinst-grammar", 172 rebase_path(debug_insts_file, root_build_dir), 173 "--extinst-output-base", 174 rebase_path(extinst_output_base, root_build_dir), 175 ] 176 inputs = [ 177 debug_insts_file, 178 ] 179 outputs = [ 180 "${extinst_output_base}.h", 181 ] 182 } 183} 184 185template("spvtools_vendor_table") { 186 assert(defined(invoker.name), "Need name in $target_name generation.") 187 188 action("spvtools_vendor_tables_" + target_name) { 189 script = "utils/generate_grammar_tables.py" 190 191 name = invoker.name 192 extinst_vendor_grammar = "source/extinst.${name}.grammar.json" 193 extinst_file = "${target_gen_dir}/${name}.insts.inc" 194 195 args = [ 196 "--extinst-vendor-grammar", 197 rebase_path(extinst_vendor_grammar, root_build_dir), 198 "--vendor-insts-output", 199 rebase_path(extinst_file, root_build_dir), 200 ] 201 inputs = [ 202 extinst_vendor_grammar, 203 ] 204 outputs = [ 205 extinst_file, 206 ] 207 } 208} 209 210action("spvtools_generators_inc") { 211 script = "utils/generate_registry_tables.py" 212 213 # TODO(dsinclair): Make work for chrome 214 xml_file = "${spirv_headers}/include/spirv/spir-v.xml" 215 inc_file = "${target_gen_dir}/generators.inc" 216 217 sources = [ 218 xml_file, 219 ] 220 outputs = [ 221 inc_file, 222 ] 223 args = [ 224 "--xml", 225 rebase_path(xml_file, root_build_dir), 226 "--generator", 227 rebase_path(inc_file, root_build_dir), 228 ] 229} 230 231action("spvtools_build_version") { 232 script = "utils/update_build_version.py" 233 234 src_dir = "." 235 inc_file = "${target_gen_dir}/build-version.inc" 236 237 outputs = [ 238 inc_file, 239 ] 240 args = [ 241 rebase_path(src_dir, root_build_dir), 242 rebase_path(inc_file, root_build_dir), 243 ] 244} 245 246spvtools_core_tables("unified1") { 247 version = "unified1" 248} 249spvtools_core_enums("unified1") { 250 version = "unified1" 251} 252spvtools_glsl_tables("glsl1-0") { 253 version = "1.0" 254} 255spvtools_opencl_tables("opencl1-0") { 256 version = "1.0" 257} 258spvtools_language_header("unified1") { 259 name = "DebugInfo" 260} 261 262spvtools_vendor_tables = [ 263 "spv-amd-shader-explicit-vertex-parameter", 264 "spv-amd-shader-trinary-minmax", 265 "spv-amd-gcn-shader", 266 "spv-amd-shader-ballot", 267 "debuginfo", 268] 269 270foreach(table, spvtools_vendor_tables) { 271 spvtools_vendor_table(table) { 272 name = table 273 } 274} 275 276config("spvtools_public_config") { 277 include_dirs = [ "include" ] 278} 279 280config("spvtools_internal_config") { 281 include_dirs = [ 282 ".", 283 "$target_gen_dir", 284 "${spirv_headers}/include", 285 ] 286 287 configs = [ ":spvtools_public_config" ] 288 289 if (is_clang) { 290 cflags = [ "-Wno-implicit-fallthrough" ] 291 } 292} 293 294source_set("spvtools_headers") { 295 sources = [ 296 "include/spirv-tools/libspirv.h", 297 "include/spirv-tools/libspirv.hpp", 298 "include/spirv-tools/linker.hpp", 299 "include/spirv-tools/optimizer.hpp", 300 "include/spirv-tools/instrument.hpp", 301 ] 302 303 public_configs = [ ":spvtools_public_config" ] 304} 305 306static_library("spvtools") { 307 deps = [ 308 ":spvtools_core_enums_unified1", 309 ":spvtools_core_tables_unified1", 310 ":spvtools_generators_inc", 311 ":spvtools_glsl_tables_glsl1-0", 312 ":spvtools_language_header_unified1", 313 ":spvtools_opencl_tables_opencl1-0", 314 ] 315 foreach(target_name, spvtools_vendor_tables) { 316 deps += [ ":spvtools_vendor_tables_$target_name" ] 317 } 318 319 sources = [ 320 "source/assembly_grammar.cpp", 321 "source/assembly_grammar.h", 322 "source/binary.cpp", 323 "source/binary.h", 324 "source/diagnostic.cpp", 325 "source/diagnostic.h", 326 "source/disassemble.cpp", 327 "source/enum_set.h", 328 "source/enum_string_mapping.cpp", 329 "source/ext_inst.cpp", 330 "source/ext_inst.h", 331 "source/extensions.cpp", 332 "source/extensions.h", 333 "source/instruction.h", 334 "source/libspirv.cpp", 335 "source/macro.h", 336 "source/name_mapper.cpp", 337 "source/name_mapper.h", 338 "source/opcode.cpp", 339 "source/opcode.h", 340 "source/operand.cpp", 341 "source/operand.h", 342 "source/parsed_operand.cpp", 343 "source/parsed_operand.h", 344 "source/print.cpp", 345 "source/print.h", 346 "source/spirv_constant.h", 347 "source/spirv_definition.h", 348 "source/spirv_endian.cpp", 349 "source/spirv_endian.h", 350 "source/spirv_optimizer_options.cpp", 351 "source/spirv_optimizer_options.h", 352 "source/spirv_target_env.cpp", 353 "source/spirv_target_env.h", 354 "source/spirv_validator_options.cpp", 355 "source/spirv_validator_options.h", 356 "source/table.cpp", 357 "source/table.h", 358 "source/text.cpp", 359 "source/text.h", 360 "source/text_handler.cpp", 361 "source/text_handler.h", 362 "source/util/bit_vector.cpp", 363 "source/util/bit_vector.h", 364 "source/util/bitutils.h", 365 "source/util/hex_float.h", 366 "source/util/ilist.h", 367 "source/util/ilist_node.h", 368 "source/util/make_unique.h", 369 "source/util/parse_number.cpp", 370 "source/util/parse_number.h", 371 "source/util/small_vector.h", 372 "source/util/string_utils.cpp", 373 "source/util/string_utils.h", 374 "source/util/timer.cpp", 375 "source/util/timer.h", 376 ] 377 378 public_deps = [ 379 ":spvtools_headers", 380 ] 381 382 configs -= [ "//build/config/compiler:chromium_code" ] 383 configs += [ 384 "//build/config/compiler:no_chromium_code", 385 ":spvtools_internal_config", 386 ] 387} 388 389static_library("spvtools_val") { 390 sources = [ 391 "source/val/basic_block.cpp", 392 "source/val/construct.cpp", 393 "source/val/function.cpp", 394 "source/val/instruction.cpp", 395 "source/val/validate.cpp", 396 "source/val/validate.h", 397 "source/val/validate_adjacency.cpp", 398 "source/val/validate_annotation.cpp", 399 "source/val/validate_arithmetics.cpp", 400 "source/val/validate_atomics.cpp", 401 "source/val/validate_barriers.cpp", 402 "source/val/validate_bitwise.cpp", 403 "source/val/validate_builtins.cpp", 404 "source/val/validate_capability.cpp", 405 "source/val/validate_cfg.cpp", 406 "source/val/validate_composites.cpp", 407 "source/val/validate_constants.cpp", 408 "source/val/validate_conversion.cpp", 409 "source/val/validate_datarules.cpp", 410 "source/val/validate_debug.cpp", 411 "source/val/validate_decorations.cpp", 412 "source/val/validate_derivatives.cpp", 413 "source/val/validate_execution_limitations.cpp", 414 "source/val/validate_extensions.cpp", 415 "source/val/validate_function.cpp", 416 "source/val/validate_id.cpp", 417 "source/val/validate_image.cpp", 418 "source/val/validate_instruction.cpp", 419 "source/val/validate_interfaces.cpp", 420 "source/val/validate_layout.cpp", 421 "source/val/validate_literals.cpp", 422 "source/val/validate_logicals.cpp", 423 "source/val/validate_memory.cpp", 424 "source/val/validate_memory_semantics.cpp", 425 "source/val/validate_mode_setting.cpp", 426 "source/val/validate_non_uniform.cpp", 427 "source/val/validate_primitives.cpp", 428 "source/val/validate_scopes.cpp", 429 "source/val/validate_type.cpp", 430 "source/val/validation_state.cpp", 431 ] 432 433 deps = [ 434 ":spvtools", 435 ] 436 public_deps = [ 437 ":spvtools_headers", 438 ] 439 440 configs -= [ "//build/config/compiler:chromium_code" ] 441 configs += [ 442 "//build/config/compiler:no_chromium_code", 443 ":spvtools_internal_config", 444 ] 445} 446 447static_library("spvtools_opt") { 448 sources = [ 449 "source/opt/aggressive_dead_code_elim_pass.cpp", 450 "source/opt/aggressive_dead_code_elim_pass.h", 451 "source/opt/basic_block.cpp", 452 "source/opt/basic_block.h", 453 "source/opt/block_merge_pass.cpp", 454 "source/opt/block_merge_pass.h", 455 "source/opt/build_module.cpp", 456 "source/opt/build_module.h", 457 "source/opt/ccp_pass.cpp", 458 "source/opt/ccp_pass.h", 459 "source/opt/cfg.cpp", 460 "source/opt/cfg.h", 461 "source/opt/cfg_cleanup_pass.cpp", 462 "source/opt/cfg_cleanup_pass.h", 463 "source/opt/code_sink.cpp", 464 "source/opt/code_sink.h", 465 "source/opt/combine_access_chains.cpp", 466 "source/opt/combine_access_chains.h", 467 "source/opt/common_uniform_elim_pass.cpp", 468 "source/opt/common_uniform_elim_pass.h", 469 "source/opt/compact_ids_pass.cpp", 470 "source/opt/compact_ids_pass.h", 471 "source/opt/composite.cpp", 472 "source/opt/composite.h", 473 "source/opt/const_folding_rules.cpp", 474 "source/opt/const_folding_rules.h", 475 "source/opt/constants.cpp", 476 "source/opt/constants.h", 477 "source/opt/copy_prop_arrays.cpp", 478 "source/opt/copy_prop_arrays.h", 479 "source/opt/dead_branch_elim_pass.cpp", 480 "source/opt/dead_branch_elim_pass.h", 481 "source/opt/dead_insert_elim_pass.cpp", 482 "source/opt/dead_insert_elim_pass.h", 483 "source/opt/dead_variable_elimination.cpp", 484 "source/opt/dead_variable_elimination.h", 485 "source/opt/decoration_manager.cpp", 486 "source/opt/decoration_manager.h", 487 "source/opt/def_use_manager.cpp", 488 "source/opt/def_use_manager.h", 489 "source/opt/dominator_analysis.cpp", 490 "source/opt/dominator_analysis.h", 491 "source/opt/dominator_tree.cpp", 492 "source/opt/dominator_tree.h", 493 "source/opt/eliminate_dead_constant_pass.cpp", 494 "source/opt/eliminate_dead_constant_pass.h", 495 "source/opt/eliminate_dead_functions_pass.cpp", 496 "source/opt/eliminate_dead_functions_pass.h", 497 "source/opt/feature_manager.cpp", 498 "source/opt/feature_manager.h", 499 "source/opt/flatten_decoration_pass.cpp", 500 "source/opt/flatten_decoration_pass.h", 501 "source/opt/fold.cpp", 502 "source/opt/fold.h", 503 "source/opt/fold_spec_constant_op_and_composite_pass.cpp", 504 "source/opt/fold_spec_constant_op_and_composite_pass.h", 505 "source/opt/folding_rules.cpp", 506 "source/opt/folding_rules.h", 507 "source/opt/freeze_spec_constant_value_pass.cpp", 508 "source/opt/freeze_spec_constant_value_pass.h", 509 "source/opt/function.cpp", 510 "source/opt/function.h", 511 "source/opt/if_conversion.cpp", 512 "source/opt/if_conversion.h", 513 "source/opt/inline_exhaustive_pass.cpp", 514 "source/opt/inline_exhaustive_pass.h", 515 "source/opt/inline_opaque_pass.cpp", 516 "source/opt/inline_opaque_pass.h", 517 "source/opt/inline_pass.cpp", 518 "source/opt/inline_pass.h", 519 "source/opt/inst_bindless_check_pass.cpp", 520 "source/opt/inst_bindless_check_pass.h", 521 "source/opt/instruction.cpp", 522 "source/opt/instruction.h", 523 "source/opt/instruction_list.cpp", 524 "source/opt/instruction_list.h", 525 "source/opt/instrument_pass.cpp", 526 "source/opt/instrument_pass.h", 527 "source/opt/ir_builder.h", 528 "source/opt/ir_context.cpp", 529 "source/opt/ir_context.h", 530 "source/opt/ir_loader.cpp", 531 "source/opt/ir_loader.h", 532 "source/opt/iterator.h", 533 "source/opt/licm_pass.cpp", 534 "source/opt/licm_pass.h", 535 "source/opt/local_access_chain_convert_pass.cpp", 536 "source/opt/local_access_chain_convert_pass.h", 537 "source/opt/local_redundancy_elimination.cpp", 538 "source/opt/local_redundancy_elimination.h", 539 "source/opt/local_single_block_elim_pass.cpp", 540 "source/opt/local_single_block_elim_pass.h", 541 "source/opt/local_single_store_elim_pass.cpp", 542 "source/opt/local_single_store_elim_pass.h", 543 "source/opt/local_ssa_elim_pass.cpp", 544 "source/opt/local_ssa_elim_pass.h", 545 "source/opt/log.h", 546 "source/opt/loop_dependence.cpp", 547 "source/opt/loop_dependence.h", 548 "source/opt/loop_dependence_helpers.cpp", 549 "source/opt/loop_descriptor.cpp", 550 "source/opt/loop_descriptor.h", 551 "source/opt/loop_fission.cpp", 552 "source/opt/loop_fission.h", 553 "source/opt/loop_fusion.cpp", 554 "source/opt/loop_fusion.h", 555 "source/opt/loop_fusion_pass.cpp", 556 "source/opt/loop_fusion_pass.h", 557 "source/opt/loop_peeling.cpp", 558 "source/opt/loop_peeling.h", 559 "source/opt/loop_unroller.cpp", 560 "source/opt/loop_unroller.h", 561 "source/opt/loop_unswitch_pass.cpp", 562 "source/opt/loop_unswitch_pass.h", 563 "source/opt/loop_utils.cpp", 564 "source/opt/loop_utils.h", 565 "source/opt/mem_pass.cpp", 566 "source/opt/mem_pass.h", 567 "source/opt/merge_return_pass.cpp", 568 "source/opt/merge_return_pass.h", 569 "source/opt/module.cpp", 570 "source/opt/module.h", 571 "source/opt/null_pass.h", 572 "source/opt/optimizer.cpp", 573 "source/opt/pass.cpp", 574 "source/opt/pass.h", 575 "source/opt/pass_manager.cpp", 576 "source/opt/pass_manager.h", 577 "source/opt/passes.h", 578 "source/opt/private_to_local_pass.cpp", 579 "source/opt/private_to_local_pass.h", 580 "source/opt/process_lines_pass.cpp", 581 "source/opt/process_lines_pass.h", 582 "source/opt/propagator.cpp", 583 "source/opt/propagator.h", 584 "source/opt/reduce_load_size.cpp", 585 "source/opt/reduce_load_size.h", 586 "source/opt/redundancy_elimination.cpp", 587 "source/opt/redundancy_elimination.h", 588 "source/opt/reflect.h", 589 "source/opt/register_pressure.cpp", 590 "source/opt/register_pressure.h", 591 "source/opt/remove_duplicates_pass.cpp", 592 "source/opt/remove_duplicates_pass.h", 593 "source/opt/replace_invalid_opc.cpp", 594 "source/opt/replace_invalid_opc.h", 595 "source/opt/scalar_analysis.cpp", 596 "source/opt/scalar_analysis.h", 597 "source/opt/scalar_analysis_nodes.h", 598 "source/opt/scalar_analysis_simplification.cpp", 599 "source/opt/scalar_replacement_pass.cpp", 600 "source/opt/scalar_replacement_pass.h", 601 "source/opt/set_spec_constant_default_value_pass.cpp", 602 "source/opt/set_spec_constant_default_value_pass.h", 603 "source/opt/simplification_pass.cpp", 604 "source/opt/simplification_pass.h", 605 "source/opt/ssa_rewrite_pass.cpp", 606 "source/opt/ssa_rewrite_pass.h", 607 "source/opt/strength_reduction_pass.cpp", 608 "source/opt/strength_reduction_pass.h", 609 "source/opt/strip_debug_info_pass.cpp", 610 "source/opt/strip_debug_info_pass.h", 611 "source/opt/strip_reflect_info_pass.cpp", 612 "source/opt/strip_reflect_info_pass.h", 613 "source/opt/struct_cfg_analysis.cpp", 614 "source/opt/struct_cfg_analysis.h", 615 "source/opt/tree_iterator.h", 616 "source/opt/type_manager.cpp", 617 "source/opt/type_manager.h", 618 "source/opt/types.cpp", 619 "source/opt/types.h", 620 "source/opt/unify_const_pass.cpp", 621 "source/opt/unify_const_pass.h", 622 "source/opt/upgrade_memory_model.cpp", 623 "source/opt/upgrade_memory_model.h", 624 "source/opt/value_number_table.cpp", 625 "source/opt/value_number_table.h", 626 "source/opt/vector_dce.cpp", 627 "source/opt/vector_dce.h", 628 "source/opt/workaround1209.cpp", 629 "source/opt/workaround1209.h", 630 ] 631 632 deps = [ 633 ":spvtools", 634 ] 635 public_deps = [ 636 ":spvtools_headers", 637 ] 638 639 configs -= [ "//build/config/compiler:chromium_code" ] 640 configs += [ 641 "//build/config/compiler:no_chromium_code", 642 ":spvtools_internal_config", 643 ] 644} 645 646group("SPIRV-Tools") { 647 deps = [ 648 ":spvtools", 649 ":spvtools_opt", 650 ":spvtools_val", 651 ] 652} 653 654if (!build_with_chromium) { 655 googletest_dir = spirv_tools_googletest_dir 656 657 config("gtest_config") { 658 include_dirs = [ 659 "${googletest_dir}/googletest", 660 "${googletest_dir}/googletest/include", 661 ] 662 } 663 664 static_library("gtest") { 665 testonly = true 666 sources = [ 667 "${googletest_dir}/googletest/src/gtest-all.cc", 668 ] 669 public_configs = [ ":gtest_config" ] 670 } 671 672 config("gmock_config") { 673 include_dirs = [ 674 "${googletest_dir}/googlemock", 675 "${googletest_dir}/googlemock/include", 676 "${googletest_dir}/googletest/include", 677 ] 678 if (is_clang) { 679 # TODO: Can remove this if/when the issue is fixed. 680 # https://github.com/google/googletest/issues/533 681 cflags = [ "-Wno-inconsistent-missing-override" ] 682 } 683 } 684 685 static_library("gmock") { 686 testonly = true 687 sources = [ 688 "${googletest_dir}/googlemock/src/gmock-all.cc", 689 ] 690 public_configs = [ ":gmock_config" ] 691 } 692} 693 694test("spvtools_test") { 695 sources = [ 696 "test/assembly_context_test.cpp", 697 "test/assembly_format_test.cpp", 698 "test/binary_destroy_test.cpp", 699 "test/binary_endianness_test.cpp", 700 "test/binary_header_get_test.cpp", 701 "test/binary_parse_test.cpp", 702 "test/binary_strnlen_s_test.cpp", 703 "test/binary_to_text.literal_test.cpp", 704 "test/binary_to_text_test.cpp", 705 "test/comment_test.cpp", 706 "test/enum_set_test.cpp", 707 "test/enum_string_mapping_test.cpp", 708 "test/ext_inst.debuginfo_test.cpp", 709 "test/ext_inst.glsl_test.cpp", 710 "test/ext_inst.opencl_test.cpp", 711 "test/fix_word_test.cpp", 712 "test/generator_magic_number_test.cpp", 713 "test/hex_float_test.cpp", 714 "test/immediate_int_test.cpp", 715 "test/libspirv_macros_test.cpp", 716 "test/name_mapper_test.cpp", 717 "test/named_id_test.cpp", 718 "test/opcode_make_test.cpp", 719 "test/opcode_require_capabilities_test.cpp", 720 "test/opcode_split_test.cpp", 721 "test/opcode_table_get_test.cpp", 722 "test/operand_capabilities_test.cpp", 723 "test/operand_pattern_test.cpp", 724 "test/operand_test.cpp", 725 "test/target_env_test.cpp", 726 "test/test_fixture.h", 727 "test/text_advance_test.cpp", 728 "test/text_destroy_test.cpp", 729 "test/text_literal_test.cpp", 730 "test/text_start_new_inst_test.cpp", 731 "test/text_to_binary.annotation_test.cpp", 732 "test/text_to_binary.barrier_test.cpp", 733 "test/text_to_binary.constant_test.cpp", 734 "test/text_to_binary.control_flow_test.cpp", 735 "test/text_to_binary.debug_test.cpp", 736 "test/text_to_binary.device_side_enqueue_test.cpp", 737 "test/text_to_binary.extension_test.cpp", 738 "test/text_to_binary.function_test.cpp", 739 "test/text_to_binary.group_test.cpp", 740 "test/text_to_binary.image_test.cpp", 741 "test/text_to_binary.literal_test.cpp", 742 "test/text_to_binary.memory_test.cpp", 743 "test/text_to_binary.misc_test.cpp", 744 "test/text_to_binary.mode_setting_test.cpp", 745 "test/text_to_binary.pipe_storage_test.cpp", 746 "test/text_to_binary.reserved_sampling_test.cpp", 747 "test/text_to_binary.subgroup_dispatch_test.cpp", 748 "test/text_to_binary.type_declaration_test.cpp", 749 "test/text_to_binary_test.cpp", 750 "test/text_word_get_test.cpp", 751 "test/unit_spirv.cpp", 752 "test/unit_spirv.h", 753 ] 754 755 deps = [ 756 ":spvtools", 757 ":spvtools_language_header_unified1", 758 ":spvtools_val", 759 ] 760 761 if (build_with_chromium) { 762 deps += [ 763 "//testing/gmock", 764 "//testing/gtest", 765 "//testing/gtest:gtest_main", 766 ] 767 } else { 768 deps += [ 769 ":gmock", 770 ":gtest", 771 ] 772 sources += [ "${googletest_dir}/googletest/src/gtest_main.cc" ] 773 } 774 775 if (is_clang) { 776 cflags_cc = [ "-Wno-self-assign" ] 777 } 778 779 configs += [ ":spvtools_internal_config" ] 780} 781 782if (spirv_tools_standalone) { 783 group("fuzzers") { 784 testonly = true 785 deps = [ 786 "test/fuzzers", 787 ] 788 } 789} 790 791executable("spirv-as") { 792 sources = [ 793 "source/software_version.cpp", 794 "tools/as/as.cpp", 795 ] 796 deps = [ 797 ":spvtools", 798 ":spvtools_build_version", 799 ] 800 configs += [ ":spvtools_internal_config" ] 801} 802