BUILD.gn 23 KB

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