Dan Sinclair | a114e1f | 2018-07-17 13:53:15 -0400 | [diff] [blame] | 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 | |
Corentin Wallez | 2d9a325 | 2018-08-02 18:48:03 +0200 | [diff] [blame] | 15 | import("//build_overrides/spirv_tools.gni") |
| 16 | |
Dan Sinclair | a114e1f | 2018-07-17 13:53:15 -0400 | [diff] [blame] | 17 | import("//testing/test.gni") |
| 18 | import("//build_overrides/build.gni") |
| 19 | |
Corentin Wallez | 2d9a325 | 2018-08-02 18:48:03 +0200 | [diff] [blame] | 20 | spirv_headers = spirv_tools_spirv_headers_dir |
Dan Sinclair | a114e1f | 2018-07-17 13:53:15 -0400 | [diff] [blame] | 21 | |
| 22 | template("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 | |
| 56 | template("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 | |
| 90 | template("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 | |
| 124 | template("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 | |
| 158 | template("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 | |
| 185 | template("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 | |
| 210 | action("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 | |
dan sinclair | 1bdade7 | 2018-08-15 15:26:28 -0400 | [diff] [blame] | 231 | action("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 | |
Dan Sinclair | a114e1f | 2018-07-17 13:53:15 -0400 | [diff] [blame] | 246 | spvtools_core_tables("unified1") { |
| 247 | version = "unified1" |
| 248 | } |
| 249 | spvtools_core_enums("unified1") { |
| 250 | version = "unified1" |
| 251 | } |
| 252 | spvtools_glsl_tables("glsl1-0") { |
| 253 | version = "1.0" |
| 254 | } |
| 255 | spvtools_opencl_tables("opencl1-0") { |
| 256 | version = "1.0" |
| 257 | } |
| 258 | spvtools_language_header("unified1") { |
| 259 | name = "DebugInfo" |
| 260 | } |
| 261 | |
| 262 | spvtools_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 | |
| 270 | foreach(table, spvtools_vendor_tables) { |
| 271 | spvtools_vendor_table(table) { |
| 272 | name = table |
| 273 | } |
| 274 | } |
| 275 | |
Corentin Wallez | 21bcb9d | 2018-09-06 10:50:27 -0400 | [diff] [blame] | 276 | config("spvtools_public_config") { |
| 277 | include_dirs = [ "include" ] |
| 278 | } |
| 279 | |
| 280 | config("spvtools_internal_config") { |
Dan Sinclair | a114e1f | 2018-07-17 13:53:15 -0400 | [diff] [blame] | 281 | include_dirs = [ |
| 282 | ".", |
Dan Sinclair | a114e1f | 2018-07-17 13:53:15 -0400 | [diff] [blame] | 283 | "$target_gen_dir", |
| 284 | "${spirv_headers}/include", |
| 285 | ] |
| 286 | |
Corentin Wallez | 21bcb9d | 2018-09-06 10:50:27 -0400 | [diff] [blame] | 287 | configs = [ ":spvtools_public_config" ] |
| 288 | |
Dan Sinclair | a114e1f | 2018-07-17 13:53:15 -0400 | [diff] [blame] | 289 | if (is_clang) { |
| 290 | cflags = [ "-Wno-implicit-fallthrough" ] |
| 291 | } |
| 292 | } |
| 293 | |
Corentin Wallez | 21bcb9d | 2018-09-06 10:50:27 -0400 | [diff] [blame] | 294 | source_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", |
greg-lunarg | 1e9fc1a | 2018-11-08 11:54:54 -0700 | [diff] [blame] | 300 | "include/spirv-tools/instrument.hpp", |
Corentin Wallez | 21bcb9d | 2018-09-06 10:50:27 -0400 | [diff] [blame] | 301 | ] |
| 302 | |
| 303 | public_configs = [ ":spvtools_public_config" ] |
| 304 | } |
| 305 | |
Dan Sinclair | a114e1f | 2018-07-17 13:53:15 -0400 | [diff] [blame] | 306 | static_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", |
Dan Sinclair | a114e1f | 2018-07-17 13:53:15 -0400 | [diff] [blame] | 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", |
dan sinclair | 324be76 | 2018-09-11 09:34:42 -0400 | [diff] [blame] | 350 | "source/spirv_optimizer_options.cpp", |
| 351 | "source/spirv_optimizer_options.h", |
Dan Sinclair | a114e1f | 2018-07-17 13:53:15 -0400 | [diff] [blame] | 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", |
Dan Sinclair | a114e1f | 2018-07-17 13:53:15 -0400 | [diff] [blame] | 362 | "source/util/bit_vector.cpp", |
| 363 | "source/util/bit_vector.h", |
| 364 | "source/util/bitutils.h", |
| 365 | "source/util/hex_float.h", |
Dan Sinclair | a114e1f | 2018-07-17 13:53:15 -0400 | [diff] [blame] | 366 | "source/util/ilist.h", |
| 367 | "source/util/ilist_node.h", |
dan sinclair | 1553025 | 2018-08-14 12:44:54 -0400 | [diff] [blame] | 368 | "source/util/make_unique.h", |
Dan Sinclair | a114e1f | 2018-07-17 13:53:15 -0400 | [diff] [blame] | 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 | |
Corentin Wallez | 21bcb9d | 2018-09-06 10:50:27 -0400 | [diff] [blame] | 378 | public_deps = [ |
| 379 | ":spvtools_headers", |
| 380 | ] |
| 381 | |
Dan Sinclair | a114e1f | 2018-07-17 13:53:15 -0400 | [diff] [blame] | 382 | configs -= [ "//build/config/compiler:chromium_code" ] |
Corentin Wallez | 21bcb9d | 2018-09-06 10:50:27 -0400 | [diff] [blame] | 383 | configs += [ |
| 384 | "//build/config/compiler:no_chromium_code", |
| 385 | ":spvtools_internal_config", |
| 386 | ] |
Dan Sinclair | a114e1f | 2018-07-17 13:53:15 -0400 | [diff] [blame] | 387 | } |
| 388 | |
| 389 | static_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", |
Alan Baker | 7d4b046 | 2018-08-08 14:21:27 -0400 | [diff] [blame] | 398 | "source/val/validate_annotation.cpp", |
Dan Sinclair | a114e1f | 2018-07-17 13:53:15 -0400 | [diff] [blame] | 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", |
Alan Baker | c5b3806 | 2018-08-17 11:20:55 -0400 | [diff] [blame] | 407 | "source/val/validate_constants.cpp", |
Dan Sinclair | a114e1f | 2018-07-17 13:53:15 -0400 | [diff] [blame] | 408 | "source/val/validate_conversion.cpp", |
| 409 | "source/val/validate_datarules.cpp", |
Alan Baker | ca7278c | 2018-08-08 13:47:09 -0400 | [diff] [blame] | 410 | "source/val/validate_debug.cpp", |
Dan Sinclair | a114e1f | 2018-07-17 13:53:15 -0400 | [diff] [blame] | 411 | "source/val/validate_decorations.cpp", |
| 412 | "source/val/validate_derivatives.cpp", |
Alan Baker | e7fdcdb | 2018-08-10 09:53:17 -0400 | [diff] [blame] | 413 | "source/val/validate_execution_limitations.cpp", |
dan sinclair | 703305b | 2018-11-28 09:17:13 -0500 | [diff] [blame] | 414 | "source/val/validate_extensions.cpp", |
Alan Baker | e7fdcdb | 2018-08-10 09:53:17 -0400 | [diff] [blame] | 415 | "source/val/validate_function.cpp", |
Dan Sinclair | a114e1f | 2018-07-17 13:53:15 -0400 | [diff] [blame] | 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", |
Alan Baker | d49bedc | 2018-08-01 14:44:56 -0400 | [diff] [blame] | 423 | "source/val/validate_memory.cpp", |
Ryan Harrison | cf37ab7 | 2018-12-06 14:38:15 -0500 | [diff] [blame] | 424 | "source/val/validate_memory_semantics.cpp", |
Alan Baker | 714bf84 | 2018-08-08 14:49:59 -0400 | [diff] [blame] | 425 | "source/val/validate_mode_setting.cpp", |
Dan Sinclair | a114e1f | 2018-07-17 13:53:15 -0400 | [diff] [blame] | 426 | "source/val/validate_non_uniform.cpp", |
| 427 | "source/val/validate_primitives.cpp", |
Ryan Harrison | 8ce3dba | 2018-11-29 13:48:42 -0500 | [diff] [blame] | 428 | "source/val/validate_scopes.cpp", |
Alan Baker | f2a9900 | 2018-08-03 11:38:51 -0400 | [diff] [blame] | 429 | "source/val/validate_type.cpp", |
Dan Sinclair | a114e1f | 2018-07-17 13:53:15 -0400 | [diff] [blame] | 430 | "source/val/validation_state.cpp", |
| 431 | ] |
| 432 | |
| 433 | deps = [ |
| 434 | ":spvtools", |
| 435 | ] |
Corentin Wallez | 21bcb9d | 2018-09-06 10:50:27 -0400 | [diff] [blame] | 436 | public_deps = [ |
| 437 | ":spvtools_headers", |
| 438 | ] |
Dan Sinclair | a114e1f | 2018-07-17 13:53:15 -0400 | [diff] [blame] | 439 | |
Dan Sinclair | a114e1f | 2018-07-17 13:53:15 -0400 | [diff] [blame] | 440 | configs -= [ "//build/config/compiler:chromium_code" ] |
Corentin Wallez | 21bcb9d | 2018-09-06 10:50:27 -0400 | [diff] [blame] | 441 | configs += [ |
| 442 | "//build/config/compiler:no_chromium_code", |
| 443 | ":spvtools_internal_config", |
| 444 | ] |
Dan Sinclair | a114e1f | 2018-07-17 13:53:15 -0400 | [diff] [blame] | 445 | } |
| 446 | |
| 447 | static_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", |
dan sinclair | de9496e | 2018-08-02 14:36:43 -0400 | [diff] [blame] | 463 | "source/opt/combine_access_chains.cpp", |
| 464 | "source/opt/combine_access_chains.h", |
Dan Sinclair | a114e1f | 2018-07-17 13:53:15 -0400 | [diff] [blame] | 465 | "source/opt/common_uniform_elim_pass.cpp", |
| 466 | "source/opt/common_uniform_elim_pass.h", |
| 467 | "source/opt/compact_ids_pass.cpp", |
| 468 | "source/opt/compact_ids_pass.h", |
| 469 | "source/opt/composite.cpp", |
| 470 | "source/opt/composite.h", |
| 471 | "source/opt/const_folding_rules.cpp", |
| 472 | "source/opt/const_folding_rules.h", |
| 473 | "source/opt/constants.cpp", |
| 474 | "source/opt/constants.h", |
| 475 | "source/opt/copy_prop_arrays.cpp", |
| 476 | "source/opt/copy_prop_arrays.h", |
| 477 | "source/opt/dead_branch_elim_pass.cpp", |
| 478 | "source/opt/dead_branch_elim_pass.h", |
| 479 | "source/opt/dead_insert_elim_pass.cpp", |
| 480 | "source/opt/dead_insert_elim_pass.h", |
| 481 | "source/opt/dead_variable_elimination.cpp", |
| 482 | "source/opt/dead_variable_elimination.h", |
| 483 | "source/opt/decoration_manager.cpp", |
| 484 | "source/opt/decoration_manager.h", |
| 485 | "source/opt/def_use_manager.cpp", |
| 486 | "source/opt/def_use_manager.h", |
| 487 | "source/opt/dominator_analysis.cpp", |
| 488 | "source/opt/dominator_analysis.h", |
| 489 | "source/opt/dominator_tree.cpp", |
| 490 | "source/opt/dominator_tree.h", |
| 491 | "source/opt/eliminate_dead_constant_pass.cpp", |
| 492 | "source/opt/eliminate_dead_constant_pass.h", |
| 493 | "source/opt/eliminate_dead_functions_pass.cpp", |
| 494 | "source/opt/eliminate_dead_functions_pass.h", |
| 495 | "source/opt/feature_manager.cpp", |
| 496 | "source/opt/feature_manager.h", |
| 497 | "source/opt/flatten_decoration_pass.cpp", |
| 498 | "source/opt/flatten_decoration_pass.h", |
| 499 | "source/opt/fold.cpp", |
| 500 | "source/opt/fold.h", |
| 501 | "source/opt/fold_spec_constant_op_and_composite_pass.cpp", |
| 502 | "source/opt/fold_spec_constant_op_and_composite_pass.h", |
| 503 | "source/opt/folding_rules.cpp", |
| 504 | "source/opt/folding_rules.h", |
| 505 | "source/opt/freeze_spec_constant_value_pass.cpp", |
| 506 | "source/opt/freeze_spec_constant_value_pass.h", |
| 507 | "source/opt/function.cpp", |
| 508 | "source/opt/function.h", |
| 509 | "source/opt/if_conversion.cpp", |
| 510 | "source/opt/if_conversion.h", |
| 511 | "source/opt/inline_exhaustive_pass.cpp", |
| 512 | "source/opt/inline_exhaustive_pass.h", |
| 513 | "source/opt/inline_opaque_pass.cpp", |
| 514 | "source/opt/inline_opaque_pass.h", |
| 515 | "source/opt/inline_pass.cpp", |
| 516 | "source/opt/inline_pass.h", |
greg-lunarg | 1e9fc1a | 2018-11-08 11:54:54 -0700 | [diff] [blame] | 517 | "source/opt/inst_bindless_check_pass.cpp", |
| 518 | "source/opt/inst_bindless_check_pass.h", |
Dan Sinclair | a114e1f | 2018-07-17 13:53:15 -0400 | [diff] [blame] | 519 | "source/opt/instruction.cpp", |
| 520 | "source/opt/instruction.h", |
| 521 | "source/opt/instruction_list.cpp", |
| 522 | "source/opt/instruction_list.h", |
greg-lunarg | 1e9fc1a | 2018-11-08 11:54:54 -0700 | [diff] [blame] | 523 | "source/opt/instrument_pass.cpp", |
| 524 | "source/opt/instrument_pass.h", |
Dan Sinclair | a114e1f | 2018-07-17 13:53:15 -0400 | [diff] [blame] | 525 | "source/opt/ir_builder.h", |
| 526 | "source/opt/ir_context.cpp", |
| 527 | "source/opt/ir_context.h", |
| 528 | "source/opt/ir_loader.cpp", |
| 529 | "source/opt/ir_loader.h", |
| 530 | "source/opt/iterator.h", |
| 531 | "source/opt/licm_pass.cpp", |
| 532 | "source/opt/licm_pass.h", |
| 533 | "source/opt/local_access_chain_convert_pass.cpp", |
| 534 | "source/opt/local_access_chain_convert_pass.h", |
| 535 | "source/opt/local_redundancy_elimination.cpp", |
| 536 | "source/opt/local_redundancy_elimination.h", |
| 537 | "source/opt/local_single_block_elim_pass.cpp", |
| 538 | "source/opt/local_single_block_elim_pass.h", |
| 539 | "source/opt/local_single_store_elim_pass.cpp", |
| 540 | "source/opt/local_single_store_elim_pass.h", |
| 541 | "source/opt/local_ssa_elim_pass.cpp", |
| 542 | "source/opt/local_ssa_elim_pass.h", |
| 543 | "source/opt/log.h", |
| 544 | "source/opt/loop_dependence.cpp", |
| 545 | "source/opt/loop_dependence.h", |
| 546 | "source/opt/loop_dependence_helpers.cpp", |
| 547 | "source/opt/loop_descriptor.cpp", |
| 548 | "source/opt/loop_descriptor.h", |
| 549 | "source/opt/loop_fission.cpp", |
| 550 | "source/opt/loop_fission.h", |
| 551 | "source/opt/loop_fusion.cpp", |
| 552 | "source/opt/loop_fusion.h", |
| 553 | "source/opt/loop_fusion_pass.cpp", |
| 554 | "source/opt/loop_fusion_pass.h", |
| 555 | "source/opt/loop_peeling.cpp", |
| 556 | "source/opt/loop_peeling.h", |
| 557 | "source/opt/loop_unroller.cpp", |
| 558 | "source/opt/loop_unroller.h", |
| 559 | "source/opt/loop_unswitch_pass.cpp", |
| 560 | "source/opt/loop_unswitch_pass.h", |
| 561 | "source/opt/loop_utils.cpp", |
| 562 | "source/opt/loop_utils.h", |
Dan Sinclair | a114e1f | 2018-07-17 13:53:15 -0400 | [diff] [blame] | 563 | "source/opt/mem_pass.cpp", |
| 564 | "source/opt/mem_pass.h", |
| 565 | "source/opt/merge_return_pass.cpp", |
| 566 | "source/opt/merge_return_pass.h", |
| 567 | "source/opt/module.cpp", |
| 568 | "source/opt/module.h", |
| 569 | "source/opt/null_pass.h", |
| 570 | "source/opt/optimizer.cpp", |
| 571 | "source/opt/pass.cpp", |
| 572 | "source/opt/pass.h", |
| 573 | "source/opt/pass_manager.cpp", |
| 574 | "source/opt/pass_manager.h", |
| 575 | "source/opt/passes.h", |
| 576 | "source/opt/private_to_local_pass.cpp", |
| 577 | "source/opt/private_to_local_pass.h", |
greg-lunarg | c37388f | 2018-11-15 12:06:17 -0700 | [diff] [blame] | 578 | "source/opt/process_lines_pass.cpp", |
| 579 | "source/opt/process_lines_pass.h", |
Dan Sinclair | a114e1f | 2018-07-17 13:53:15 -0400 | [diff] [blame] | 580 | "source/opt/propagator.cpp", |
| 581 | "source/opt/propagator.h", |
| 582 | "source/opt/reduce_load_size.cpp", |
| 583 | "source/opt/reduce_load_size.h", |
| 584 | "source/opt/redundancy_elimination.cpp", |
| 585 | "source/opt/redundancy_elimination.h", |
| 586 | "source/opt/reflect.h", |
| 587 | "source/opt/register_pressure.cpp", |
| 588 | "source/opt/register_pressure.h", |
| 589 | "source/opt/remove_duplicates_pass.cpp", |
| 590 | "source/opt/remove_duplicates_pass.h", |
| 591 | "source/opt/replace_invalid_opc.cpp", |
| 592 | "source/opt/replace_invalid_opc.h", |
| 593 | "source/opt/scalar_analysis.cpp", |
| 594 | "source/opt/scalar_analysis.h", |
| 595 | "source/opt/scalar_analysis_nodes.h", |
| 596 | "source/opt/scalar_analysis_simplification.cpp", |
| 597 | "source/opt/scalar_replacement_pass.cpp", |
| 598 | "source/opt/scalar_replacement_pass.h", |
| 599 | "source/opt/set_spec_constant_default_value_pass.cpp", |
| 600 | "source/opt/set_spec_constant_default_value_pass.h", |
| 601 | "source/opt/simplification_pass.cpp", |
| 602 | "source/opt/simplification_pass.h", |
| 603 | "source/opt/ssa_rewrite_pass.cpp", |
| 604 | "source/opt/ssa_rewrite_pass.h", |
| 605 | "source/opt/strength_reduction_pass.cpp", |
| 606 | "source/opt/strength_reduction_pass.h", |
| 607 | "source/opt/strip_debug_info_pass.cpp", |
| 608 | "source/opt/strip_debug_info_pass.h", |
| 609 | "source/opt/strip_reflect_info_pass.cpp", |
| 610 | "source/opt/strip_reflect_info_pass.h", |
Steven Perron | 5f599e7 | 2018-09-17 13:00:24 -0400 | [diff] [blame] | 611 | "source/opt/struct_cfg_analysis.cpp", |
| 612 | "source/opt/struct_cfg_analysis.h", |
Dan Sinclair | a114e1f | 2018-07-17 13:53:15 -0400 | [diff] [blame] | 613 | "source/opt/tree_iterator.h", |
| 614 | "source/opt/type_manager.cpp", |
| 615 | "source/opt/type_manager.h", |
| 616 | "source/opt/types.cpp", |
| 617 | "source/opt/types.h", |
| 618 | "source/opt/unify_const_pass.cpp", |
| 619 | "source/opt/unify_const_pass.h", |
dan sinclair | 67b2e15 | 2018-12-03 09:11:56 -0500 | [diff] [blame] | 620 | "source/opt/upgrade_memory_model.cpp", |
| 621 | "source/opt/upgrade_memory_model.h", |
Dan Sinclair | a114e1f | 2018-07-17 13:53:15 -0400 | [diff] [blame] | 622 | "source/opt/value_number_table.cpp", |
| 623 | "source/opt/value_number_table.h", |
| 624 | "source/opt/vector_dce.cpp", |
| 625 | "source/opt/vector_dce.h", |
| 626 | "source/opt/workaround1209.cpp", |
| 627 | "source/opt/workaround1209.h", |
| 628 | ] |
Corentin Wallez | 21bcb9d | 2018-09-06 10:50:27 -0400 | [diff] [blame] | 629 | |
Dan Sinclair | a114e1f | 2018-07-17 13:53:15 -0400 | [diff] [blame] | 630 | deps = [ |
| 631 | ":spvtools", |
| 632 | ] |
Corentin Wallez | 21bcb9d | 2018-09-06 10:50:27 -0400 | [diff] [blame] | 633 | public_deps = [ |
| 634 | ":spvtools_headers", |
| 635 | ] |
Dan Sinclair | a114e1f | 2018-07-17 13:53:15 -0400 | [diff] [blame] | 636 | |
Dan Sinclair | a114e1f | 2018-07-17 13:53:15 -0400 | [diff] [blame] | 637 | configs -= [ "//build/config/compiler:chromium_code" ] |
Corentin Wallez | 21bcb9d | 2018-09-06 10:50:27 -0400 | [diff] [blame] | 638 | configs += [ |
| 639 | "//build/config/compiler:no_chromium_code", |
| 640 | ":spvtools_internal_config", |
| 641 | ] |
Dan Sinclair | a114e1f | 2018-07-17 13:53:15 -0400 | [diff] [blame] | 642 | } |
| 643 | |
dan sinclair | a97c1d9 | 2018-08-01 14:28:10 -0400 | [diff] [blame] | 644 | group("SPIRV-Tools") { |
Dan Sinclair | a114e1f | 2018-07-17 13:53:15 -0400 | [diff] [blame] | 645 | deps = [ |
| 646 | ":spvtools", |
| 647 | ":spvtools_opt", |
| 648 | ":spvtools_val", |
| 649 | ] |
| 650 | } |
| 651 | |
| 652 | if (!build_with_chromium) { |
Corentin Wallez | 2d9a325 | 2018-08-02 18:48:03 +0200 | [diff] [blame] | 653 | googletest_dir = spirv_tools_googletest_dir |
| 654 | |
| 655 | config("gtest_config") { |
| 656 | include_dirs = [ |
| 657 | "${googletest_dir}/googletest", |
| 658 | "${googletest_dir}/googletest/include", |
| 659 | ] |
| 660 | } |
| 661 | |
Dan Sinclair | a114e1f | 2018-07-17 13:53:15 -0400 | [diff] [blame] | 662 | static_library("gtest") { |
| 663 | testonly = true |
Dan Sinclair | a114e1f | 2018-07-17 13:53:15 -0400 | [diff] [blame] | 664 | sources = [ |
Corentin Wallez | 2d9a325 | 2018-08-02 18:48:03 +0200 | [diff] [blame] | 665 | "${googletest_dir}/googletest/src/gtest-all.cc", |
Dan Sinclair | a114e1f | 2018-07-17 13:53:15 -0400 | [diff] [blame] | 666 | ] |
Corentin Wallez | 2d9a325 | 2018-08-02 18:48:03 +0200 | [diff] [blame] | 667 | public_configs = [ ":gtest_config" ] |
| 668 | } |
Dan Sinclair | a114e1f | 2018-07-17 13:53:15 -0400 | [diff] [blame] | 669 | |
Corentin Wallez | 2d9a325 | 2018-08-02 18:48:03 +0200 | [diff] [blame] | 670 | config("gmock_config") { |
Dan Sinclair | a114e1f | 2018-07-17 13:53:15 -0400 | [diff] [blame] | 671 | include_dirs = [ |
Corentin Wallez | 2d9a325 | 2018-08-02 18:48:03 +0200 | [diff] [blame] | 672 | "${googletest_dir}/googlemock", |
| 673 | "${googletest_dir}/googlemock/include", |
| 674 | "${googletest_dir}/googletest/include", |
Dan Sinclair | a114e1f | 2018-07-17 13:53:15 -0400 | [diff] [blame] | 675 | ] |
Corentin Wallez | 2d9a325 | 2018-08-02 18:48:03 +0200 | [diff] [blame] | 676 | if (is_clang) { |
| 677 | # TODO: Can remove this if/when the issue is fixed. |
| 678 | # https://github.com/google/googletest/issues/533 |
| 679 | cflags = [ "-Wno-inconsistent-missing-override" ] |
| 680 | } |
Dan Sinclair | a114e1f | 2018-07-17 13:53:15 -0400 | [diff] [blame] | 681 | } |
| 682 | |
| 683 | static_library("gmock") { |
| 684 | testonly = true |
| 685 | sources = [ |
Corentin Wallez | 2d9a325 | 2018-08-02 18:48:03 +0200 | [diff] [blame] | 686 | "${googletest_dir}/googlemock/src/gmock-all.cc", |
Dan Sinclair | a114e1f | 2018-07-17 13:53:15 -0400 | [diff] [blame] | 687 | ] |
Corentin Wallez | 2d9a325 | 2018-08-02 18:48:03 +0200 | [diff] [blame] | 688 | public_configs = [ ":gmock_config" ] |
Dan Sinclair | a114e1f | 2018-07-17 13:53:15 -0400 | [diff] [blame] | 689 | } |
| 690 | } |
| 691 | |
Dan Sinclair | a114e1f | 2018-07-17 13:53:15 -0400 | [diff] [blame] | 692 | test("spvtools_test") { |
| 693 | sources = [ |
| 694 | "test/assembly_context_test.cpp", |
| 695 | "test/assembly_format_test.cpp", |
| 696 | "test/binary_destroy_test.cpp", |
| 697 | "test/binary_endianness_test.cpp", |
| 698 | "test/binary_header_get_test.cpp", |
| 699 | "test/binary_parse_test.cpp", |
| 700 | "test/binary_strnlen_s_test.cpp", |
| 701 | "test/binary_to_text.literal_test.cpp", |
| 702 | "test/binary_to_text_test.cpp", |
| 703 | "test/comment_test.cpp", |
| 704 | "test/enum_set_test.cpp", |
| 705 | "test/enum_string_mapping_test.cpp", |
| 706 | "test/ext_inst.debuginfo_test.cpp", |
| 707 | "test/ext_inst.glsl_test.cpp", |
| 708 | "test/ext_inst.opencl_test.cpp", |
| 709 | "test/fix_word_test.cpp", |
| 710 | "test/generator_magic_number_test.cpp", |
| 711 | "test/hex_float_test.cpp", |
| 712 | "test/immediate_int_test.cpp", |
| 713 | "test/libspirv_macros_test.cpp", |
| 714 | "test/name_mapper_test.cpp", |
| 715 | "test/named_id_test.cpp", |
| 716 | "test/opcode_make_test.cpp", |
| 717 | "test/opcode_require_capabilities_test.cpp", |
| 718 | "test/opcode_split_test.cpp", |
| 719 | "test/opcode_table_get_test.cpp", |
| 720 | "test/operand_capabilities_test.cpp", |
| 721 | "test/operand_pattern_test.cpp", |
| 722 | "test/operand_test.cpp", |
| 723 | "test/target_env_test.cpp", |
| 724 | "test/test_fixture.h", |
| 725 | "test/text_advance_test.cpp", |
| 726 | "test/text_destroy_test.cpp", |
| 727 | "test/text_literal_test.cpp", |
| 728 | "test/text_start_new_inst_test.cpp", |
| 729 | "test/text_to_binary.annotation_test.cpp", |
| 730 | "test/text_to_binary.barrier_test.cpp", |
| 731 | "test/text_to_binary.constant_test.cpp", |
| 732 | "test/text_to_binary.control_flow_test.cpp", |
| 733 | "test/text_to_binary.debug_test.cpp", |
| 734 | "test/text_to_binary.device_side_enqueue_test.cpp", |
| 735 | "test/text_to_binary.extension_test.cpp", |
| 736 | "test/text_to_binary.function_test.cpp", |
| 737 | "test/text_to_binary.group_test.cpp", |
| 738 | "test/text_to_binary.image_test.cpp", |
| 739 | "test/text_to_binary.literal_test.cpp", |
| 740 | "test/text_to_binary.memory_test.cpp", |
| 741 | "test/text_to_binary.misc_test.cpp", |
| 742 | "test/text_to_binary.mode_setting_test.cpp", |
| 743 | "test/text_to_binary.pipe_storage_test.cpp", |
| 744 | "test/text_to_binary.reserved_sampling_test.cpp", |
| 745 | "test/text_to_binary.subgroup_dispatch_test.cpp", |
| 746 | "test/text_to_binary.type_declaration_test.cpp", |
| 747 | "test/text_to_binary_test.cpp", |
| 748 | "test/text_word_get_test.cpp", |
| 749 | "test/unit_spirv.cpp", |
| 750 | "test/unit_spirv.h", |
| 751 | ] |
| 752 | |
| 753 | deps = [ |
| 754 | ":spvtools", |
dan sinclair | 1553025 | 2018-08-14 12:44:54 -0400 | [diff] [blame] | 755 | ":spvtools_language_header_unified1", |
| 756 | ":spvtools_val", |
Dan Sinclair | a114e1f | 2018-07-17 13:53:15 -0400 | [diff] [blame] | 757 | ] |
| 758 | |
| 759 | if (build_with_chromium) { |
| 760 | deps += [ |
| 761 | "//testing/gmock", |
| 762 | "//testing/gtest", |
| 763 | "//testing/gtest:gtest_main", |
| 764 | ] |
| 765 | } else { |
| 766 | deps += [ |
| 767 | ":gmock", |
| 768 | ":gtest", |
| 769 | ] |
Corentin Wallez | 2d9a325 | 2018-08-02 18:48:03 +0200 | [diff] [blame] | 770 | sources += [ "${googletest_dir}/googletest/src/gtest_main.cc" ] |
Dan Sinclair | a114e1f | 2018-07-17 13:53:15 -0400 | [diff] [blame] | 771 | } |
| 772 | |
Corentin Wallez | 21bcb9d | 2018-09-06 10:50:27 -0400 | [diff] [blame] | 773 | if (is_clang) { |
| 774 | cflags_cc = [ "-Wno-self-assign" ] |
| 775 | } |
| 776 | |
| 777 | configs += [ ":spvtools_internal_config" ] |
Dan Sinclair | a114e1f | 2018-07-17 13:53:15 -0400 | [diff] [blame] | 778 | } |
| 779 | |
Corentin Wallez | 2d9a325 | 2018-08-02 18:48:03 +0200 | [diff] [blame] | 780 | if (spirv_tools_standalone) { |
Dan Sinclair | a114e1f | 2018-07-17 13:53:15 -0400 | [diff] [blame] | 781 | group("fuzzers") { |
| 782 | testonly = true |
| 783 | deps = [ |
Corentin Wallez | 2d9a325 | 2018-08-02 18:48:03 +0200 | [diff] [blame] | 784 | "test/fuzzers", |
Dan Sinclair | a114e1f | 2018-07-17 13:53:15 -0400 | [diff] [blame] | 785 | ] |
| 786 | } |
| 787 | } |
dan sinclair | 1bdade7 | 2018-08-15 15:26:28 -0400 | [diff] [blame] | 788 | |
| 789 | executable("spirv-as") { |
| 790 | sources = [ |
| 791 | "source/software_version.cpp", |
| 792 | "tools/as/as.cpp", |
| 793 | ] |
| 794 | deps = [ |
| 795 | ":spvtools", |
| 796 | ":spvtools_build_version", |
| 797 | ] |
Corentin Wallez | 21bcb9d | 2018-09-06 10:50:27 -0400 | [diff] [blame] | 798 | configs += [ ":spvtools_internal_config" ] |
dan sinclair | 1bdade7 | 2018-08-15 15:26:28 -0400 | [diff] [blame] | 799 | } |