blob: 92dfe06266b30341d5f28fb0ed2996c53762fb69 [file] [log] [blame]
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001# Copyright 2021 The Tint Authors
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")
dan sinclair77bf2332022-06-22 12:40:43 +000016
Ryan Harrisondbc13af2022-02-21 15:19:07 +000017import("../../tint_overrides_with_defaults.gni")
18
dan sinclair77bf2332022-06-22 12:40:43 +000019if (tint_build_unittests) {
20 import("//testing/test.gni")
21}
22
Ryan Harrisondbc13af2022-02-21 15:19:07 +000023###############################################################################
24# Common - Configs, etc. shared across targets
25###############################################################################
26
27config("tint_common_config") {
28 include_dirs = [
29 "${target_gen_dir}",
30 "${tint_root_dir}/",
31 "${tint_spirv_headers_dir}/include",
32 "${tint_spirv_tools_dir}/",
33 "${tint_spirv_tools_dir}/include",
34 ]
35}
36
37config("tint_public_config") {
38 defines = []
39 if (tint_build_spv_reader) {
40 defines += [ "TINT_BUILD_SPV_READER=1" ]
41 } else {
42 defines += [ "TINT_BUILD_SPV_READER=0" ]
43 }
44
45 if (tint_build_spv_writer) {
46 defines += [ "TINT_BUILD_SPV_WRITER=1" ]
47 } else {
48 defines += [ "TINT_BUILD_SPV_WRITER=0" ]
49 }
50
51 if (tint_build_wgsl_reader) {
52 defines += [ "TINT_BUILD_WGSL_READER=1" ]
53 } else {
54 defines += [ "TINT_BUILD_WGSL_READER=0" ]
55 }
56
57 if (tint_build_wgsl_writer) {
58 defines += [ "TINT_BUILD_WGSL_WRITER=1" ]
59 } else {
60 defines += [ "TINT_BUILD_WGSL_WRITER=0" ]
61 }
62
63 if (tint_build_msl_writer) {
64 defines += [ "TINT_BUILD_MSL_WRITER=1" ]
65 } else {
66 defines += [ "TINT_BUILD_MSL_WRITER=0" ]
67 }
68
69 if (tint_build_hlsl_writer) {
70 defines += [ "TINT_BUILD_HLSL_WRITER=1" ]
71 } else {
72 defines += [ "TINT_BUILD_HLSL_WRITER=0" ]
73 }
74
75 if (tint_build_glsl_writer) {
76 defines += [ "TINT_BUILD_GLSL_WRITER=1" ]
77 } else {
78 defines += [ "TINT_BUILD_GLSL_WRITER=0" ]
79 }
80
81 include_dirs = [
82 "${tint_root_dir}/",
83 "${tint_root_dir}/include/",
84 "${tint_spirv_headers_dir}/include",
85 ]
86}
87
88config("tint_config") {
89 include_dirs = []
90 if (tint_build_spv_reader || tint_build_spv_writer) {
91 include_dirs += [ "${tint_spirv_tools_dir}/include/" ]
92 }
93}
94
95###############################################################################
96# Helper library for IO operations
97# Only to be used by tests and sample executable
98###############################################################################
99source_set("tint_utils_io") {
100 sources = [
101 "utils/io/command.h",
102 "utils/io/tmpfile.h",
103 ]
104
105 if (is_linux || is_mac) {
106 sources += [ "utils/io/command_posix.cc" ]
107 sources += [ "utils/io/tmpfile_posix.cc" ]
108 } else if (is_win) {
109 sources += [ "utils/io/command_windows.cc" ]
110 sources += [ "utils/io/tmpfile_windows.cc" ]
111 } else {
112 sources += [ "utils/io/command_other.cc" ]
113 sources += [ "utils/io/tmpfile_other.cc" ]
114 }
115
116 public_deps = [ ":libtint_core_all_src" ]
117}
118
119###############################################################################
120# Helper library for validating generated shaders
121# As this depends on tint_utils_io, this is only to be used by tests and sample
122# executable
123###############################################################################
124source_set("tint_val") {
125 sources = [
126 "val/hlsl.cc",
127 "val/msl.cc",
128 "val/val.h",
129 ]
130 public_deps = [ ":tint_utils_io" ]
131}
132
133###############################################################################
134# Library - Tint core and optional modules of libtint
135###############################################################################
136# libtint source sets are divided into a non-optional core in :libtint_core_src
137# and optional :libtint_*_src subsets, because ninja does not like having
138# multiple source files with the same name, like function.cc, in the same
139# source set
140# target.
141#
142# Targets that want to use tint as a library should depend on ":libtint" and
143# use the build flags to control what is included, instead of trying to specify
144# the subsets that they want.
145
146template("libtint_source_set") {
147 source_set(target_name) {
148 forward_variables_from(invoker, "*", [ "configs" ])
149
150 if (!defined(invoker.deps)) {
151 deps = []
152 }
153 deps += [
154 "${tint_spirv_headers_dir}:spv_headers",
155 "${tint_spirv_tools_dir}:spvtools_core_enums_unified1",
156 "${tint_spirv_tools_dir}:spvtools_core_tables_unified1",
157 "${tint_spirv_tools_dir}:spvtools_headers",
158 "${tint_spirv_tools_dir}:spvtools_language_header_cldebuginfo100",
159 "${tint_spirv_tools_dir}:spvtools_language_header_debuginfo",
160 "${tint_spirv_tools_dir}:spvtools_language_header_vkdebuginfo100",
161 ]
162
163 if (defined(invoker.configs)) {
164 configs += invoker.configs
165 }
166 configs += [ ":tint_common_config" ]
167 if (build_with_chromium) {
168 configs -= [ "//build/config/compiler:chromium_code" ]
169 configs += [ "//build/config/compiler:no_chromium_code" ]
170 }
171
172 if (!defined(invoker.public_configs)) {
173 public_configs = []
174 }
175 public_configs += [ ":tint_public_config" ]
176 }
177}
178
179libtint_source_set("libtint_core_all_src") {
180 sources = [
181 "ast/access.cc",
182 "ast/access.h",
dan sinclairff7cf212022-10-03 14:05:23 +0000183 "ast/address_space.cc",
184 "ast/address_space.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000185 "ast/alias.cc",
186 "ast/alias.h",
187 "ast/array.cc",
188 "ast/array.h",
189 "ast/assignment_statement.cc",
190 "ast/assignment_statement.h",
191 "ast/ast_type.cc", # TODO(bclayton) - rename to type.cc
192 "ast/atomic.cc",
193 "ast/atomic.h",
194 "ast/attribute.cc",
195 "ast/attribute.h",
196 "ast/binary_expression.cc",
197 "ast/binary_expression.h",
198 "ast/binding_attribute.cc",
199 "ast/binding_attribute.h",
200 "ast/bitcast_expression.cc",
201 "ast/bitcast_expression.h",
202 "ast/block_statement.cc",
203 "ast/block_statement.h",
204 "ast/bool.cc",
205 "ast/bool.h",
206 "ast/bool_literal_expression.cc",
207 "ast/bool_literal_expression.h",
dan sinclairb8b0c212022-10-20 22:45:50 +0000208 "ast/break_if_statement.cc",
209 "ast/break_if_statement.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000210 "ast/break_statement.cc",
211 "ast/break_statement.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000212 "ast/builtin_attribute.cc",
213 "ast/builtin_attribute.h",
Ben Claytonf3302292022-07-27 18:48:06 +0000214 "ast/builtin_value.cc",
215 "ast/builtin_value.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000216 "ast/call_expression.cc",
217 "ast/call_expression.h",
218 "ast/call_statement.cc",
219 "ast/call_statement.h",
dan sinclairf148f082022-10-19 15:55:02 +0000220 "ast/case_selector.cc",
221 "ast/case_selector.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000222 "ast/case_statement.cc",
223 "ast/case_statement.h",
James Price49241862022-03-31 22:30:10 +0000224 "ast/compound_assignment_statement.cc",
225 "ast/compound_assignment_statement.h",
Ben Clayton7ee32452022-06-20 20:46:22 +0000226 "ast/const.cc",
227 "ast/const.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000228 "ast/continue_statement.cc",
229 "ast/continue_statement.h",
230 "ast/depth_multisampled_texture.cc",
231 "ast/depth_multisampled_texture.h",
232 "ast/depth_texture.cc",
233 "ast/depth_texture.h",
234 "ast/disable_validation_attribute.cc",
235 "ast/disable_validation_attribute.h",
236 "ast/discard_statement.cc",
237 "ast/discard_statement.h",
Zhaoming Jiang7098d3d2022-04-27 02:27:52 +0000238 "ast/enable.cc",
239 "ast/enable.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000240 "ast/expression.cc",
241 "ast/expression.h",
Ben Clayton7f2b8cd2022-05-18 22:41:48 +0000242 "ast/extension.cc",
243 "ast/extension.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000244 "ast/external_texture.cc",
245 "ast/external_texture.h",
Zhaoming Jiang62bfd312022-05-13 12:01:11 +0000246 "ast/f16.cc",
247 "ast/f16.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000248 "ast/f32.cc",
249 "ast/f32.h",
250 "ast/fallthrough_statement.cc",
251 "ast/fallthrough_statement.h",
252 "ast/float_literal_expression.cc",
253 "ast/float_literal_expression.h",
254 "ast/for_loop_statement.cc",
255 "ast/for_loop_statement.h",
256 "ast/function.cc",
257 "ast/function.h",
258 "ast/group_attribute.cc",
259 "ast/group_attribute.h",
260 "ast/i32.cc",
261 "ast/i32.h",
262 "ast/id_attribute.cc",
263 "ast/id_attribute.h",
264 "ast/identifier_expression.cc",
265 "ast/identifier_expression.h",
266 "ast/if_statement.cc",
267 "ast/if_statement.h",
James Priceebe97412022-04-07 13:42:45 +0000268 "ast/increment_decrement_statement.cc",
269 "ast/increment_decrement_statement.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000270 "ast/index_accessor_expression.cc",
271 "ast/index_accessor_expression.h",
272 "ast/int_literal_expression.cc",
273 "ast/int_literal_expression.h",
274 "ast/internal_attribute.cc",
275 "ast/internal_attribute.h",
276 "ast/interpolate_attribute.cc",
277 "ast/interpolate_attribute.h",
278 "ast/invariant_attribute.cc",
279 "ast/invariant_attribute.h",
Ben Claytondcdf66e2022-06-17 12:48:51 +0000280 "ast/let.cc",
281 "ast/let.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000282 "ast/literal_expression.cc",
283 "ast/literal_expression.h",
284 "ast/location_attribute.cc",
285 "ast/location_attribute.h",
286 "ast/loop_statement.cc",
287 "ast/loop_statement.h",
288 "ast/matrix.cc",
289 "ast/matrix.h",
290 "ast/member_accessor_expression.cc",
291 "ast/member_accessor_expression.h",
292 "ast/module.cc",
293 "ast/module.h",
294 "ast/multisampled_texture.cc",
295 "ast/multisampled_texture.h",
296 "ast/node.cc",
297 "ast/node.h",
dan sinclair256f1112022-07-22 16:05:06 +0000298 "ast/node_id.h",
Ben Claytondcdf66e2022-06-17 12:48:51 +0000299 "ast/override.cc",
300 "ast/override.h",
301 "ast/parameter.cc",
302 "ast/parameter.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000303 "ast/phony_expression.cc",
304 "ast/phony_expression.h",
305 "ast/pipeline_stage.cc",
306 "ast/pipeline_stage.h",
307 "ast/pointer.cc",
308 "ast/pointer.h",
309 "ast/return_statement.cc",
310 "ast/return_statement.h",
311 "ast/sampled_texture.cc",
312 "ast/sampled_texture.h",
313 "ast/sampler.cc",
314 "ast/sampler.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000315 "ast/stage_attribute.cc",
316 "ast/stage_attribute.h",
317 "ast/statement.cc",
318 "ast/statement.h",
Ben Claytonbfd1a812022-08-02 23:16:25 +0000319 "ast/static_assert.cc",
320 "ast/static_assert.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000321 "ast/storage_texture.cc",
322 "ast/storage_texture.h",
323 "ast/stride_attribute.cc",
324 "ast/stride_attribute.h",
325 "ast/struct.cc",
326 "ast/struct.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000327 "ast/struct_member.cc",
328 "ast/struct_member.h",
329 "ast/struct_member_align_attribute.cc",
330 "ast/struct_member_align_attribute.h",
331 "ast/struct_member_offset_attribute.cc",
332 "ast/struct_member_offset_attribute.h",
333 "ast/struct_member_size_attribute.cc",
334 "ast/struct_member_size_attribute.h",
335 "ast/switch_statement.cc",
336 "ast/switch_statement.h",
Ben Clayton08659d02022-07-27 22:30:10 +0000337 "ast/texel_format.cc",
338 "ast/texel_format.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000339 "ast/texture.cc",
340 "ast/texture.h",
341 "ast/traverse_expressions.h",
342 "ast/type.h",
343 "ast/type_decl.cc",
344 "ast/type_decl.h",
345 "ast/type_name.cc",
346 "ast/type_name.h",
347 "ast/u32.cc",
348 "ast/u32.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000349 "ast/unary_op.cc",
350 "ast/unary_op.h",
351 "ast/unary_op_expression.cc",
352 "ast/unary_op_expression.h",
Ben Claytondcdf66e2022-06-17 12:48:51 +0000353 "ast/var.cc",
354 "ast/var.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000355 "ast/variable.cc",
356 "ast/variable.h",
357 "ast/variable_decl_statement.cc",
358 "ast/variable_decl_statement.h",
359 "ast/vector.cc",
360 "ast/vector.h",
361 "ast/void.cc",
362 "ast/void.h",
dan sinclair49d1a2d2022-06-16 12:01:27 +0000363 "ast/while_statement.cc",
364 "ast/while_statement.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000365 "ast/workgroup_attribute.cc",
366 "ast/workgroup_attribute.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000367 "castable.cc",
368 "castable.h",
369 "clone_context.cc",
370 "clone_context.h",
371 "debug.cc",
372 "debug.h",
373 "demangler.cc",
374 "demangler.h",
375 "diagnostic/diagnostic.cc",
376 "diagnostic/diagnostic.h",
377 "diagnostic/formatter.cc",
378 "diagnostic/formatter.h",
379 "diagnostic/printer.cc",
380 "diagnostic/printer.h",
381 "inspector/entry_point.cc",
382 "inspector/entry_point.h",
383 "inspector/inspector.cc",
384 "inspector/inspector.h",
385 "inspector/resource_binding.cc",
386 "inspector/resource_binding.h",
387 "inspector/scalar.cc",
388 "inspector/scalar.h",
Ben Claytonc2eccfc2022-05-25 15:04:24 +0000389 "number.cc",
Zhaoming Jiang62bfd312022-05-13 12:01:11 +0000390 "number.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000391 "program.cc",
392 "program.h",
393 "program_builder.cc",
394 "program_builder.h",
395 "program_id.cc",
396 "program_id.h",
397 "reader/reader.cc",
398 "reader/reader.h",
Stephen White863d9ed2022-09-02 19:19:10 +0000399 "reflection.h",
Ben Clayton451eee02022-06-01 23:57:20 +0000400 "resolver/const_eval.cc",
401 "resolver/const_eval.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000402 "resolver/dependency_graph.cc",
403 "resolver/dependency_graph.h",
dan sinclair6e77b472022-10-20 13:38:28 +0000404 "resolver/init_conv_intrinsic.cc",
405 "resolver/init_conv_intrinsic.h",
Ben Claytone1325162022-05-06 15:13:01 +0000406 "resolver/intrinsic_table.cc",
407 "resolver/intrinsic_table.h",
408 "resolver/intrinsic_table.inl",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000409 "resolver/resolver.cc",
410 "resolver/resolver.h",
dan sinclairbb62ef02022-04-19 15:00:44 +0000411 "resolver/sem_helper.cc",
412 "resolver/sem_helper.h",
James Pricebe656f72022-05-11 22:05:15 +0000413 "resolver/uniformity.cc",
414 "resolver/uniformity.h",
dan sinclairf05575b2022-04-21 13:40:16 +0000415 "resolver/validator.cc",
416 "resolver/validator.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000417 "scope_stack.h",
Ben Clayton23696b12022-05-18 21:56:28 +0000418 "sem/abstract_float.h",
419 "sem/abstract_int.h",
420 "sem/abstract_numeric.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000421 "sem/array.h",
Ben Clayton01004b72022-04-28 18:49:04 +0000422 "sem/atomic.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000423 "sem/behavior.h",
424 "sem/binding_point.h",
Ben Clayton01004b72022-04-28 18:49:04 +0000425 "sem/bool.h",
dan sinclairb8b0c212022-10-20 22:45:50 +0000426 "sem/break_if_statement.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000427 "sem/builtin.h",
428 "sem/builtin_type.h",
429 "sem/call.h",
430 "sem/call_target.h",
431 "sem/constant.h",
Ben Clayton01004b72022-04-28 18:49:04 +0000432 "sem/depth_multisampled_texture.h",
433 "sem/depth_texture.h",
Ben Clayton83bd7382022-07-15 23:46:31 +0000434 "sem/evaluation_stage.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000435 "sem/expression.h",
Ben Clayton01004b72022-04-28 18:49:04 +0000436 "sem/external_texture.h",
Zhaoming Jiang62bfd312022-05-13 12:01:11 +0000437 "sem/f16.h",
Ben Clayton01004b72022-04-28 18:49:04 +0000438 "sem/f32.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000439 "sem/for_loop_statement.h",
Ben Clayton01004b72022-04-28 18:49:04 +0000440 "sem/i32.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000441 "sem/if_statement.h",
Antonio Maioranodfeaf2902022-06-24 20:34:00 +0000442 "sem/index_accessor_expression.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000443 "sem/info.h",
444 "sem/loop_statement.h",
Ben Clayton932418e2022-05-24 21:42:03 +0000445 "sem/materialize.h",
Ben Clayton01004b72022-04-28 18:49:04 +0000446 "sem/matrix.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000447 "sem/module.h",
Ben Clayton01004b72022-04-28 18:49:04 +0000448 "sem/multisampled_texture.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000449 "sem/node.h",
450 "sem/parameter_usage.h",
451 "sem/pipeline_stage_set.h",
Ben Clayton01004b72022-04-28 18:49:04 +0000452 "sem/pointer.h",
453 "sem/reference.h",
454 "sem/sampled_texture.h",
Ben Clayton01004b72022-04-28 18:49:04 +0000455 "sem/sampler.h",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000456 "sem/sampler_texture_pair.h",
Ben Clayton01004b72022-04-28 18:49:04 +0000457 "sem/storage_texture.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000458 "sem/switch_statement.h",
Ben Clayton01004b72022-04-28 18:49:04 +0000459 "sem/texture.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000460 "sem/type.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000461 "sem/type_conversion.h",
dan sinclair6e77b472022-10-20 13:38:28 +0000462 "sem/type_initializer.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000463 "sem/type_manager.h",
464 "sem/type_mappings.h",
Ben Clayton01004b72022-04-28 18:49:04 +0000465 "sem/u32.h",
466 "sem/vector.h",
467 "sem/void.h",
dan sinclair49d1a2d2022-06-16 12:01:27 +0000468 "sem/while_statement.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000469 "source.cc",
470 "source.h",
471 "symbol.cc",
472 "symbol.h",
473 "symbol_table.cc",
474 "symbol_table.h",
475 "text/unicode.cc",
476 "text/unicode.h",
477 "traits.h",
Stephen White863d9ed2022-09-02 19:19:10 +0000478 "transform/add_block_attribute.cc",
479 "transform/add_block_attribute.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000480 "transform/add_empty_entry_point.cc",
481 "transform/add_empty_entry_point.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000482 "transform/array_length_from_uniform.cc",
483 "transform/array_length_from_uniform.h",
484 "transform/binding_remapper.cc",
485 "transform/binding_remapper.h",
Ben Clayton27aa57c2022-02-22 23:13:39 +0000486 "transform/builtin_polyfill.cc",
487 "transform/builtin_polyfill.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000488 "transform/calculate_array_length.cc",
489 "transform/calculate_array_length.h",
490 "transform/canonicalize_entry_point_io.cc",
491 "transform/canonicalize_entry_point_io.h",
Corentin Wallez98a7cd12022-10-11 09:52:25 +0000492 "transform/clamp_frag_depth.cc",
493 "transform/clamp_frag_depth.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000494 "transform/combine_samplers.cc",
495 "transform/combine_samplers.h",
496 "transform/decompose_memory_access.cc",
497 "transform/decompose_memory_access.h",
498 "transform/decompose_strided_array.cc",
499 "transform/decompose_strided_array.h",
500 "transform/decompose_strided_matrix.cc",
501 "transform/decompose_strided_matrix.h",
James Price791b4352022-05-11 13:50:33 +0000502 "transform/disable_uniformity_analysis.cc",
503 "transform/disable_uniformity_analysis.h",
Corentin Wallezb28d6c82022-04-07 11:36:06 +0000504 "transform/expand_compound_assignment.cc",
505 "transform/expand_compound_assignment.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000506 "transform/first_index_offset.cc",
507 "transform/first_index_offset.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000508 "transform/for_loop_to_loop.cc",
509 "transform/for_loop_to_loop.h",
510 "transform/localize_struct_array_assignment.cc",
511 "transform/localize_struct_array_assignment.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000512 "transform/manager.cc",
513 "transform/manager.h",
James Price5de8b432022-10-31 14:49:03 +0000514 "transform/merge_return.cc",
515 "transform/merge_return.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000516 "transform/module_scope_var_to_entry_point_param.cc",
517 "transform/module_scope_var_to_entry_point_param.h",
518 "transform/multiplanar_external_texture.cc",
519 "transform/multiplanar_external_texture.h",
520 "transform/num_workgroups_from_uniform.cc",
521 "transform/num_workgroups_from_uniform.h",
Ben Claytona92f4252022-10-27 14:36:49 +0000522 "transform/packed_vec3.cc",
523 "transform/packed_vec3.h",
Stephen White05d8b022022-09-13 19:48:51 +0000524 "transform/pad_structs.cc",
525 "transform/pad_structs.h",
Ben Clayton7ebcfc72022-06-27 20:20:25 +0000526 "transform/promote_initializers_to_let.cc",
527 "transform/promote_initializers_to_let.h",
Antonio Maioranoc25ddf42022-03-15 15:03:03 +0000528 "transform/promote_side_effects_to_decl.cc",
529 "transform/promote_side_effects_to_decl.h",
Antonio Maioranob3497102022-03-31 15:02:25 +0000530 "transform/remove_continue_in_switch.cc",
531 "transform/remove_continue_in_switch.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000532 "transform/remove_phonies.cc",
533 "transform/remove_phonies.h",
534 "transform/remove_unreachable_statements.cc",
535 "transform/remove_unreachable_statements.h",
536 "transform/renamer.cc",
537 "transform/renamer.h",
538 "transform/robustness.cc",
539 "transform/robustness.h",
540 "transform/simplify_pointers.cc",
541 "transform/simplify_pointers.h",
542 "transform/single_entry_point.cc",
543 "transform/single_entry_point.h",
Antonio Maiorano268d7b82022-06-24 22:28:23 +0000544 "transform/spirv_atomic.cc",
545 "transform/spirv_atomic.h",
Ben Clayton657e61d2022-09-01 22:12:19 +0000546 "transform/std140.cc",
547 "transform/std140.h",
dan sinclair256f1112022-07-22 16:05:06 +0000548 "transform/substitute_override.cc",
549 "transform/substitute_override.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000550 "transform/transform.cc",
551 "transform/transform.h",
552 "transform/unshadow.cc",
553 "transform/unshadow.h",
Antonio Maiorano66d66682022-03-28 20:51:32 +0000554 "transform/unwind_discard_functions.cc",
555 "transform/unwind_discard_functions.h",
Antonio Maioranoc2e9bb72022-03-30 20:11:35 +0000556 "transform/utils/get_insertion_point.cc",
557 "transform/utils/get_insertion_point.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000558 "transform/utils/hoist_to_decl_before.cc",
559 "transform/utils/hoist_to_decl_before.h",
560 "transform/var_for_dynamic_index.cc",
561 "transform/var_for_dynamic_index.h",
Zhaoming Jiang426b47e2022-09-01 03:08:20 +0000562 "transform/vectorize_matrix_conversions.cc",
563 "transform/vectorize_matrix_conversions.h",
dan sinclair6e77b472022-10-20 13:38:28 +0000564 "transform/vectorize_scalar_matrix_initializers.cc",
565 "transform/vectorize_scalar_matrix_initializers.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000566 "transform/vertex_pulling.cc",
567 "transform/vertex_pulling.h",
dan sinclair49d1a2d2022-06-16 12:01:27 +0000568 "transform/while_to_loop.cc",
569 "transform/while_to_loop.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000570 "transform/zero_init_workgroup_memory.cc",
571 "transform/zero_init_workgroup_memory.h",
Ben Clayton7cbd8202022-05-05 15:34:41 +0000572 "utils/bitcast.h",
Ben Claytone43034b2022-07-21 23:32:24 +0000573 "utils/bitset.h",
Ben Clayton4cb13292022-03-04 21:09:24 +0000574 "utils/block_allocator.h",
Ben Clayton9707e6b2022-05-25 19:28:55 +0000575 "utils/compiler_macros.h",
576 "utils/concat.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000577 "utils/crc32.h",
578 "utils/debugger.cc",
579 "utils/debugger.h",
580 "utils/enum_set.h",
Ben Clayton648bd7b2022-09-02 11:40:19 +0000581 "utils/foreach_macro.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000582 "utils/hash.h",
Ben Claytone13160e2022-08-17 16:28:23 +0000583 "utils/hashmap.h",
584 "utils/hashset.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000585 "utils/map.h",
586 "utils/math.h",
587 "utils/scoped_assignment.h",
Ben Claytond04c54e2022-10-11 17:53:07 +0000588 "utils/string.cc",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000589 "utils/string.h",
Ben Claytone2283192022-03-05 00:29:15 +0000590 "utils/unique_allocator.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000591 "utils/unique_vector.h",
Ben Clayton3bc20e32022-07-21 19:34:05 +0000592 "utils/vector.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000593 "writer/append_vector.cc",
594 "writer/append_vector.h",
595 "writer/array_length_from_uniform_options.cc",
596 "writer/array_length_from_uniform_options.h",
Ben Clayton1a567782022-10-14 13:38:27 +0000597 "writer/check_supported_extensions.cc",
598 "writer/check_supported_extensions.h",
Antonio Maiorano4e98fb02022-05-02 19:49:19 +0000599 "writer/flatten_bindings.cc",
600 "writer/flatten_bindings.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000601 "writer/float_to_string.cc",
602 "writer/float_to_string.h",
Antonio Maioranoa730eb72022-04-06 13:57:54 +0000603 "writer/generate_external_texture_bindings.cc",
604 "writer/generate_external_texture_bindings.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000605 "writer/text.cc",
606 "writer/text.h",
607 "writer/text_generator.cc",
608 "writer/text_generator.h",
609 "writer/writer.cc",
610 "writer/writer.h",
611 ]
612
613 if (is_linux) {
614 sources += [ "diagnostic/printer_linux.cc" ]
615 } else if (is_win) {
616 sources += [ "diagnostic/printer_windows.cc" ]
617 } else {
618 sources += [ "diagnostic/printer_other.cc" ]
619 }
620}
621
622libtint_source_set("libtint_sem_src") {
623 sources = [
Ben Clayton94328872022-04-29 09:14:15 +0000624 "sem/abstract_float.cc",
625 "sem/abstract_float.h",
626 "sem/abstract_int.cc",
627 "sem/abstract_int.h",
628 "sem/abstract_numeric.cc",
629 "sem/abstract_numeric.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000630 "sem/array.cc",
631 "sem/array.h",
Ben Clayton01004b72022-04-28 18:49:04 +0000632 "sem/atomic.cc",
633 "sem/atomic.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000634 "sem/behavior.cc",
635 "sem/behavior.h",
636 "sem/binding_point.h",
637 "sem/block_statement.cc",
Ben Clayton01004b72022-04-28 18:49:04 +0000638 "sem/bool.cc",
639 "sem/bool.h",
dan sinclairb8b0c212022-10-20 22:45:50 +0000640 "sem/break_if_statement.cc",
641 "sem/break_if_statement.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000642 "sem/builtin.cc",
643 "sem/builtin.h",
644 "sem/builtin_type.cc",
645 "sem/builtin_type.h",
646 "sem/call.cc",
647 "sem/call.h",
648 "sem/call_target.cc",
649 "sem/call_target.h",
650 "sem/constant.cc",
651 "sem/constant.h",
Ben Clayton01004b72022-04-28 18:49:04 +0000652 "sem/depth_multisampled_texture.cc",
653 "sem/depth_multisampled_texture.h",
654 "sem/depth_texture.cc",
655 "sem/depth_texture.h",
Ben Clayton83bd7382022-07-15 23:46:31 +0000656 "sem/evaluation_stage.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000657 "sem/expression.cc",
658 "sem/expression.h",
Ben Clayton01004b72022-04-28 18:49:04 +0000659 "sem/external_texture.cc",
660 "sem/external_texture.h",
Zhaoming Jiang62bfd312022-05-13 12:01:11 +0000661 "sem/f16.cc",
662 "sem/f16.h",
Ben Clayton01004b72022-04-28 18:49:04 +0000663 "sem/f32.cc",
664 "sem/f32.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000665 "sem/for_loop_statement.cc",
666 "sem/for_loop_statement.h",
667 "sem/function.cc",
Ben Clayton01004b72022-04-28 18:49:04 +0000668 "sem/i32.cc",
669 "sem/i32.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000670 "sem/if_statement.cc",
671 "sem/if_statement.h",
Antonio Maioranodfeaf2902022-06-24 20:34:00 +0000672 "sem/index_accessor_expression.cc",
673 "sem/index_accessor_expression.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000674 "sem/info.cc",
675 "sem/info.h",
676 "sem/loop_statement.cc",
677 "sem/loop_statement.h",
Ben Clayton2081ee42022-05-19 19:32:29 +0000678 "sem/materialize.cc",
679 "sem/materialize.h",
Ben Clayton01004b72022-04-28 18:49:04 +0000680 "sem/matrix.cc",
681 "sem/matrix.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000682 "sem/member_accessor_expression.cc",
683 "sem/module.cc",
684 "sem/module.h",
Ben Clayton01004b72022-04-28 18:49:04 +0000685 "sem/multisampled_texture.cc",
686 "sem/multisampled_texture.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000687 "sem/node.cc",
688 "sem/node.h",
689 "sem/parameter_usage.cc",
690 "sem/parameter_usage.h",
691 "sem/pipeline_stage_set.h",
Ben Clayton01004b72022-04-28 18:49:04 +0000692 "sem/pointer.cc",
693 "sem/pointer.h",
694 "sem/reference.cc",
695 "sem/reference.h",
696 "sem/sampled_texture.cc",
697 "sem/sampled_texture.h",
698 "sem/sampler.cc",
699 "sem/sampler.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000700 "sem/statement.cc",
Ben Clayton01004b72022-04-28 18:49:04 +0000701 "sem/storage_texture.cc",
702 "sem/storage_texture.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000703 "sem/struct.cc",
704 "sem/switch_statement.cc",
705 "sem/switch_statement.h",
Ben Clayton01004b72022-04-28 18:49:04 +0000706 "sem/texture.cc",
707 "sem/texture.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000708 "sem/type.cc",
709 "sem/type.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000710 "sem/type_conversion.cc",
711 "sem/type_conversion.h",
dan sinclair6e77b472022-10-20 13:38:28 +0000712 "sem/type_initializer.cc",
713 "sem/type_initializer.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000714 "sem/type_manager.cc",
715 "sem/type_manager.h",
716 "sem/type_mappings.h",
Ben Clayton01004b72022-04-28 18:49:04 +0000717 "sem/u32.cc",
718 "sem/u32.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000719 "sem/variable.cc",
Ben Clayton01004b72022-04-28 18:49:04 +0000720 "sem/vector.cc",
721 "sem/vector.h",
722 "sem/void.cc",
723 "sem/void.h",
dan sinclair49d1a2d2022-06-16 12:01:27 +0000724 "sem/while_statement.cc",
725 "sem/while_statement.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000726 ]
727
728 public_deps = [ ":libtint_core_all_src" ]
729}
730
731libtint_source_set("libtint_core_src") {
732 public_deps = [
733 ":libtint_core_all_src",
734 ":libtint_sem_src",
735 ]
736}
737
738libtint_source_set("libtint_spv_reader_src") {
739 sources = [
740 "reader/spirv/construct.cc",
741 "reader/spirv/construct.h",
742 "reader/spirv/entry_point_info.cc",
743 "reader/spirv/entry_point_info.h",
744 "reader/spirv/enum_converter.cc",
745 "reader/spirv/enum_converter.h",
746 "reader/spirv/fail_stream.h",
747 "reader/spirv/function.cc",
748 "reader/spirv/function.h",
749 "reader/spirv/namer.cc",
750 "reader/spirv/namer.h",
751 "reader/spirv/parser.cc",
752 "reader/spirv/parser.h",
753 "reader/spirv/parser_impl.cc",
754 "reader/spirv/parser_impl.h",
755 "reader/spirv/parser_type.cc",
756 "reader/spirv/parser_type.h",
757 "reader/spirv/usage.cc",
758 "reader/spirv/usage.h",
759 ]
760
761 public_deps = [
762 ":libtint_core_src",
763 "${tint_spirv_tools_dir}/:spvtools_opt",
764 ]
765
766 public_configs = [ "${tint_spirv_tools_dir}/:spvtools_internal_config" ]
767}
768
769libtint_source_set("libtint_spv_writer_src") {
770 sources = [
771 "writer/spirv/binary_writer.cc",
772 "writer/spirv/binary_writer.h",
773 "writer/spirv/builder.cc",
774 "writer/spirv/builder.h",
775 "writer/spirv/function.cc",
776 "writer/spirv/function.h",
777 "writer/spirv/generator.cc",
778 "writer/spirv/generator.h",
Antonio Maioranob5c46c32022-04-11 21:10:20 +0000779 "writer/spirv/generator_impl.cc",
780 "writer/spirv/generator_impl.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000781 "writer/spirv/instruction.cc",
782 "writer/spirv/instruction.h",
783 "writer/spirv/operand.cc",
784 "writer/spirv/operand.h",
785 "writer/spirv/scalar_constant.h",
786 ]
787
788 public_deps = [ ":libtint_core_src" ]
789}
790
791libtint_source_set("libtint_wgsl_reader_src") {
792 sources = [
793 "reader/wgsl/lexer.cc",
794 "reader/wgsl/lexer.h",
795 "reader/wgsl/parser.cc",
796 "reader/wgsl/parser.h",
797 "reader/wgsl/parser_impl.cc",
798 "reader/wgsl/parser_impl.h",
799 "reader/wgsl/parser_impl_detail.h",
800 "reader/wgsl/token.cc",
801 "reader/wgsl/token.h",
802 ]
803
804 public_deps = [ ":libtint_core_src" ]
805}
806
807libtint_source_set("libtint_wgsl_writer_src") {
808 sources = [
809 "writer/wgsl/generator.cc",
810 "writer/wgsl/generator.h",
811 "writer/wgsl/generator_impl.cc",
812 "writer/wgsl/generator_impl.h",
813 ]
814
815 public_deps = [ ":libtint_core_src" ]
816}
817
818libtint_source_set("libtint_msl_writer_src") {
819 sources = [
820 "writer/msl/generator.cc",
821 "writer/msl/generator.h",
822 "writer/msl/generator_impl.cc",
823 "writer/msl/generator_impl.h",
824 ]
825
826 public_deps = [ ":libtint_core_src" ]
827}
828
829libtint_source_set("libtint_hlsl_writer_src") {
830 sources = [
831 "writer/hlsl/generator.cc",
832 "writer/hlsl/generator.h",
833 "writer/hlsl/generator_impl.cc",
834 "writer/hlsl/generator_impl.h",
835 ]
836
837 public_deps = [ ":libtint_core_src" ]
838}
839
840libtint_source_set("libtint_glsl_writer_src") {
841 sources = [
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000842 "writer/glsl/generator.cc",
843 "writer/glsl/generator.h",
844 "writer/glsl/generator_impl.cc",
845 "writer/glsl/generator_impl.h",
846 ]
847
848 public_deps = [ ":libtint_core_src" ]
849}
850
851source_set("libtint") {
852 public_deps = [ ":libtint_core_src" ]
853
854 if (tint_build_spv_reader) {
855 public_deps += [ ":libtint_spv_reader_src" ]
856 }
857
858 if (tint_build_spv_writer) {
859 public_deps += [ ":libtint_spv_writer_src" ]
860 }
861
862 if (tint_build_wgsl_reader) {
863 public_deps += [ ":libtint_wgsl_reader_src" ]
864 }
865
866 if (tint_build_wgsl_writer) {
867 public_deps += [ ":libtint_wgsl_writer_src" ]
868 }
869
870 if (tint_build_msl_writer) {
871 public_deps += [ ":libtint_msl_writer_src" ]
872 }
873
874 if (tint_build_hlsl_writer) {
875 public_deps += [ ":libtint_hlsl_writer_src" ]
876 }
877
878 if (tint_build_glsl_writer) {
879 public_deps += [ ":libtint_glsl_writer_src" ]
880 }
881
882 configs += [ ":tint_common_config" ]
883 public_configs = [ ":tint_public_config" ]
884
885 if (build_with_chromium) {
886 configs -= [ "//build/config/compiler:chromium_code" ]
887 configs += [ "//build/config/compiler:no_chromium_code" ]
888 }
889}
dan sinclair889a4992022-06-17 13:01:59 +0000890
dan sinclair77bf2332022-06-22 12:40:43 +0000891if (tint_build_unittests) {
892 ###############################################################################
893 # Gtest Gmock - Handle building inside and outside of Chromium.
894 ###############################################################################
895 # When building outside of Chromium we need to define our own targets for GTest
896 # and GMock. However when compiling inside of Chromium we need to reuse the
897 # existing targets, both because Chromium has a special harness for swarming
898 # and because otherwise the "gn check" fails.
dan sinclair889a4992022-06-17 13:01:59 +0000899
dan sinclair77bf2332022-06-22 12:40:43 +0000900 if (!build_with_chromium) {
901 # When we aren't in Chromium we define out own targets based on the location
902 # of the googletest repo.
903 config("gtest_config") {
904 include_dirs = [
905 "${tint_googletest_dir}/googletest",
906 "${tint_googletest_dir}/googletest/include",
907 ]
908 }
909 static_library("gtest") {
910 testonly = true
911 sources = [ "${tint_googletest_dir}/googletest/src/gtest-all.cc" ]
912 public_configs = [ ":gtest_config" ]
913 }
914
915 config("gmock_config") {
916 include_dirs = [
917 "${tint_googletest_dir}/googlemock",
918 "${tint_googletest_dir}/googlemock/include",
919 "${tint_googletest_dir}/googletest/include",
920 ]
921 }
922
923 static_library("gmock") {
924 testonly = true
925 sources = [ "${tint_googletest_dir}/googlemock/src/gmock-all.cc" ]
926 public_configs = [ ":gmock_config" ]
927 }
928
929 group("gmock_and_gtest") {
930 testonly = true
931 public_deps = [
932 ":gmock",
933 ":gtest",
934 ]
935 }
936 } else {
937 # When we are in Chromium we reuse its targets, and also add some deps that
938 # are needed to launch the test in swarming mode.
939 group("gmock_and_gtest") {
940 testonly = true
941 public_deps = [
942 "//base",
943 "//base/test:test_support",
944 "//testing/gmock",
945 "//testing/gtest",
946 "//third_party/googletest:gmock",
947 ]
948 }
dan sinclair889a4992022-06-17 13:01:59 +0000949 }
dan sinclair77bf2332022-06-22 12:40:43 +0000950
951 ###############################################################################
952 # Wrapping of Chromium targets
953 ###############################################################################
954 # These targets are separated because they are Chromium sources files that
955 # can't use the tint_internal config, otherwise Tint's warning flags get
956 # applied while compiling a bunch of Chromium's //base (via header inclusion)
957 source_set("tint_unittests_main") {
dan sinclair889a4992022-06-17 13:01:59 +0000958 testonly = true
dan sinclair77bf2332022-06-22 12:40:43 +0000959 deps = [ ":gmock_and_gtest" ]
960 if (build_with_chromium) {
961 sources = [ "//gpu/tint_unittests_main.cc" ]
962 } else {
963 sources = [ "test_main.cc" ]
964 configs += [ ":tint_unittests_config" ]
965 deps += [
966 ":libtint",
967 ":tint_unittests_hlsl_writer_src",
968 ":tint_unittests_msl_writer_src",
969 ":tint_unittests_spv_reader_src",
970 ]
971 }
dan sinclair889a4992022-06-17 13:01:59 +0000972 }
973
dan sinclair77bf2332022-06-22 12:40:43 +0000974 ###############################################################################
975 # Tests - For libtint core and optional modules
976 ###############################################################################
977 config("tint_unittests_config") {
dan sinclair889a4992022-06-17 13:01:59 +0000978 include_dirs = [
dan sinclair889a4992022-06-17 13:01:59 +0000979 "${tint_googletest_dir}/googlemock/include",
980 "${tint_googletest_dir}/googletest/include",
981 ]
dan sinclair889a4992022-06-17 13:01:59 +0000982
dan sinclair77bf2332022-06-22 12:40:43 +0000983 configs = [
984 ":tint_common_config",
985 ":tint_public_config",
dan sinclair889a4992022-06-17 13:01:59 +0000986 ]
987 }
dan sinclair889a4992022-06-17 13:01:59 +0000988
dan sinclair77bf2332022-06-22 12:40:43 +0000989 template("tint_unittests_source_set") {
990 source_set(target_name) {
991 forward_variables_from(invoker, "*", [ "configs" ])
dan sinclair889a4992022-06-17 13:01:59 +0000992
dan sinclair77bf2332022-06-22 12:40:43 +0000993 if (defined(invoker.configs)) {
994 configs += invoker.configs
995 }
996 configs += [ ":tint_unittests_config" ]
997 if (build_with_chromium) {
998 configs -= [ "//build/config/compiler:chromium_code" ]
999 configs += [ "//build/config/compiler:no_chromium_code" ]
1000 }
dan sinclair889a4992022-06-17 13:01:59 +00001001
dan sinclair77bf2332022-06-22 12:40:43 +00001002 testonly = true
dan sinclair889a4992022-06-17 13:01:59 +00001003
dan sinclair77bf2332022-06-22 12:40:43 +00001004 if (!defined(invoker.deps)) {
1005 deps = []
1006 }
1007 deps += [
1008 ":gmock_and_gtest",
1009 ":libtint",
1010 ":tint_utils_io",
1011 ]
dan sinclair889a4992022-06-17 13:01:59 +00001012 }
dan sinclair77bf2332022-06-22 12:40:43 +00001013 }
1014
1015 tint_unittests_source_set("tint_unittests_ast_src") {
1016 sources = [
dan sinclairff7cf212022-10-03 14:05:23 +00001017 "ast/address_space_test.cc",
dan sinclair77bf2332022-06-22 12:40:43 +00001018 "ast/alias_test.cc",
1019 "ast/array_test.cc",
1020 "ast/assignment_statement_test.cc",
1021 "ast/atomic_test.cc",
1022 "ast/binary_expression_test.cc",
1023 "ast/binding_attribute_test.cc",
1024 "ast/bitcast_expression_test.cc",
1025 "ast/block_statement_test.cc",
1026 "ast/bool_literal_expression_test.cc",
1027 "ast/bool_test.cc",
dan sinclairb8b0c212022-10-20 22:45:50 +00001028 "ast/break_if_statement_test.cc",
dan sinclair77bf2332022-06-22 12:40:43 +00001029 "ast/break_statement_test.cc",
1030 "ast/builtin_attribute_test.cc",
1031 "ast/builtin_texture_helper_test.cc",
1032 "ast/builtin_texture_helper_test.h",
Ben Claytonfe8e6ee2022-07-27 22:21:30 +00001033 "ast/builtin_value_test.cc",
dan sinclair77bf2332022-06-22 12:40:43 +00001034 "ast/call_expression_test.cc",
1035 "ast/call_statement_test.cc",
dan sinclairf148f082022-10-19 15:55:02 +00001036 "ast/case_selector_test.cc",
dan sinclair77bf2332022-06-22 12:40:43 +00001037 "ast/case_statement_test.cc",
1038 "ast/compound_assignment_statement_test.cc",
1039 "ast/continue_statement_test.cc",
1040 "ast/depth_multisampled_texture_test.cc",
1041 "ast/depth_texture_test.cc",
1042 "ast/discard_statement_test.cc",
1043 "ast/enable_test.cc",
1044 "ast/extension_test.cc",
1045 "ast/external_texture_test.cc",
1046 "ast/f16_test.cc",
1047 "ast/f32_test.cc",
1048 "ast/fallthrough_statement_test.cc",
1049 "ast/float_literal_expression_test.cc",
1050 "ast/for_loop_statement_test.cc",
1051 "ast/function_test.cc",
1052 "ast/group_attribute_test.cc",
1053 "ast/i32_test.cc",
1054 "ast/id_attribute_test.cc",
1055 "ast/identifier_expression_test.cc",
1056 "ast/if_statement_test.cc",
1057 "ast/increment_decrement_statement_test.cc",
1058 "ast/index_accessor_expression_test.cc",
1059 "ast/int_literal_expression_test.cc",
1060 "ast/interpolate_attribute_test.cc",
1061 "ast/invariant_attribute_test.cc",
1062 "ast/location_attribute_test.cc",
1063 "ast/loop_statement_test.cc",
1064 "ast/matrix_test.cc",
1065 "ast/member_accessor_expression_test.cc",
1066 "ast/module_clone_test.cc",
1067 "ast/module_test.cc",
1068 "ast/multisampled_texture_test.cc",
1069 "ast/phony_expression_test.cc",
1070 "ast/pointer_test.cc",
1071 "ast/return_statement_test.cc",
1072 "ast/sampled_texture_test.cc",
1073 "ast/sampler_test.cc",
1074 "ast/stage_attribute_test.cc",
Ben Claytonbfd1a812022-08-02 23:16:25 +00001075 "ast/static_assert_test.cc",
dan sinclair77bf2332022-06-22 12:40:43 +00001076 "ast/storage_texture_test.cc",
1077 "ast/stride_attribute_test.cc",
1078 "ast/struct_member_align_attribute_test.cc",
1079 "ast/struct_member_offset_attribute_test.cc",
1080 "ast/struct_member_size_attribute_test.cc",
1081 "ast/struct_member_test.cc",
1082 "ast/struct_test.cc",
1083 "ast/switch_statement_test.cc",
1084 "ast/test_helper.h",
Ben Clayton08659d02022-07-27 22:30:10 +00001085 "ast/texel_format_test.cc",
dan sinclair77bf2332022-06-22 12:40:43 +00001086 "ast/texture_test.cc",
1087 "ast/traverse_expressions_test.cc",
1088 "ast/u32_test.cc",
1089 "ast/unary_op_expression_test.cc",
1090 "ast/variable_decl_statement_test.cc",
1091 "ast/variable_test.cc",
1092 "ast/vector_test.cc",
1093 "ast/while_statement_test.cc",
1094 "ast/workgroup_attribute_test.cc",
1095 ]
1096 }
1097
1098 tint_unittests_source_set("tint_unittests_diagnostic_src") {
1099 sources = [
1100 "diagnostic/diagnostic_test.cc",
1101 "diagnostic/formatter_test.cc",
1102 "diagnostic/printer_test.cc",
1103 ]
1104 }
1105
1106 tint_unittests_source_set("tint_unittests_inspector_src") {
1107 sources = [
1108 "inspector/inspector_test.cc",
1109 "inspector/test_inspector_builder.cc",
1110 "inspector/test_inspector_builder.h",
1111 "inspector/test_inspector_runner.cc",
1112 "inspector/test_inspector_runner.h",
1113 ]
1114 }
1115
1116 tint_unittests_source_set("tint_unittests_resolver_src") {
1117 sources = [
dan sinclairff7cf212022-10-03 14:05:23 +00001118 "resolver/address_space_layout_validation_test.cc",
1119 "resolver/address_space_validation_test.cc",
dan sinclair77bf2332022-06-22 12:40:43 +00001120 "resolver/array_accessor_test.cc",
1121 "resolver/assignment_validation_test.cc",
1122 "resolver/atomics_test.cc",
1123 "resolver/atomics_validation_test.cc",
1124 "resolver/attribute_validation_test.cc",
1125 "resolver/bitcast_validation_test.cc",
1126 "resolver/builtin_test.cc",
1127 "resolver/builtin_validation_test.cc",
1128 "resolver/builtins_validation_test.cc",
1129 "resolver/call_test.cc",
1130 "resolver/call_validation_test.cc",
1131 "resolver/compound_assignment_validation_test.cc",
1132 "resolver/compound_statement_test.cc",
Antonio Maiorano723da2a2022-10-13 19:27:30 +00001133 "resolver/const_eval_binary_op_test.cc",
1134 "resolver/const_eval_builtin_test.cc",
1135 "resolver/const_eval_construction_test.cc",
1136 "resolver/const_eval_conversion_test.cc",
1137 "resolver/const_eval_indexing_test.cc",
1138 "resolver/const_eval_member_access_test.cc",
1139 "resolver/const_eval_test.h",
1140 "resolver/const_eval_unary_op_test.cc",
dan sinclair77bf2332022-06-22 12:40:43 +00001141 "resolver/control_block_validation_test.cc",
1142 "resolver/dependency_graph_test.cc",
1143 "resolver/entry_point_validation_test.cc",
Ben Clayton83bd7382022-07-15 23:46:31 +00001144 "resolver/evaluation_stage_test.cc",
dan sinclair77bf2332022-06-22 12:40:43 +00001145 "resolver/function_validation_test.cc",
1146 "resolver/host_shareable_validation_test.cc",
1147 "resolver/increment_decrement_validation_test.cc",
Ben Clayton783b1692022-08-02 17:03:35 +00001148 "resolver/inferred_type_test.cc",
dan sinclair77bf2332022-06-22 12:40:43 +00001149 "resolver/intrinsic_table_test.cc",
1150 "resolver/is_host_shareable_test.cc",
1151 "resolver/is_storeable_test.cc",
1152 "resolver/materialize_test.cc",
Ben Clayton9a6acc42022-07-27 20:50:40 +00001153 "resolver/override_test.cc",
dan sinclair77bf2332022-06-22 12:40:43 +00001154 "resolver/ptr_ref_test.cc",
1155 "resolver/ptr_ref_validation_test.cc",
1156 "resolver/resolver_behavior_test.cc",
dan sinclair77bf2332022-06-22 12:40:43 +00001157 "resolver/resolver_test.cc",
1158 "resolver/resolver_test_helper.cc",
1159 "resolver/resolver_test_helper.h",
1160 "resolver/side_effects_test.cc",
1161 "resolver/source_variable_test.cc",
dan sinclair1cd47062022-08-05 14:53:47 +00001162 "resolver/static_assert_test.cc",
dan sinclairff7cf212022-10-03 14:05:23 +00001163 "resolver/struct_address_space_use_test.cc",
dan sinclair77bf2332022-06-22 12:40:43 +00001164 "resolver/struct_layout_test.cc",
1165 "resolver/struct_pipeline_stage_use_test.cc",
dan sinclair6e77b472022-10-20 13:38:28 +00001166 "resolver/type_initializer_validation_test.cc",
dan sinclair77bf2332022-06-22 12:40:43 +00001167 "resolver/type_validation_test.cc",
1168 "resolver/uniformity_test.cc",
1169 "resolver/validation_test.cc",
1170 "resolver/validator_is_storeable_test.cc",
Ben Clayton68ae36e2022-06-24 21:26:39 +00001171 "resolver/variable_test.cc",
1172 "resolver/variable_validation_test.cc",
dan sinclair77bf2332022-06-22 12:40:43 +00001173 ]
1174 deps = [ ":tint_unittests_ast_src" ]
1175 }
1176
1177 tint_unittests_source_set("tint_unittests_sem_src") {
1178 sources = [
Ben Claytondf3a0462022-10-17 13:24:38 +00001179 "sem/array_test.cc",
dan sinclair77bf2332022-06-22 12:40:43 +00001180 "sem/atomic_test.cc",
1181 "sem/bool_test.cc",
1182 "sem/builtin_test.cc",
dan sinclair77bf2332022-06-22 12:40:43 +00001183 "sem/depth_multisampled_texture_test.cc",
1184 "sem/depth_texture_test.cc",
1185 "sem/expression_test.cc",
1186 "sem/external_texture_test.cc",
1187 "sem/f16_test.cc",
1188 "sem/f32_test.cc",
1189 "sem/i32_test.cc",
1190 "sem/matrix_test.cc",
1191 "sem/multisampled_texture_test.cc",
1192 "sem/pointer_test.cc",
1193 "sem/reference_test.cc",
1194 "sem/sampled_texture_test.cc",
1195 "sem/sampler_test.cc",
dan sinclair77bf2332022-06-22 12:40:43 +00001196 "sem/storage_texture_test.cc",
Ben Claytondf3a0462022-10-17 13:24:38 +00001197 "sem/struct_test.cc",
dan sinclair77bf2332022-06-22 12:40:43 +00001198 "sem/texture_test.cc",
1199 "sem/type_manager_test.cc",
1200 "sem/type_test.cc",
1201 "sem/u32_test.cc",
1202 "sem/vector_test.cc",
1203 ]
1204 }
1205
1206 tint_unittests_source_set("tint_unittests_text_src") {
1207 sources = [ "text/unicode_test.cc" ]
1208 }
1209
1210 tint_unittests_source_set("tint_unittests_transform_src") {
1211 sources = [
Stephen White863d9ed2022-09-02 19:19:10 +00001212 "transform/add_block_attribute_test.cc",
dan sinclair77bf2332022-06-22 12:40:43 +00001213 "transform/add_empty_entry_point_test.cc",
dan sinclair77bf2332022-06-22 12:40:43 +00001214 "transform/array_length_from_uniform_test.cc",
1215 "transform/binding_remapper_test.cc",
1216 "transform/builtin_polyfill_test.cc",
1217 "transform/calculate_array_length_test.cc",
1218 "transform/canonicalize_entry_point_io_test.cc",
Corentin Wallez98a7cd12022-10-11 09:52:25 +00001219 "transform/clamp_frag_depth_test.cc",
dan sinclair77bf2332022-06-22 12:40:43 +00001220 "transform/combine_samplers_test.cc",
1221 "transform/decompose_memory_access_test.cc",
1222 "transform/decompose_strided_array_test.cc",
1223 "transform/decompose_strided_matrix_test.cc",
1224 "transform/disable_uniformity_analysis_test.cc",
1225 "transform/expand_compound_assignment_test.cc",
1226 "transform/first_index_offset_test.cc",
dan sinclair77bf2332022-06-22 12:40:43 +00001227 "transform/for_loop_to_loop_test.cc",
1228 "transform/localize_struct_array_assignment_test.cc",
James Price5de8b432022-10-31 14:49:03 +00001229 "transform/merge_return_test.cc",
dan sinclair77bf2332022-06-22 12:40:43 +00001230 "transform/module_scope_var_to_entry_point_param_test.cc",
1231 "transform/multiplanar_external_texture_test.cc",
1232 "transform/num_workgroups_from_uniform_test.cc",
Ben Claytona92f4252022-10-27 14:36:49 +00001233 "transform/packed_vec3_test.cc",
Stephen White05d8b022022-09-13 19:48:51 +00001234 "transform/pad_structs_test.cc",
Ben Clayton7ebcfc72022-06-27 20:20:25 +00001235 "transform/promote_initializers_to_let_test.cc",
dan sinclair77bf2332022-06-22 12:40:43 +00001236 "transform/promote_side_effects_to_decl_test.cc",
1237 "transform/remove_continue_in_switch_test.cc",
1238 "transform/remove_phonies_test.cc",
1239 "transform/remove_unreachable_statements_test.cc",
1240 "transform/renamer_test.cc",
1241 "transform/robustness_test.cc",
1242 "transform/simplify_pointers_test.cc",
1243 "transform/single_entry_point_test.cc",
Antonio Maiorano268d7b82022-06-24 22:28:23 +00001244 "transform/spirv_atomic_test.cc",
Zhaoming Jiang5cbb32d2022-10-11 07:55:00 +00001245 "transform/std140_exhaustive_test.cc",
Ben Clayton657e61d2022-09-01 22:12:19 +00001246 "transform/std140_test.cc",
dan sinclair256f1112022-07-22 16:05:06 +00001247 "transform/substitute_override_test.cc",
dan sinclair77bf2332022-06-22 12:40:43 +00001248 "transform/test_helper.h",
1249 "transform/transform_test.cc",
1250 "transform/unshadow_test.cc",
1251 "transform/unwind_discard_functions_test.cc",
1252 "transform/utils/get_insertion_point_test.cc",
1253 "transform/utils/hoist_to_decl_before_test.cc",
1254 "transform/var_for_dynamic_index_test.cc",
Zhaoming Jiang426b47e2022-09-01 03:08:20 +00001255 "transform/vectorize_matrix_conversions_test.cc",
dan sinclair6e77b472022-10-20 13:38:28 +00001256 "transform/vectorize_scalar_matrix_initializers_test.cc",
dan sinclair77bf2332022-06-22 12:40:43 +00001257 "transform/vertex_pulling_test.cc",
1258 "transform/while_to_loop_test.cc",
dan sinclair77bf2332022-06-22 12:40:43 +00001259 "transform/zero_init_workgroup_memory_test.cc",
1260 ]
1261 }
1262
1263 tint_unittests_source_set("tint_unittests_utils_src") {
1264 sources = [
1265 "utils/bitcast_test.cc",
Ben Claytone43034b2022-07-21 23:32:24 +00001266 "utils/bitset_test.cc",
dan sinclair77bf2332022-06-22 12:40:43 +00001267 "utils/crc32_test.cc",
1268 "utils/defer_test.cc",
1269 "utils/enum_set_test.cc",
1270 "utils/hash_test.cc",
Ben Claytone13160e2022-08-17 16:28:23 +00001271 "utils/hashmap_test.cc",
1272 "utils/hashset_test.cc",
dan sinclairff2cb022022-08-18 14:37:17 +00001273 "utils/io/command_test.cc",
1274 "utils/io/tmpfile_test.cc",
dan sinclair77bf2332022-06-22 12:40:43 +00001275 "utils/map_test.cc",
1276 "utils/math_test.cc",
1277 "utils/result_test.cc",
1278 "utils/reverse_test.cc",
1279 "utils/scoped_assignment_test.cc",
1280 "utils/string_test.cc",
1281 "utils/transform_test.cc",
1282 "utils/unique_allocator_test.cc",
1283 "utils/unique_vector_test.cc",
Ben Clayton3bc20e32022-07-21 19:34:05 +00001284 "utils/vector_test.cc",
dan sinclair77bf2332022-06-22 12:40:43 +00001285 ]
1286 }
1287
1288 tint_unittests_source_set("tint_unittests_writer_src") {
1289 sources = [
1290 "writer/append_vector_test.cc",
Ben Clayton1a567782022-10-14 13:38:27 +00001291 "writer/check_supported_extensions_test.cc",
dan sinclair77bf2332022-06-22 12:40:43 +00001292 "writer/flatten_bindings_test.cc",
1293 "writer/float_to_string_test.cc",
1294 "writer/generate_external_texture_bindings_test.cc",
1295 "writer/text_generator_test.cc",
1296 ]
1297 }
1298
1299 tint_unittests_source_set("tint_unittests_spv_reader_src") {
1300 sources = [
1301 "reader/spirv/enum_converter_test.cc",
1302 "reader/spirv/fail_stream_test.cc",
1303 "reader/spirv/function_arithmetic_test.cc",
1304 "reader/spirv/function_bit_test.cc",
1305 "reader/spirv/function_call_test.cc",
1306 "reader/spirv/function_cfg_test.cc",
1307 "reader/spirv/function_composite_test.cc",
1308 "reader/spirv/function_conversion_test.cc",
1309 "reader/spirv/function_decl_test.cc",
1310 "reader/spirv/function_glsl_std_450_test.cc",
1311 "reader/spirv/function_logical_test.cc",
1312 "reader/spirv/function_memory_test.cc",
1313 "reader/spirv/function_misc_test.cc",
1314 "reader/spirv/function_var_test.cc",
1315 "reader/spirv/namer_test.cc",
1316 "reader/spirv/parser_impl_barrier_test.cc",
1317 "reader/spirv/parser_impl_convert_member_decoration_test.cc",
1318 "reader/spirv/parser_impl_convert_type_test.cc",
1319 "reader/spirv/parser_impl_function_decl_test.cc",
1320 "reader/spirv/parser_impl_get_decorations_test.cc",
1321 "reader/spirv/parser_impl_handle_test.cc",
1322 "reader/spirv/parser_impl_import_test.cc",
1323 "reader/spirv/parser_impl_module_var_test.cc",
1324 "reader/spirv/parser_impl_named_types_test.cc",
1325 "reader/spirv/parser_impl_test.cc",
1326 "reader/spirv/parser_impl_test_helper.cc",
1327 "reader/spirv/parser_impl_test_helper.h",
1328 "reader/spirv/parser_impl_user_name_test.cc",
1329 "reader/spirv/parser_test.cc",
1330 "reader/spirv/parser_type_test.cc",
1331 "reader/spirv/spirv_tools_helpers_test.cc",
1332 "reader/spirv/spirv_tools_helpers_test.h",
1333 "reader/spirv/usage_test.cc",
1334 ]
1335
1336 deps = [ ":libtint_spv_reader_src" ]
1337 }
1338
1339 tint_unittests_source_set("tint_unittests_spv_writer_src") {
1340 sources = [
1341 "writer/spirv/binary_writer_test.cc",
1342 "writer/spirv/builder_accessor_expression_test.cc",
1343 "writer/spirv/builder_assign_test.cc",
1344 "writer/spirv/builder_binary_expression_test.cc",
1345 "writer/spirv/builder_bitcast_expression_test.cc",
1346 "writer/spirv/builder_block_test.cc",
1347 "writer/spirv/builder_builtin_test.cc",
1348 "writer/spirv/builder_builtin_texture_test.cc",
1349 "writer/spirv/builder_call_test.cc",
dan sinclair77bf2332022-06-22 12:40:43 +00001350 "writer/spirv/builder_discard_test.cc",
1351 "writer/spirv/builder_entry_point_test.cc",
1352 "writer/spirv/builder_format_conversion_test.cc",
1353 "writer/spirv/builder_function_attribute_test.cc",
1354 "writer/spirv/builder_function_test.cc",
1355 "writer/spirv/builder_function_variable_test.cc",
1356 "writer/spirv/builder_global_variable_test.cc",
1357 "writer/spirv/builder_ident_expression_test.cc",
1358 "writer/spirv/builder_if_test.cc",
dan sinclair6e77b472022-10-20 13:38:28 +00001359 "writer/spirv/builder_initializer_expression_test.cc",
dan sinclair77bf2332022-06-22 12:40:43 +00001360 "writer/spirv/builder_literal_test.cc",
1361 "writer/spirv/builder_loop_test.cc",
1362 "writer/spirv/builder_return_test.cc",
Ben Claytonb4744ac2022-08-03 07:01:08 +00001363 "writer/spirv/builder_static_assert_test.cc",
dan sinclair77bf2332022-06-22 12:40:43 +00001364 "writer/spirv/builder_switch_test.cc",
1365 "writer/spirv/builder_test.cc",
1366 "writer/spirv/builder_type_test.cc",
1367 "writer/spirv/builder_unary_op_expression_test.cc",
1368 "writer/spirv/instruction_test.cc",
1369 "writer/spirv/operand_test.cc",
1370 "writer/spirv/scalar_constant_test.cc",
1371 "writer/spirv/spv_dump.cc",
1372 "writer/spirv/spv_dump.h",
1373 "writer/spirv/test_helper.h",
1374 ]
1375
1376 deps = [
1377 ":libtint_spv_writer_src",
1378 ":tint_unittests_ast_src",
1379 "${tint_spirv_tools_dir}/:spvtools",
1380 ]
1381 }
1382
1383 tint_unittests_source_set("tint_unittests_wgsl_reader_src") {
1384 sources = [
1385 "reader/wgsl/lexer_test.cc",
1386 "reader/wgsl/parser_impl_additive_expression_test.cc",
dan sinclairff7cf212022-10-03 14:05:23 +00001387 "reader/wgsl/parser_impl_address_space_test.cc",
dan sinclair77bf2332022-06-22 12:40:43 +00001388 "reader/wgsl/parser_impl_argument_expression_list_test.cc",
1389 "reader/wgsl/parser_impl_assignment_stmt_test.cc",
dan sinclairff2cb022022-08-18 14:37:17 +00001390 "reader/wgsl/parser_impl_bitwise_expression_test.cc",
dan sinclair77bf2332022-06-22 12:40:43 +00001391 "reader/wgsl/parser_impl_break_stmt_test.cc",
1392 "reader/wgsl/parser_impl_bug_cases_test.cc",
1393 "reader/wgsl/parser_impl_call_stmt_test.cc",
dan sinclair393de082022-08-22 16:15:04 +00001394 "reader/wgsl/parser_impl_callable_test.cc",
dan sinclair77bf2332022-06-22 12:40:43 +00001395 "reader/wgsl/parser_impl_case_body_test.cc",
dan sinclair1cd47062022-08-05 14:53:47 +00001396 "reader/wgsl/parser_impl_compound_stmt_test.cc",
dan sinclair77bf2332022-06-22 12:40:43 +00001397 "reader/wgsl/parser_impl_const_literal_test.cc",
1398 "reader/wgsl/parser_impl_continue_stmt_test.cc",
1399 "reader/wgsl/parser_impl_continuing_stmt_test.cc",
dan sinclair6c8dc152022-08-17 16:30:30 +00001400 "reader/wgsl/parser_impl_core_lhs_expression_test.cc",
dan sinclair77bf2332022-06-22 12:40:43 +00001401 "reader/wgsl/parser_impl_depth_texture_test.cc",
dan sinclair2788bec2022-08-19 21:26:01 +00001402 "reader/wgsl/parser_impl_element_count_expression_test.cc",
dan sinclair77bf2332022-06-22 12:40:43 +00001403 "reader/wgsl/parser_impl_enable_directive_test.cc",
dan sinclair77bf2332022-06-22 12:40:43 +00001404 "reader/wgsl/parser_impl_error_msg_test.cc",
1405 "reader/wgsl/parser_impl_error_resync_test.cc",
dan sinclairee255862022-08-22 14:06:44 +00001406 "reader/wgsl/parser_impl_expression_test.cc",
dan sinclair77bf2332022-06-22 12:40:43 +00001407 "reader/wgsl/parser_impl_external_texture_test.cc",
1408 "reader/wgsl/parser_impl_for_stmt_test.cc",
1409 "reader/wgsl/parser_impl_function_attribute_list_test.cc",
1410 "reader/wgsl/parser_impl_function_attribute_test.cc",
1411 "reader/wgsl/parser_impl_function_decl_test.cc",
1412 "reader/wgsl/parser_impl_function_header_test.cc",
1413 "reader/wgsl/parser_impl_global_constant_decl_test.cc",
1414 "reader/wgsl/parser_impl_global_decl_test.cc",
1415 "reader/wgsl/parser_impl_global_variable_decl_test.cc",
1416 "reader/wgsl/parser_impl_if_stmt_test.cc",
dan sinclair77bf2332022-06-22 12:40:43 +00001417 "reader/wgsl/parser_impl_increment_decrement_stmt_test.cc",
dan sinclair6c8dc152022-08-17 16:30:30 +00001418 "reader/wgsl/parser_impl_lhs_expression_test.cc",
dan sinclair77bf2332022-06-22 12:40:43 +00001419 "reader/wgsl/parser_impl_loop_stmt_test.cc",
dan sinclair2788bec2022-08-19 21:26:01 +00001420 "reader/wgsl/parser_impl_math_expression_test.cc",
dan sinclair77bf2332022-06-22 12:40:43 +00001421 "reader/wgsl/parser_impl_multiplicative_expression_test.cc",
1422 "reader/wgsl/parser_impl_param_list_test.cc",
dan sinclair05288f62022-07-22 16:07:36 +00001423 "reader/wgsl/parser_impl_paren_expression_test.cc",
dan sinclair77bf2332022-06-22 12:40:43 +00001424 "reader/wgsl/parser_impl_pipeline_stage_test.cc",
1425 "reader/wgsl/parser_impl_primary_expression_test.cc",
1426 "reader/wgsl/parser_impl_relational_expression_test.cc",
1427 "reader/wgsl/parser_impl_reserved_keyword_test.cc",
1428 "reader/wgsl/parser_impl_sampled_texture_test.cc",
1429 "reader/wgsl/parser_impl_sampler_test.cc",
1430 "reader/wgsl/parser_impl_shift_expression_test.cc",
1431 "reader/wgsl/parser_impl_singular_expression_test.cc",
1432 "reader/wgsl/parser_impl_statement_test.cc",
1433 "reader/wgsl/parser_impl_statements_test.cc",
dan sinclair77bf2332022-06-22 12:40:43 +00001434 "reader/wgsl/parser_impl_storage_texture_test.cc",
1435 "reader/wgsl/parser_impl_struct_attribute_decl_test.cc",
1436 "reader/wgsl/parser_impl_struct_body_decl_test.cc",
1437 "reader/wgsl/parser_impl_struct_decl_test.cc",
1438 "reader/wgsl/parser_impl_struct_member_attribute_decl_test.cc",
1439 "reader/wgsl/parser_impl_struct_member_attribute_test.cc",
1440 "reader/wgsl/parser_impl_struct_member_test.cc",
1441 "reader/wgsl/parser_impl_switch_body_test.cc",
1442 "reader/wgsl/parser_impl_switch_stmt_test.cc",
1443 "reader/wgsl/parser_impl_test.cc",
1444 "reader/wgsl/parser_impl_test_helper.cc",
1445 "reader/wgsl/parser_impl_test_helper.h",
1446 "reader/wgsl/parser_impl_texel_format_test.cc",
1447 "reader/wgsl/parser_impl_texture_sampler_test.cc",
1448 "reader/wgsl/parser_impl_type_alias_test.cc",
1449 "reader/wgsl/parser_impl_type_decl_test.cc",
dan sinclair393de082022-08-22 16:15:04 +00001450 "reader/wgsl/parser_impl_type_decl_without_ident_test.cc",
dan sinclair77bf2332022-06-22 12:40:43 +00001451 "reader/wgsl/parser_impl_unary_expression_test.cc",
1452 "reader/wgsl/parser_impl_variable_attribute_list_test.cc",
1453 "reader/wgsl/parser_impl_variable_attribute_test.cc",
1454 "reader/wgsl/parser_impl_variable_decl_test.cc",
1455 "reader/wgsl/parser_impl_variable_ident_decl_test.cc",
1456 "reader/wgsl/parser_impl_variable_qualifier_test.cc",
1457 "reader/wgsl/parser_impl_variable_stmt_test.cc",
dan sinclair393de082022-08-22 16:15:04 +00001458 "reader/wgsl/parser_impl_vec_mat_prefix_test.cc",
dan sinclair77bf2332022-06-22 12:40:43 +00001459 "reader/wgsl/parser_impl_while_stmt_test.cc",
1460 "reader/wgsl/parser_test.cc",
1461 "reader/wgsl/token_test.cc",
1462 ]
1463
1464 deps = [ ":libtint_wgsl_reader_src" ]
1465 }
1466
1467 tint_unittests_source_set("tint_unittests_wgsl_writer_src") {
1468 sources = [
1469 "writer/wgsl/generator_impl_alias_type_test.cc",
1470 "writer/wgsl/generator_impl_array_accessor_test.cc",
1471 "writer/wgsl/generator_impl_assign_test.cc",
1472 "writer/wgsl/generator_impl_binary_test.cc",
1473 "writer/wgsl/generator_impl_bitcast_test.cc",
1474 "writer/wgsl/generator_impl_block_test.cc",
1475 "writer/wgsl/generator_impl_break_test.cc",
1476 "writer/wgsl/generator_impl_call_test.cc",
1477 "writer/wgsl/generator_impl_case_test.cc",
1478 "writer/wgsl/generator_impl_cast_test.cc",
dan sinclair77bf2332022-06-22 12:40:43 +00001479 "writer/wgsl/generator_impl_continue_test.cc",
1480 "writer/wgsl/generator_impl_discard_test.cc",
1481 "writer/wgsl/generator_impl_enable_test.cc",
1482 "writer/wgsl/generator_impl_fallthrough_test.cc",
1483 "writer/wgsl/generator_impl_function_test.cc",
1484 "writer/wgsl/generator_impl_global_decl_test.cc",
1485 "writer/wgsl/generator_impl_identifier_test.cc",
1486 "writer/wgsl/generator_impl_if_test.cc",
dan sinclair6e77b472022-10-20 13:38:28 +00001487 "writer/wgsl/generator_impl_initializer_test.cc",
dan sinclair77bf2332022-06-22 12:40:43 +00001488 "writer/wgsl/generator_impl_literal_test.cc",
1489 "writer/wgsl/generator_impl_loop_test.cc",
1490 "writer/wgsl/generator_impl_member_accessor_test.cc",
1491 "writer/wgsl/generator_impl_return_test.cc",
Ben Claytonb4744ac2022-08-03 07:01:08 +00001492 "writer/wgsl/generator_impl_static_assert_test.cc",
dan sinclair77bf2332022-06-22 12:40:43 +00001493 "writer/wgsl/generator_impl_switch_test.cc",
1494 "writer/wgsl/generator_impl_test.cc",
1495 "writer/wgsl/generator_impl_type_test.cc",
1496 "writer/wgsl/generator_impl_unary_op_test.cc",
1497 "writer/wgsl/generator_impl_variable_decl_statement_test.cc",
1498 "writer/wgsl/generator_impl_variable_test.cc",
1499 "writer/wgsl/test_helper.h",
1500 ]
1501
1502 deps = [
1503 ":libtint_wgsl_writer_src",
1504 ":tint_unittests_ast_src",
1505 ]
1506 }
1507
1508 tint_unittests_source_set("tint_unittests_msl_writer_src") {
1509 sources = [
1510 "writer/msl/generator_impl_array_accessor_test.cc",
1511 "writer/msl/generator_impl_assign_test.cc",
1512 "writer/msl/generator_impl_binary_test.cc",
1513 "writer/msl/generator_impl_bitcast_test.cc",
1514 "writer/msl/generator_impl_block_test.cc",
1515 "writer/msl/generator_impl_break_test.cc",
1516 "writer/msl/generator_impl_builtin_test.cc",
1517 "writer/msl/generator_impl_builtin_texture_test.cc",
1518 "writer/msl/generator_impl_call_test.cc",
1519 "writer/msl/generator_impl_case_test.cc",
1520 "writer/msl/generator_impl_cast_test.cc",
dan sinclair77bf2332022-06-22 12:40:43 +00001521 "writer/msl/generator_impl_continue_test.cc",
1522 "writer/msl/generator_impl_discard_test.cc",
1523 "writer/msl/generator_impl_function_test.cc",
1524 "writer/msl/generator_impl_identifier_test.cc",
1525 "writer/msl/generator_impl_if_test.cc",
1526 "writer/msl/generator_impl_import_test.cc",
dan sinclair6e77b472022-10-20 13:38:28 +00001527 "writer/msl/generator_impl_initializer_test.cc",
dan sinclair77bf2332022-06-22 12:40:43 +00001528 "writer/msl/generator_impl_loop_test.cc",
1529 "writer/msl/generator_impl_member_accessor_test.cc",
1530 "writer/msl/generator_impl_module_constant_test.cc",
1531 "writer/msl/generator_impl_return_test.cc",
1532 "writer/msl/generator_impl_sanitizer_test.cc",
Ben Claytonb4744ac2022-08-03 07:01:08 +00001533 "writer/msl/generator_impl_static_assert_test.cc",
dan sinclair77bf2332022-06-22 12:40:43 +00001534 "writer/msl/generator_impl_switch_test.cc",
1535 "writer/msl/generator_impl_test.cc",
1536 "writer/msl/generator_impl_type_test.cc",
1537 "writer/msl/generator_impl_unary_op_test.cc",
1538 "writer/msl/generator_impl_variable_decl_statement_test.cc",
1539 "writer/msl/test_helper.h",
1540 ]
1541
1542 deps = [
1543 ":libtint_msl_writer_src",
1544 ":tint_unittests_ast_src",
1545 ]
1546 }
1547
1548 tint_unittests_source_set("tint_unittests_hlsl_writer_src") {
1549 sources = [
1550 "writer/hlsl/generator_impl_array_accessor_test.cc",
1551 "writer/hlsl/generator_impl_assign_test.cc",
1552 "writer/hlsl/generator_impl_binary_test.cc",
1553 "writer/hlsl/generator_impl_bitcast_test.cc",
1554 "writer/hlsl/generator_impl_block_test.cc",
1555 "writer/hlsl/generator_impl_break_test.cc",
1556 "writer/hlsl/generator_impl_builtin_test.cc",
1557 "writer/hlsl/generator_impl_builtin_texture_test.cc",
1558 "writer/hlsl/generator_impl_call_test.cc",
1559 "writer/hlsl/generator_impl_case_test.cc",
1560 "writer/hlsl/generator_impl_cast_test.cc",
dan sinclair77bf2332022-06-22 12:40:43 +00001561 "writer/hlsl/generator_impl_continue_test.cc",
1562 "writer/hlsl/generator_impl_discard_test.cc",
1563 "writer/hlsl/generator_impl_function_test.cc",
1564 "writer/hlsl/generator_impl_identifier_test.cc",
1565 "writer/hlsl/generator_impl_if_test.cc",
1566 "writer/hlsl/generator_impl_import_test.cc",
dan sinclair6e77b472022-10-20 13:38:28 +00001567 "writer/hlsl/generator_impl_initializer_test.cc",
dan sinclair77bf2332022-06-22 12:40:43 +00001568 "writer/hlsl/generator_impl_loop_test.cc",
1569 "writer/hlsl/generator_impl_member_accessor_test.cc",
1570 "writer/hlsl/generator_impl_module_constant_test.cc",
1571 "writer/hlsl/generator_impl_return_test.cc",
1572 "writer/hlsl/generator_impl_sanitizer_test.cc",
Ben Claytonb4744ac2022-08-03 07:01:08 +00001573 "writer/hlsl/generator_impl_static_assert_test.cc",
dan sinclair77bf2332022-06-22 12:40:43 +00001574 "writer/hlsl/generator_impl_switch_test.cc",
1575 "writer/hlsl/generator_impl_test.cc",
1576 "writer/hlsl/generator_impl_type_test.cc",
1577 "writer/hlsl/generator_impl_unary_op_test.cc",
1578 "writer/hlsl/generator_impl_variable_decl_statement_test.cc",
1579 "writer/hlsl/generator_impl_workgroup_var_test.cc",
1580 "writer/hlsl/test_helper.h",
1581 ]
1582
1583 deps = [
1584 ":libtint_hlsl_writer_src",
1585 ":tint_unittests_ast_src",
1586 ]
1587 }
1588
1589 tint_unittests_source_set("tint_unittests_glsl_writer_src") {
1590 sources = [
1591 "writer/glsl/generator_impl_array_accessor_test.cc",
1592 "writer/glsl/generator_impl_assign_test.cc",
1593 "writer/glsl/generator_impl_binary_test.cc",
1594 "writer/glsl/generator_impl_bitcast_test.cc",
1595 "writer/glsl/generator_impl_block_test.cc",
1596 "writer/glsl/generator_impl_break_test.cc",
1597 "writer/glsl/generator_impl_builtin_test.cc",
1598 "writer/glsl/generator_impl_builtin_texture_test.cc",
1599 "writer/glsl/generator_impl_call_test.cc",
1600 "writer/glsl/generator_impl_case_test.cc",
1601 "writer/glsl/generator_impl_cast_test.cc",
dan sinclair77bf2332022-06-22 12:40:43 +00001602 "writer/glsl/generator_impl_continue_test.cc",
1603 "writer/glsl/generator_impl_discard_test.cc",
1604 "writer/glsl/generator_impl_function_test.cc",
1605 "writer/glsl/generator_impl_identifier_test.cc",
1606 "writer/glsl/generator_impl_if_test.cc",
1607 "writer/glsl/generator_impl_import_test.cc",
dan sinclair6e77b472022-10-20 13:38:28 +00001608 "writer/glsl/generator_impl_initializer_test.cc",
dan sinclair77bf2332022-06-22 12:40:43 +00001609 "writer/glsl/generator_impl_loop_test.cc",
1610 "writer/glsl/generator_impl_member_accessor_test.cc",
1611 "writer/glsl/generator_impl_module_constant_test.cc",
1612 "writer/glsl/generator_impl_return_test.cc",
1613 "writer/glsl/generator_impl_sanitizer_test.cc",
1614 "writer/glsl/generator_impl_storage_buffer_test.cc",
1615 "writer/glsl/generator_impl_switch_test.cc",
1616 "writer/glsl/generator_impl_test.cc",
1617 "writer/glsl/generator_impl_type_test.cc",
1618 "writer/glsl/generator_impl_unary_op_test.cc",
1619 "writer/glsl/generator_impl_uniform_buffer_test.cc",
1620 "writer/glsl/generator_impl_variable_decl_statement_test.cc",
1621 "writer/glsl/generator_impl_workgroup_var_test.cc",
1622 "writer/glsl/test_helper.h",
1623 ]
1624
1625 deps = [
1626 ":libtint_glsl_writer_src",
1627 ":tint_unittests_ast_src",
1628 ":tint_unittests_transform_src",
1629 ]
1630 }
1631
1632 tint_unittests_source_set("tint_unittests_core_src") {
1633 sources = [
1634 "castable_test.cc",
1635 "clone_context_test.cc",
1636 "debug_test.cc",
1637 "demangler_test.cc",
1638 "number_test.cc",
1639 "program_builder_test.cc",
1640 "program_test.cc",
Ben Clayton648bd7b2022-09-02 11:40:19 +00001641 "reflection_test.cc",
dan sinclair77bf2332022-06-22 12:40:43 +00001642 "scope_stack_test.cc",
1643 "source_test.cc",
1644 "symbol_table_test.cc",
1645 "symbol_test.cc",
1646 "traits_test.cc",
1647 "utils/block_allocator_test.cc",
1648 ]
1649
1650 deps = [ ":tint_unittests_ast_src" ]
1651 }
1652
1653 if (build_with_chromium) {
1654 tint_unittests_source_set("tint_unittests_fuzzer_src") {
1655 sources = [ "fuzzers/random_generator_test.cc" ]
1656
1657 deps = [
1658 ":tint_unittests_core_src",
1659 "fuzzers:tint_fuzzer_common_src",
1660 ]
1661 }
1662 }
1663
1664 source_set("tint_unittests_src") {
1665 testonly = true
1666
1667 deps = [
1668 ":libtint_wgsl_reader_src",
1669 ":libtint_wgsl_writer_src",
1670 ":tint_unittests_ast_src",
1671 ":tint_unittests_core_src",
1672 ":tint_unittests_diagnostic_src",
1673 ":tint_unittests_inspector_src",
1674 ":tint_unittests_resolver_src",
1675 ":tint_unittests_sem_src",
1676 ":tint_unittests_text_src",
1677 ":tint_unittests_transform_src",
1678 ":tint_unittests_utils_src",
1679 ":tint_unittests_writer_src",
1680 ]
1681
1682 if (tint_build_spv_reader) {
1683 deps += [ ":tint_unittests_spv_reader_src" ]
1684 }
1685
1686 if (tint_build_spv_writer) {
1687 deps += [ ":tint_unittests_spv_writer_src" ]
1688 }
1689
1690 if (tint_build_wgsl_reader) {
1691 deps += [ ":tint_unittests_wgsl_reader_src" ]
1692 }
1693
1694 if (tint_build_wgsl_writer) {
1695 deps += [ ":tint_unittests_wgsl_writer_src" ]
1696 }
1697
1698 if (tint_build_msl_writer) {
1699 deps += [ ":tint_unittests_msl_writer_src" ]
1700 }
1701
1702 if (tint_build_hlsl_writer) {
1703 deps += [ ":tint_unittests_hlsl_writer_src" ]
1704 }
1705
1706 if (tint_build_glsl_writer) {
1707 deps += [ ":tint_unittests_glsl_writer_src" ]
1708 }
1709
1710 if (build_with_chromium) {
1711 deps += [ ":tint_unittests_fuzzer_src" ]
1712 }
1713
dan sinclair889a4992022-06-17 13:01:59 +00001714 configs += [ ":tint_unittests_config" ]
dan sinclair77bf2332022-06-22 12:40:43 +00001715
1716 if (build_with_chromium) {
1717 configs -= [ "//build/config/compiler:chromium_code" ]
1718 configs += [ "//build/config/compiler:no_chromium_code" ]
1719 }
1720 }
1721
1722 test("tint_unittests") {
1723 deps = [
1724 ":gmock_and_gtest",
1725 ":tint_unittests_src",
1726 "${tint_spirv_tools_dir}/:spvtools",
1727 "${tint_spirv_tools_dir}/:spvtools_opt",
1728 "${tint_spirv_tools_dir}/:spvtools_val",
1729 ]
1730
1731 deps += [ ":tint_unittests_main" ]
1732
1733 configs += [ ":tint_unittests_config" ]
1734
dan sinclair889a4992022-06-17 13:01:59 +00001735 if (build_with_chromium) {
1736 configs -= [ "//build/config/compiler:chromium_code" ]
1737 configs += [ "//build/config/compiler:no_chromium_code" ]
1738 }
1739
1740 testonly = true
dan sinclair889a4992022-06-17 13:01:59 +00001741 }
1742}