blob: 1772d0490b6e80e41aabf3c9aae850c3b2e53cff [file] [log] [blame]
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001# Copyright 2020 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
15function(tint_spvtools_compile_options TARGET)
16 # We'll use the optimizer for its nice SPIR-V in-memory representation
17 target_link_libraries(${TARGET} SPIRV-Tools-opt SPIRV-Tools)
18
19 # We'll be cheating: using internal interfaces to the SPIRV-Tools
20 # optimizer.
21 target_include_directories(${TARGET} PRIVATE
22 ${spirv-tools_SOURCE_DIR}
23 ${spirv-tools_BINARY_DIR}
24 )
Ryan Harrisondbc13af2022-02-21 15:19:07 +000025endfunction()
26
dan sinclair16b4cf82022-11-03 21:10:40 +000027set(TINT_LIB_SRCS)
28set(TINT_BENCHMARK_SRCS)
29set(TINT_TEST_SRCS)
30
31# Add a generated file set into the build.
32#
33# Params:
34# TARGET - the target name to add (without extension)
35# BENCH - set if the target has a benchmark file
36# TEST - set if the target has a test file
37#
38function(tint_generated TARGET)
39 cmake_parse_arguments(PARSE_ARGV 0 TINT_GEN "BENCH;TEST" "" "")
40
41 list(APPEND TINT_LIB_SRCS
42 ${TARGET}.cc
43 ${TARGET}.h
44 )
45 set(TINT_LIB_SRCS ${TINT_LIB_SRCS} PARENT_SCOPE)
46
47 if(${TINT_GEN_BENCH})
48 list(APPEND TINT_BENCHMARK_SRCS ${TARGET}_bench.cc)
49 set(TINT_BENCHMARK_SRCS ${TINT_BENCHMARK_SRCS} PARENT_SCOPE)
50 endif()
51 if(${TINT_GEN_TEST})
52 list(APPEND TINT_TEST_SRCS ${TARGET}_test.cc)
53 set(TINT_TEST_SRCS ${TINT_TEST_SRCS} PARENT_SCOPE)
54 endif()
55endfunction()
56
Ryan Harrisondbc13af2022-02-21 15:19:07 +000057## Tint diagnostic utilities. Used by libtint and tint_utils_io.
58add_library(tint_diagnostic_utils
dan sinclair22b4dd22023-07-21 00:40:07 +000059 utils/debug/debug.cc
60 utils/debug/debug.h
61 utils/diagnostic/diagnostic.cc
62 utils/diagnostic/diagnostic.h
63 utils/diagnostic/formatter.cc
64 utils/diagnostic/formatter.h
65 utils/diagnostic/printer.cc
66 utils/diagnostic/printer.h
67 utils/diagnostic/source.cc
68 utils/diagnostic/source.h
69 utils/debug/debugger.cc
70 utils/debug/debugger.h
71 utils/text/unicode.cc
72 utils/text/unicode.h
Ryan Harrisondbc13af2022-02-21 15:19:07 +000073)
74tint_default_compile_options(tint_diagnostic_utils)
75
76if (TINT_ENABLE_BREAK_IN_DEBUGGER)
dan sinclair22b4dd22023-07-21 00:40:07 +000077 set_source_files_properties(utils/debug/debugger.cc
Ryan Harrisondbc13af2022-02-21 15:19:07 +000078 PROPERTIES COMPILE_DEFINITIONS "TINT_ENABLE_BREAK_IN_DEBUGGER=1" )
79endif()
80
dan sinclair16b4cf82022-11-03 21:10:40 +000081list(APPEND TINT_LIB_SRCS
Ryan Harrisondbc13af2022-02-21 15:19:07 +000082 ../../include/tint/tint.h
dan sinclair46725bd2023-07-21 00:40:07 +000083 clone_context.cc
84 clone_context.h
85 lang/core/builtin/fluent_types.h
86 lang/core/builtin/number.cc
87 lang/core/builtin/number.h
88 lang/core/constant/clone_context.h
89 lang/core/constant/composite.cc
90 lang/core/constant/composite.h
91 lang/core/constant/manager.cc
92 lang/core/constant/manager.h
93 lang/core/constant/node.cc
94 lang/core/constant/node.h
95 lang/core/constant/scalar.cc
96 lang/core/constant/scalar.h
97 lang/core/constant/splat.cc
98 lang/core/constant/splat.h
99 lang/core/constant/value.cc
100 lang/core/constant/value.h
101 lang/core/type/abstract_float.cc
102 lang/core/type/abstract_float.h
103 lang/core/type/abstract_int.cc
104 lang/core/type/abstract_int.h
105 lang/core/type/abstract_numeric.cc
106 lang/core/type/abstract_numeric.h
107 lang/core/type/array.cc
108 lang/core/type/array.h
109 lang/core/type/array_count.cc
110 lang/core/type/array_count.h
111 lang/core/type/atomic.cc
112 lang/core/type/atomic.h
113 lang/core/type/bool.cc
114 lang/core/type/bool.h
115 lang/core/type/builtin_structs.cc
116 lang/core/type/builtin_structs.h
117 lang/core/type/clone_context.h
118 lang/core/type/depth_multisampled_texture.cc
119 lang/core/type/depth_multisampled_texture.h
120 lang/core/type/depth_texture.cc
121 lang/core/type/depth_texture.h
122 lang/core/type/external_texture.cc
123 lang/core/type/external_texture.h
124 lang/core/type/f16.cc
125 lang/core/type/f16.h
126 lang/core/type/f32.cc
127 lang/core/type/f32.h
128 lang/core/type/i32.cc
129 lang/core/type/i32.h
130 lang/core/type/manager.cc
131 lang/core/type/manager.h
132 lang/core/type/matrix.cc
133 lang/core/type/matrix.h
134 lang/core/type/multisampled_texture.cc
135 lang/core/type/multisampled_texture.h
136 lang/core/type/node.cc
137 lang/core/type/node.h
138 lang/core/type/numeric_scalar.cc
139 lang/core/type/numeric_scalar.h
140 lang/core/type/pointer.cc
141 lang/core/type/pointer.h
142 lang/core/type/reference.cc
143 lang/core/type/reference.h
144 lang/core/type/sampled_texture.cc
145 lang/core/type/sampled_texture.h
146 lang/core/type/sampler.cc
147 lang/core/type/sampler.h
148 lang/core/type/sampler_kind.cc
149 lang/core/type/sampler_kind.h
150 lang/core/type/scalar.cc
151 lang/core/type/scalar.h
152 lang/core/type/storage_texture.cc
153 lang/core/type/storage_texture.h
154 lang/core/type/struct.cc
155 lang/core/type/struct.h
156 lang/core/type/texture.cc
157 lang/core/type/texture.h
158 lang/core/type/texture_dimension.cc
159 lang/core/type/texture_dimension.h
160 lang/core/type/type.cc
161 lang/core/type/type.h
162 lang/core/type/u32.cc
163 lang/core/type/u32.h
164 lang/core/type/unique_node.cc
165 lang/core/type/unique_node.h
166 lang/core/type/vector.cc
167 lang/core/type/vector.h
168 lang/core/type/void.cc
169 lang/core/type/void.h
dan sinclair99181d82023-07-20 01:14:15 +0000170 lang/wgsl/ast/accessor_expression.cc
171 lang/wgsl/ast/accessor_expression.h
172 lang/wgsl/ast/alias.cc
173 lang/wgsl/ast/alias.h
174 lang/wgsl/ast/assignment_statement.cc
175 lang/wgsl/ast/assignment_statement.h
176 lang/wgsl/ast/attribute.cc
177 lang/wgsl/ast/attribute.h
178 lang/wgsl/ast/binary_expression.cc
179 lang/wgsl/ast/binary_expression.h
180 lang/wgsl/ast/binding_attribute.cc
181 lang/wgsl/ast/binding_attribute.h
182 lang/wgsl/ast/bitcast_expression.cc
183 lang/wgsl/ast/bitcast_expression.h
184 lang/wgsl/ast/block_statement.cc
185 lang/wgsl/ast/block_statement.h
186 lang/wgsl/ast/bool_literal_expression.cc
187 lang/wgsl/ast/bool_literal_expression.h
188 lang/wgsl/ast/break_if_statement.cc
189 lang/wgsl/ast/break_if_statement.h
190 lang/wgsl/ast/break_statement.cc
191 lang/wgsl/ast/break_statement.h
192 lang/wgsl/ast/builtin_attribute.cc
193 lang/wgsl/ast/builtin_attribute.h
194 lang/wgsl/ast/call_expression.cc
195 lang/wgsl/ast/call_expression.h
196 lang/wgsl/ast/call_statement.cc
197 lang/wgsl/ast/call_statement.h
198 lang/wgsl/ast/case_selector.cc
199 lang/wgsl/ast/case_selector.h
200 lang/wgsl/ast/case_statement.cc
201 lang/wgsl/ast/case_statement.h
202 lang/wgsl/ast/compound_assignment_statement.cc
203 lang/wgsl/ast/compound_assignment_statement.h
204 lang/wgsl/ast/const.cc
205 lang/wgsl/ast/const.h
206 lang/wgsl/ast/const_assert.cc
207 lang/wgsl/ast/const_assert.h
208 lang/wgsl/ast/continue_statement.cc
209 lang/wgsl/ast/continue_statement.h
210 lang/wgsl/ast/diagnostic_attribute.cc
211 lang/wgsl/ast/diagnostic_attribute.h
212 lang/wgsl/ast/diagnostic_control.cc
213 lang/wgsl/ast/diagnostic_control.h
214 lang/wgsl/ast/diagnostic_directive.cc
215 lang/wgsl/ast/diagnostic_directive.h
216 lang/wgsl/ast/diagnostic_rule_name.cc
217 lang/wgsl/ast/diagnostic_rule_name.h
218 lang/wgsl/ast/disable_validation_attribute.cc
219 lang/wgsl/ast/disable_validation_attribute.h
220 lang/wgsl/ast/discard_statement.cc
221 lang/wgsl/ast/discard_statement.h
222 lang/wgsl/ast/enable.cc
223 lang/wgsl/ast/enable.h
224 lang/wgsl/ast/expression.cc
225 lang/wgsl/ast/expression.h
226 lang/wgsl/ast/extension.cc
227 lang/wgsl/ast/extension.h
228 lang/wgsl/ast/float_literal_expression.cc
229 lang/wgsl/ast/float_literal_expression.h
230 lang/wgsl/ast/for_loop_statement.cc
231 lang/wgsl/ast/for_loop_statement.h
232 lang/wgsl/ast/function.cc
233 lang/wgsl/ast/function.h
234 lang/wgsl/ast/group_attribute.cc
235 lang/wgsl/ast/group_attribute.h
236 lang/wgsl/ast/id_attribute.cc
237 lang/wgsl/ast/id_attribute.h
238 lang/wgsl/ast/identifier.cc
239 lang/wgsl/ast/identifier.h
240 lang/wgsl/ast/identifier_expression.cc
241 lang/wgsl/ast/identifier_expression.h
242 lang/wgsl/ast/if_statement.cc
243 lang/wgsl/ast/if_statement.h
244 lang/wgsl/ast/increment_decrement_statement.cc
245 lang/wgsl/ast/increment_decrement_statement.h
246 lang/wgsl/ast/index_accessor_expression.cc
247 lang/wgsl/ast/index_accessor_expression.h
248 lang/wgsl/ast/index_attribute.cc
249 lang/wgsl/ast/index_attribute.h
250 lang/wgsl/ast/int_literal_expression.cc
251 lang/wgsl/ast/int_literal_expression.h
252 lang/wgsl/ast/internal_attribute.cc
253 lang/wgsl/ast/internal_attribute.h
254 lang/wgsl/ast/interpolate_attribute.cc
255 lang/wgsl/ast/interpolate_attribute.h
256 lang/wgsl/ast/invariant_attribute.cc
257 lang/wgsl/ast/invariant_attribute.h
258 lang/wgsl/ast/let.cc
259 lang/wgsl/ast/let.h
260 lang/wgsl/ast/literal_expression.cc
261 lang/wgsl/ast/literal_expression.h
262 lang/wgsl/ast/location_attribute.cc
263 lang/wgsl/ast/location_attribute.h
264 lang/wgsl/ast/loop_statement.cc
265 lang/wgsl/ast/loop_statement.h
266 lang/wgsl/ast/member_accessor_expression.cc
267 lang/wgsl/ast/member_accessor_expression.h
268 lang/wgsl/ast/module.cc
269 lang/wgsl/ast/module.h
270 lang/wgsl/ast/must_use_attribute.cc
271 lang/wgsl/ast/must_use_attribute.h
dan sinclair99181d82023-07-20 01:14:15 +0000272 lang/wgsl/ast/node.cc
273 lang/wgsl/ast/node.h
dan sinclair46725bd2023-07-21 00:40:07 +0000274 lang/wgsl/ast/node_id.h
dan sinclair99181d82023-07-20 01:14:15 +0000275 lang/wgsl/ast/override.cc
276 lang/wgsl/ast/override.h
277 lang/wgsl/ast/parameter.cc
278 lang/wgsl/ast/parameter.h
279 lang/wgsl/ast/phony_expression.cc
280 lang/wgsl/ast/phony_expression.h
281 lang/wgsl/ast/pipeline_stage.cc
282 lang/wgsl/ast/pipeline_stage.h
283 lang/wgsl/ast/return_statement.cc
284 lang/wgsl/ast/return_statement.h
285 lang/wgsl/ast/stage_attribute.cc
286 lang/wgsl/ast/stage_attribute.h
287 lang/wgsl/ast/statement.cc
288 lang/wgsl/ast/statement.h
289 lang/wgsl/ast/stride_attribute.cc
290 lang/wgsl/ast/stride_attribute.h
dan sinclair46725bd2023-07-21 00:40:07 +0000291 lang/wgsl/ast/struct.cc
292 lang/wgsl/ast/struct.h
293 lang/wgsl/ast/struct_member.cc
294 lang/wgsl/ast/struct_member.h
dan sinclair99181d82023-07-20 01:14:15 +0000295 lang/wgsl/ast/struct_member_align_attribute.cc
296 lang/wgsl/ast/struct_member_align_attribute.h
297 lang/wgsl/ast/struct_member_offset_attribute.cc
298 lang/wgsl/ast/struct_member_offset_attribute.h
299 lang/wgsl/ast/struct_member_size_attribute.cc
300 lang/wgsl/ast/struct_member_size_attribute.h
dan sinclair99181d82023-07-20 01:14:15 +0000301 lang/wgsl/ast/switch_statement.cc
302 lang/wgsl/ast/switch_statement.h
303 lang/wgsl/ast/templated_identifier.cc
304 lang/wgsl/ast/templated_identifier.h
dan sinclair99181d82023-07-20 01:14:15 +0000305 lang/wgsl/ast/transform/add_block_attribute.cc
306 lang/wgsl/ast/transform/add_block_attribute.h
dan sinclair46725bd2023-07-21 00:40:07 +0000307 lang/wgsl/ast/transform/add_empty_entry_point.cc
308 lang/wgsl/ast/transform/add_empty_entry_point.h
dan sinclair99181d82023-07-20 01:14:15 +0000309 lang/wgsl/ast/transform/array_length_from_uniform.cc
310 lang/wgsl/ast/transform/array_length_from_uniform.h
311 lang/wgsl/ast/transform/binding_remapper.cc
312 lang/wgsl/ast/transform/binding_remapper.h
313 lang/wgsl/ast/transform/builtin_polyfill.cc
314 lang/wgsl/ast/transform/builtin_polyfill.h
315 lang/wgsl/ast/transform/calculate_array_length.cc
316 lang/wgsl/ast/transform/calculate_array_length.h
dan sinclair99181d82023-07-20 01:14:15 +0000317 lang/wgsl/ast/transform/canonicalize_entry_point_io.cc
318 lang/wgsl/ast/transform/canonicalize_entry_point_io.h
dan sinclair46725bd2023-07-21 00:40:07 +0000319 lang/wgsl/ast/transform/clamp_frag_depth.cc
320 lang/wgsl/ast/transform/clamp_frag_depth.h
dan sinclair99181d82023-07-20 01:14:15 +0000321 lang/wgsl/ast/transform/combine_samplers.cc
322 lang/wgsl/ast/transform/combine_samplers.h
323 lang/wgsl/ast/transform/decompose_memory_access.cc
324 lang/wgsl/ast/transform/decompose_memory_access.h
325 lang/wgsl/ast/transform/decompose_strided_array.cc
326 lang/wgsl/ast/transform/decompose_strided_array.h
327 lang/wgsl/ast/transform/decompose_strided_matrix.cc
328 lang/wgsl/ast/transform/decompose_strided_matrix.h
329 lang/wgsl/ast/transform/demote_to_helper.cc
330 lang/wgsl/ast/transform/demote_to_helper.h
331 lang/wgsl/ast/transform/direct_variable_access.cc
332 lang/wgsl/ast/transform/direct_variable_access.h
333 lang/wgsl/ast/transform/disable_uniformity_analysis.cc
334 lang/wgsl/ast/transform/disable_uniformity_analysis.h
335 lang/wgsl/ast/transform/expand_compound_assignment.cc
336 lang/wgsl/ast/transform/expand_compound_assignment.h
337 lang/wgsl/ast/transform/first_index_offset.cc
338 lang/wgsl/ast/transform/first_index_offset.h
339 lang/wgsl/ast/transform/fold_trivial_lets.cc
340 lang/wgsl/ast/transform/fold_trivial_lets.h
341 lang/wgsl/ast/transform/for_loop_to_loop.cc
342 lang/wgsl/ast/transform/for_loop_to_loop.h
343 lang/wgsl/ast/transform/localize_struct_array_assignment.cc
344 lang/wgsl/ast/transform/localize_struct_array_assignment.h
345 lang/wgsl/ast/transform/merge_return.cc
346 lang/wgsl/ast/transform/merge_return.h
347 lang/wgsl/ast/transform/module_scope_var_to_entry_point_param.cc
348 lang/wgsl/ast/transform/module_scope_var_to_entry_point_param.h
349 lang/wgsl/ast/transform/multiplanar_external_texture.cc
350 lang/wgsl/ast/transform/multiplanar_external_texture.h
351 lang/wgsl/ast/transform/num_workgroups_from_uniform.cc
352 lang/wgsl/ast/transform/num_workgroups_from_uniform.h
353 lang/wgsl/ast/transform/packed_vec3.cc
354 lang/wgsl/ast/transform/packed_vec3.h
355 lang/wgsl/ast/transform/pad_structs.cc
356 lang/wgsl/ast/transform/pad_structs.h
357 lang/wgsl/ast/transform/preserve_padding.cc
358 lang/wgsl/ast/transform/preserve_padding.h
359 lang/wgsl/ast/transform/promote_initializers_to_let.cc
360 lang/wgsl/ast/transform/promote_initializers_to_let.h
361 lang/wgsl/ast/transform/promote_side_effects_to_decl.cc
362 lang/wgsl/ast/transform/promote_side_effects_to_decl.h
363 lang/wgsl/ast/transform/remove_continue_in_switch.cc
364 lang/wgsl/ast/transform/remove_continue_in_switch.h
365 lang/wgsl/ast/transform/remove_phonies.cc
366 lang/wgsl/ast/transform/remove_phonies.h
367 lang/wgsl/ast/transform/remove_unreachable_statements.cc
368 lang/wgsl/ast/transform/remove_unreachable_statements.h
369 lang/wgsl/ast/transform/renamer.cc
370 lang/wgsl/ast/transform/renamer.h
371 lang/wgsl/ast/transform/robustness.cc
372 lang/wgsl/ast/transform/robustness.h
373 lang/wgsl/ast/transform/simplify_pointers.cc
374 lang/wgsl/ast/transform/simplify_pointers.h
375 lang/wgsl/ast/transform/single_entry_point.cc
376 lang/wgsl/ast/transform/single_entry_point.h
377 lang/wgsl/ast/transform/spirv_atomic.cc
378 lang/wgsl/ast/transform/spirv_atomic.h
379 lang/wgsl/ast/transform/std140.cc
380 lang/wgsl/ast/transform/std140.h
381 lang/wgsl/ast/transform/substitute_override.cc
382 lang/wgsl/ast/transform/substitute_override.h
383 lang/wgsl/ast/transform/texture_1d_to_2d.cc
384 lang/wgsl/ast/transform/texture_1d_to_2d.h
385 lang/wgsl/ast/transform/transform.cc
386 lang/wgsl/ast/transform/transform.h
387 lang/wgsl/ast/transform/truncate_interstage_variables.cc
388 lang/wgsl/ast/transform/truncate_interstage_variables.h
389 lang/wgsl/ast/transform/unshadow.cc
390 lang/wgsl/ast/transform/unshadow.h
391 lang/wgsl/ast/transform/utils/get_insertion_point.cc
392 lang/wgsl/ast/transform/utils/get_insertion_point.h
393 lang/wgsl/ast/transform/utils/hoist_to_decl_before.cc
394 lang/wgsl/ast/transform/utils/hoist_to_decl_before.h
395 lang/wgsl/ast/transform/var_for_dynamic_index.cc
396 lang/wgsl/ast/transform/var_for_dynamic_index.h
397 lang/wgsl/ast/transform/vectorize_matrix_conversions.cc
398 lang/wgsl/ast/transform/vectorize_matrix_conversions.h
399 lang/wgsl/ast/transform/vectorize_scalar_matrix_initializers.cc
400 lang/wgsl/ast/transform/vectorize_scalar_matrix_initializers.h
401 lang/wgsl/ast/transform/vertex_pulling.cc
402 lang/wgsl/ast/transform/vertex_pulling.h
403 lang/wgsl/ast/transform/while_to_loop.cc
404 lang/wgsl/ast/transform/while_to_loop.h
405 lang/wgsl/ast/transform/zero_init_workgroup_memory.cc
406 lang/wgsl/ast/transform/zero_init_workgroup_memory.h
dan sinclair46725bd2023-07-21 00:40:07 +0000407 lang/wgsl/ast/traverse_expressions.h
408 lang/wgsl/ast/type.cc
409 lang/wgsl/ast/type.h
410 lang/wgsl/ast/type_decl.cc
411 lang/wgsl/ast/type_decl.h
412 lang/wgsl/ast/unary_op.cc
413 lang/wgsl/ast/unary_op.h
414 lang/wgsl/ast/unary_op_expression.cc
415 lang/wgsl/ast/unary_op_expression.h
416 lang/wgsl/ast/var.cc
417 lang/wgsl/ast/var.h
418 lang/wgsl/ast/variable.cc
419 lang/wgsl/ast/variable.h
420 lang/wgsl/ast/variable_decl_statement.cc
421 lang/wgsl/ast/variable_decl_statement.h
422 lang/wgsl/ast/while_statement.cc
423 lang/wgsl/ast/while_statement.h
424 lang/wgsl/ast/workgroup_attribute.cc
425 lang/wgsl/ast/workgroup_attribute.h
426 lang/wgsl/helpers/append_vector.cc
427 lang/wgsl/helpers/append_vector.h
428 lang/wgsl/helpers/check_supported_extensions.cc
429 lang/wgsl/helpers/check_supported_extensions.h
430 lang/wgsl/helpers/flatten_bindings.cc
431 lang/wgsl/helpers/flatten_bindings.h
432 lang/wgsl/inspector/entry_point.cc
433 lang/wgsl/inspector/entry_point.h
434 lang/wgsl/inspector/inspector.cc
435 lang/wgsl/inspector/inspector.h
436 lang/wgsl/inspector/resource_binding.cc
437 lang/wgsl/inspector/resource_binding.h
438 lang/wgsl/inspector/scalar.cc
439 lang/wgsl/inspector/scalar.h
440 lang/wgsl/program/program.cc
441 lang/wgsl/program/program.h
442 lang/wgsl/program/program_builder.cc
443 lang/wgsl/program/program_builder.h
444 lang/wgsl/sem/accessor_expression.cc
445 lang/wgsl/sem/accessor_expression.h
446 lang/wgsl/sem/array_count.cc
447 lang/wgsl/sem/array_count.h
448 lang/wgsl/sem/behavior.cc
449 lang/wgsl/sem/behavior.h
450 lang/wgsl/sem/binding_point.h
451 lang/wgsl/sem/block_statement.cc
452 lang/wgsl/sem/block_statement.h
453 lang/wgsl/sem/break_if_statement.cc
454 lang/wgsl/sem/break_if_statement.h
455 lang/wgsl/sem/builtin.cc
456 lang/wgsl/sem/builtin.h
457 lang/wgsl/sem/builtin_enum_expression.cc
458 lang/wgsl/sem/builtin_enum_expression.h
459 lang/wgsl/sem/call.cc
460 lang/wgsl/sem/call.h
461 lang/wgsl/sem/call_target.cc
462 lang/wgsl/sem/call_target.h
463 lang/wgsl/sem/evaluation_stage.h
464 lang/wgsl/sem/expression.cc
465 lang/wgsl/sem/expression.h
466 lang/wgsl/sem/external_texture.h
467 lang/wgsl/sem/for_loop_statement.cc
468 lang/wgsl/sem/for_loop_statement.h
469 lang/wgsl/sem/function.cc
470 lang/wgsl/sem/function_expression.cc
471 lang/wgsl/sem/function_expression.h
472 lang/wgsl/sem/if_statement.cc
473 lang/wgsl/sem/if_statement.h
474 lang/wgsl/sem/index_accessor_expression.cc
475 lang/wgsl/sem/index_accessor_expression.h
476 lang/wgsl/sem/info.cc
477 lang/wgsl/sem/info.h
478 lang/wgsl/sem/load.cc
479 lang/wgsl/sem/load.h
480 lang/wgsl/sem/loop_statement.cc
481 lang/wgsl/sem/loop_statement.h
482 lang/wgsl/sem/materialize.cc
483 lang/wgsl/sem/materialize.h
484 lang/wgsl/sem/member_accessor_expression.cc
485 lang/wgsl/sem/module.cc
486 lang/wgsl/sem/module.h
487 lang/wgsl/sem/node.cc
488 lang/wgsl/sem/node.h
489 lang/wgsl/sem/pipeline_stage_set.h
490 lang/wgsl/sem/sampler_texture_pair.h
491 lang/wgsl/sem/statement.cc
492 lang/wgsl/sem/struct.cc
493 lang/wgsl/sem/struct.h
494 lang/wgsl/sem/switch_statement.cc
495 lang/wgsl/sem/switch_statement.h
496 lang/wgsl/sem/type_expression.cc
497 lang/wgsl/sem/type_expression.h
498 lang/wgsl/sem/type_mappings.h
499 lang/wgsl/sem/value_constructor.cc
500 lang/wgsl/sem/value_constructor.h
501 lang/wgsl/sem/value_conversion.cc
502 lang/wgsl/sem/value_conversion.h
503 lang/wgsl/sem/value_expression.cc
504 lang/wgsl/sem/value_expression.h
505 lang/wgsl/sem/variable.cc
506 lang/wgsl/sem/while_statement.cc
507 lang/wgsl/sem/while_statement.h
508 program_id.cc
509 program_id.h
510 reader/reader.cc
511 reader/reader.h
dan sinclair9d97f222023-07-24 17:11:53 +0000512 lang/wgsl/resolver/const_eval.cc
513 lang/wgsl/resolver/const_eval.h
514 lang/wgsl/resolver/dependency_graph.cc
515 lang/wgsl/resolver/dependency_graph.h
516 lang/wgsl/resolver/intrinsic_table.cc
517 lang/wgsl/resolver/intrinsic_table.h
518 lang/wgsl/resolver/intrinsic_table.inl
519 lang/wgsl/resolver/resolver.cc
520 lang/wgsl/resolver/resolver.h
521 lang/wgsl/resolver/sem_helper.cc
522 lang/wgsl/resolver/sem_helper.h
523 lang/wgsl/resolver/uniformity.cc
524 lang/wgsl/resolver/uniformity.h
525 lang/wgsl/resolver/validator.cc
526 lang/wgsl/resolver/validator.h
dan sinclair46725bd2023-07-21 00:40:07 +0000527 tint.cc
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000528 transform/manager.cc
529 transform/manager.h
James Price0e6534e2023-05-17 01:21:45 +0000530 transform/transform.cc
531 transform/transform.h
dan sinclair22b4dd22023-07-21 00:40:07 +0000532 utils/cli/cli.cc
533 utils/cli/cli.h
dan sinclair46725bd2023-07-21 00:40:07 +0000534 utils/containers/bitset.h
dan sinclair22b4dd22023-07-21 00:40:07 +0000535 utils/containers/enum_set.h
dan sinclair22b4dd22023-07-21 00:40:07 +0000536 utils/containers/hashmap.h
dan sinclair46725bd2023-07-21 00:40:07 +0000537 utils/containers/hashmap_base.h
dan sinclair22b4dd22023-07-21 00:40:07 +0000538 utils/containers/hashset.h
539 utils/containers/map.h
dan sinclair46725bd2023-07-21 00:40:07 +0000540 utils/containers/predicates.h
541 utils/containers/scope_stack.h
542 utils/containers/slice.h
543 utils/containers/unique_allocator.h
544 utils/containers/unique_vector.h
545 utils/containers/vector.h
546 utils/macros/compiler.h
547 utils/macros/concat.h
548 utils/macros/foreach.h
549 utils/macros/scoped_assignment.h
550 utils/math/crc32.h
551 utils/math/hash.h
dan sinclair22b4dd22023-07-21 00:40:07 +0000552 utils/math/math.h
dan sinclair46725bd2023-07-21 00:40:07 +0000553 utils/memory/bitcast.h
554 utils/memory/block_allocator.h
555 utils/memory/bump_allocator.h
556 utils/reflection/reflection.h
557 utils/rtti/castable.cc
558 utils/rtti/castable.h
559 utils/rtti/switch.h
560 utils/text/float_to_string.cc
561 utils/text/float_to_string.h
dan sinclair22b4dd22023-07-21 00:40:07 +0000562 utils/text/parse_num.cc
563 utils/text/parse_num.h
dan sinclair22b4dd22023-07-21 00:40:07 +0000564 utils/text/string.cc
565 utils/text/string.h
566 utils/text/string_stream.cc
567 utils/text/string_stream.h
dan sinclair46725bd2023-07-21 00:40:07 +0000568 utils/text/symbol.cc
569 utils/text/symbol.h
570 utils/text/symbol_table.cc
571 utils/text/symbol_table.h
572 utils/text/text_generator.cc
573 utils/text/text_generator.h
dan sinclair22b4dd22023-07-21 00:40:07 +0000574 utils/traits/traits.h
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000575 writer/array_length_from_uniform_options.cc
576 writer/array_length_from_uniform_options.h
dan sinclairc0f0ab72023-06-23 16:57:00 +0000577 writer/ast_text_generator.cc
578 writer/ast_text_generator.h
dan sinclaireebbdef2023-03-08 02:48:42 +0000579 writer/binding_point.h
dan sinclair39d40652023-03-15 13:41:46 +0000580 writer/binding_remapper_options.cc
581 writer/binding_remapper_options.h
dan sinclaire95b59c2023-03-10 11:34:26 +0000582 writer/external_texture_options.cc
583 writer/external_texture_options.h
dan sinclaircadd0c02023-06-26 13:50:42 +0000584 writer/ir_text_generator.cc
585 writer/ir_text_generator.h
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000586 writer/text.cc
587 writer/text.h
588 writer/writer.cc
589 writer/writer.h
590)
591
dan sinclair352f8c82023-07-21 00:40:07 +0000592tint_generated(lang/core/builtin/access BENCH TEST)
593tint_generated(lang/core/builtin/address_space BENCH TEST)
594tint_generated(lang/core/builtin/attribute BENCH TEST)
595tint_generated(lang/core/builtin/builtin BENCH TEST)
596tint_generated(lang/core/builtin/builtin_value BENCH TEST)
597tint_generated(lang/core/builtin/diagnostic_rule BENCH TEST)
598tint_generated(lang/core/builtin/diagnostic_severity BENCH TEST)
599tint_generated(lang/core/builtin/extension BENCH TEST)
600tint_generated(lang/core/builtin/function)
601tint_generated(lang/core/builtin/interpolation_sampling BENCH TEST)
602tint_generated(lang/core/builtin/interpolation_type BENCH TEST)
603tint_generated(lang/core/builtin/texel_format BENCH TEST)
dan sinclair993a6582023-02-20 08:37:45 +0000604
dan sinclair9d97f222023-07-24 17:11:53 +0000605tint_generated(lang/wgsl/resolver/ctor_conv_intrinsic)
dan sinclaird3b13692023-07-20 01:14:15 +0000606tint_generated(lang/wgsl/sem/parameter_usage)
dan sinclair16b4cf82022-11-03 21:10:40 +0000607
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000608if(UNIX)
dan sinclair22b4dd22023-07-21 00:40:07 +0000609 list(APPEND TINT_LIB_SRCS utils/diagnostic/printer_posix.cc)
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000610elseif(WIN32)
dan sinclair22b4dd22023-07-21 00:40:07 +0000611 list(APPEND TINT_LIB_SRCS utils/diagnostic/printer_windows.cc)
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000612else()
dan sinclair22b4dd22023-07-21 00:40:07 +0000613 list(APPEND TINT_LIB_SRCS utils/diagnostic/printer_other.cc)
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000614endif()
615
616if(${TINT_BUILD_SPV_READER})
617 list(APPEND TINT_LIB_SRCS
dan sinclairb2e45492023-07-20 01:14:15 +0000618 lang/spirv/reader/attributes.h
619 lang/spirv/reader/construct.h
620 lang/spirv/reader/construct.cc
621 lang/spirv/reader/entry_point_info.h
622 lang/spirv/reader/entry_point_info.cc
623 lang/spirv/reader/enum_converter.h
624 lang/spirv/reader/enum_converter.cc
625 lang/spirv/reader/fail_stream.h
626 lang/spirv/reader/function.cc
627 lang/spirv/reader/function.h
628 lang/spirv/reader/namer.cc
629 lang/spirv/reader/namer.h
630 lang/spirv/reader/parser_type.cc
631 lang/spirv/reader/parser_type.h
632 lang/spirv/reader/parser.cc
633 lang/spirv/reader/parser.h
634 lang/spirv/reader/parser_impl.cc
635 lang/spirv/reader/parser_impl.h
636 lang/spirv/reader/usage.cc
637 lang/spirv/reader/usage.h
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000638 )
639endif()
640
641if(${TINT_BUILD_WGSL_READER})
642 list(APPEND TINT_LIB_SRCS
dan sinclair7cf568f2023-07-20 01:14:15 +0000643 lang/wgsl/reader/classify_template_args.cc
644 lang/wgsl/reader/classify_template_args.h
645 lang/wgsl/reader/lexer.cc
646 lang/wgsl/reader/lexer.h
647 lang/wgsl/reader/parser.cc
648 lang/wgsl/reader/parser.h
649 lang/wgsl/reader/parser_impl.cc
650 lang/wgsl/reader/parser_impl.h
651 lang/wgsl/reader/parser_impl_detail.h
652 lang/wgsl/reader/token.cc
653 lang/wgsl/reader/token.h
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000654 )
655endif()
656
657if(${TINT_BUILD_SPV_WRITER})
658 list(APPEND TINT_LIB_SRCS
James Price74d04a82023-07-20 14:44:22 +0000659 lang/spirv/ast_writer/binary_writer.cc
660 lang/spirv/ast_writer/binary_writer.h
661 lang/spirv/ast_writer/builder.cc
662 lang/spirv/ast_writer/builder.h
663 lang/spirv/ast_writer/function.cc
664 lang/spirv/ast_writer/function.h
665 lang/spirv/ast_writer/generator.cc
666 lang/spirv/ast_writer/generator.h
667 lang/spirv/ast_writer/generator_impl.cc
668 lang/spirv/ast_writer/generator_impl.h
669 lang/spirv/ast_writer/instruction.cc
670 lang/spirv/ast_writer/instruction.h
671 lang/spirv/ast_writer/module.cc
672 lang/spirv/ast_writer/module.h
673 lang/spirv/ast_writer/operand.cc
674 lang/spirv/ast_writer/operand.h
675 lang/spirv/ast_writer/scalar_constant.h
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000676 )
James Price8f9ea962023-05-04 01:31:36 +0000677
678 if(${TINT_BUILD_IR})
679 list(APPEND TINT_LIB_SRCS
dan sinclair97c37272023-07-24 17:11:53 +0000680 lang/core/ir/transform/builtin_polyfill_spirv.cc
681 lang/core/ir/transform/builtin_polyfill_spirv.h
682 lang/core/ir/transform/expand_implicit_splats.cc
683 lang/core/ir/transform/expand_implicit_splats.h
684 lang/core/ir/transform/handle_matrix_arithmetic.cc
685 lang/core/ir/transform/handle_matrix_arithmetic.h
686 lang/core/ir/transform/merge_return.cc
687 lang/core/ir/transform/merge_return.h
688 lang/core/ir/transform/shader_io_spirv.cc
689 lang/core/ir/transform/shader_io_spirv.h
690 lang/core/ir/transform/var_for_dynamic_index.cc
691 lang/core/ir/transform/var_for_dynamic_index.h
James Price2280cc62023-07-21 03:42:48 +0000692 lang/spirv/writer/writer.cc
693 lang/spirv/writer/writer.h
James Price8f9ea962023-05-04 01:31:36 +0000694 )
695 endif()
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000696endif()
697
698if(${TINT_BUILD_WGSL_WRITER})
699 list(APPEND TINT_LIB_SRCS
dan sinclairff6eba52023-07-20 01:14:15 +0000700 lang/wgsl/ast_writer/generator.cc
701 lang/wgsl/ast_writer/generator.h
702 lang/wgsl/ast_writer/generator_impl.cc
703 lang/wgsl/ast_writer/generator_impl.h
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000704 )
705endif()
706
707if(${TINT_BUILD_MSL_WRITER})
708 list(APPEND TINT_LIB_SRCS
dan sinclaird5575ce2023-07-20 01:14:15 +0000709 lang/msl/ast_writer/generator.cc
710 lang/msl/ast_writer/generator.h
711 lang/msl/ast_writer/generator_impl.cc
712 lang/msl/ast_writer/generator_impl.h
713 lang/msl/ast_writer/generator_support.cc
714 lang/msl/ast_writer/generator_support.h
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000715 )
dan sinclaircadd0c02023-06-26 13:50:42 +0000716
717 if(${TINT_BUILD_IR})
718 list(APPEND TINT_LIB_SRCS
dan sinclaird5575ce2023-07-20 01:14:15 +0000719 lang/msl/writer/generator_impl_ir.cc
720 lang/msl/writer/generator_impl_ir.h
dan sinclaircadd0c02023-06-26 13:50:42 +0000721 )
722 endif()
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000723endif()
724
725if(${TINT_BUILD_GLSL_WRITER})
726 list(APPEND TINT_LIB_SRCS
dan sinclair8046fbb2023-07-20 01:14:15 +0000727 lang/glsl/ast_writer/generator.cc
728 lang/glsl/ast_writer/generator.h
729 lang/glsl/ast_writer/generator_impl.cc
730 lang/glsl/ast_writer/generator_impl.h
731 lang/glsl/ast_writer/version.h
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000732 )
733endif()
734
735if(${TINT_BUILD_HLSL_WRITER})
736 list(APPEND TINT_LIB_SRCS
dan sinclair5fbe1f62023-07-20 01:14:15 +0000737 lang/hlsl/ast_writer/generator.cc
738 lang/hlsl/ast_writer/generator.h
739 lang/hlsl/ast_writer/generator_impl.cc
740 lang/hlsl/ast_writer/generator_impl.h
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000741 )
742endif()
743
dan sinclair0917fbb2023-03-07 18:28:38 +0000744if(${TINT_BUILD_SYNTAX_TREE_WRITER})
745 list(APPEND TINT_LIB_SRCS
dan sinclairb7294dc2023-07-20 01:14:15 +0000746 lang/wgsl/syntax_tree_writer/generator.cc
747 lang/wgsl/syntax_tree_writer/generator.h
748 lang/wgsl/syntax_tree_writer/generator_impl.cc
749 lang/wgsl/syntax_tree_writer/generator_impl.h
dan sinclair0917fbb2023-03-07 18:28:38 +0000750 )
751endif()
752
dan sinclair92612612022-11-01 18:15:50 +0000753if(${TINT_BUILD_IR})
754 list(APPEND TINT_LIB_SRCS
dan sinclair97c37272023-07-24 17:11:53 +0000755 lang/core/ir/access.cc
756 lang/core/ir/access.h
757 lang/core/ir/binary.cc
758 lang/core/ir/binary.h
759 lang/core/ir/binding_point.h
760 lang/core/ir/bitcast.cc
761 lang/core/ir/bitcast.h
762 lang/core/ir/block.cc
763 lang/core/ir/block.h
764 lang/core/ir/block_param.cc
765 lang/core/ir/block_param.h
766 lang/core/ir/break_if.cc
767 lang/core/ir/break_if.h
768 lang/core/ir/builder.cc
769 lang/core/ir/builder.h
770 lang/core/ir/builtin_call.cc
771 lang/core/ir/builtin_call.h
772 lang/core/ir/call.cc
773 lang/core/ir/call.h
774 lang/core/ir/constant.cc
775 lang/core/ir/constant.h
776 lang/core/ir/construct.cc
777 lang/core/ir/construct.h
778 lang/core/ir/continue.cc
779 lang/core/ir/continue.h
780 lang/core/ir/control_instruction.cc
781 lang/core/ir/control_instruction.h
782 lang/core/ir/convert.cc
783 lang/core/ir/convert.h
784 lang/core/ir/core_builtin_call.cc
785 lang/core/ir/core_builtin_call.h
786 lang/core/ir/disassembler.cc
787 lang/core/ir/disassembler.h
788 lang/core/ir/discard.cc
789 lang/core/ir/discard.h
790 lang/core/ir/exit_if.cc
791 lang/core/ir/exit_if.h
792 lang/core/ir/exit_loop.cc
793 lang/core/ir/exit_loop.h
794 lang/core/ir/exit_switch.cc
795 lang/core/ir/exit_switch.h
796 lang/core/ir/exit.cc
797 lang/core/ir/exit.h
798 lang/core/ir/from_program.cc
799 lang/core/ir/from_program.h
800 lang/core/ir/function.cc
801 lang/core/ir/function.h
802 lang/core/ir/function_param.cc
803 lang/core/ir/function_param.h
804 lang/core/ir/if.cc
805 lang/core/ir/if.h
806 lang/core/ir/instruction.cc
807 lang/core/ir/instruction.h
808 lang/core/ir/instruction_result.cc
809 lang/core/ir/instruction_result.h
810 lang/core/ir/intrinsic_call.cc
811 lang/core/ir/intrinsic_call.h
812 lang/core/ir/let.cc
813 lang/core/ir/let.h
814 lang/core/ir/load.cc
815 lang/core/ir/load.h
816 lang/core/ir/load_vector_element.cc
817 lang/core/ir/load_vector_element.h
818 lang/core/ir/location.h
819 lang/core/ir/loop.cc
820 lang/core/ir/loop.h
821 lang/core/ir/module.cc
822 lang/core/ir/module.h
823 lang/core/ir/multi_in_block.cc
824 lang/core/ir/multi_in_block.h
825 lang/core/ir/next_iteration.cc
826 lang/core/ir/next_iteration.h
827 lang/core/ir/operand_instruction.cc
828 lang/core/ir/operand_instruction.h
829 lang/core/ir/return.cc
830 lang/core/ir/return.h
831 lang/core/ir/store.cc
832 lang/core/ir/store.h
833 lang/core/ir/store_vector_element.cc
834 lang/core/ir/store_vector_element.h
835 lang/core/ir/switch.cc
836 lang/core/ir/switch.h
837 lang/core/ir/swizzle.cc
838 lang/core/ir/swizzle.h
839 lang/core/ir/terminate_invocation.cc
840 lang/core/ir/terminate_invocation.h
841 lang/core/ir/terminator.cc
842 lang/core/ir/terminator.h
843 lang/core/ir/to_program.cc
844 lang/core/ir/to_program.h
845 lang/core/ir/unary.cc
846 lang/core/ir/unary.h
847 lang/core/ir/unreachable.cc
848 lang/core/ir/unreachable.h
849 lang/core/ir/user_call.cc
850 lang/core/ir/user_call.h
851 lang/core/ir/validator.cc
852 lang/core/ir/validator.h
853 lang/core/ir/value.cc
854 lang/core/ir/value.h
855 lang/core/ir/var.cc
856 lang/core/ir/var.h
857 lang/core/ir/transform/add_empty_entry_point.cc
858 lang/core/ir/transform/add_empty_entry_point.h
859 lang/core/ir/transform/block_decorated_structs.cc
860 lang/core/ir/transform/block_decorated_structs.h
861 lang/core/ir/transform/demote_to_helper.cc
862 lang/core/ir/transform/demote_to_helper.h
863 lang/core/ir/transform/rename_conflicts_wgsl.cc
864 lang/core/ir/transform/rename_conflicts_wgsl.h
865 lang/core/ir/transform/shader_io.cc
866 lang/core/ir/transform/shader_io.h
867 lang/core/ir/transform/transform.cc
868 lang/core/ir/transform/transform.h
dan sinclair92612612022-11-01 18:15:50 +0000869 )
870endif()
871
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000872if(MSVC)
873 list(APPEND TINT_LIB_SRCS
874 tint.natvis
875 )
876endif()
877
878## Tint IO utilities. Used by tint_val.
879add_library(tint_utils_io
dan sinclair22b4dd22023-07-21 00:40:07 +0000880 utils/command/command_${TINT_OS_CC_SUFFIX}.cc
881 utils/command/command.h
882 utils/file/tmpfile_${TINT_OS_CC_SUFFIX}.cc
883 utils/file/tmpfile.h
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000884)
885tint_default_compile_options(tint_utils_io)
886target_link_libraries(tint_utils_io tint_diagnostic_utils)
887
888## Tint validation utilities. Used by tests and the tint executable.
889add_library(tint_val
dan sinclair8a5d5bf2023-07-20 09:21:10 +0000890 lang/hlsl/validate/hlsl.cc
891 lang/hlsl/validate/val.h
892 lang/msl/validate/msl.cc
893 lang/msl/validate/val.h
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000894)
895
896# If we're building on mac / ios and we have CoreGraphics, then we can use the
897# metal API to validate our shaders. This is roughly 4x faster than invoking
898# the metal shader compiler executable.
899if(APPLE)
900 find_library(LIB_CORE_GRAPHICS CoreGraphics)
901 if(LIB_CORE_GRAPHICS)
dan sinclair8a5d5bf2023-07-20 09:21:10 +0000902 target_sources(tint_val PRIVATE "lang/msl/validate/msl_metal.mm")
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000903 target_compile_definitions(tint_val PUBLIC "-DTINT_ENABLE_MSL_VALIDATION_USING_METAL_API=1")
904 target_compile_options(tint_val PRIVATE "-fmodules" "-fcxx-modules")
905 target_link_options(tint_val PUBLIC "-framework" "CoreGraphics")
906 endif()
907endif()
908
909tint_default_compile_options(tint_val)
910target_link_libraries(tint_val tint_utils_io)
911
912## Tint library
913add_library(libtint ${TINT_LIB_SRCS})
914tint_default_compile_options(libtint)
dan sinclair2fe7f192023-03-07 18:20:23 +0000915target_link_libraries(libtint tint_diagnostic_utils absl_strings)
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000916set_target_properties(libtint PROPERTIES OUTPUT_NAME "tint")
917
918if (${TINT_BUILD_FUZZERS})
919 # Tint library with fuzzer instrumentation
920 add_library(libtint-fuzz ${TINT_LIB_SRCS})
921 tint_default_compile_options(libtint-fuzz)
dan sinclair2fe7f192023-03-07 18:20:23 +0000922 target_link_libraries(libtint-fuzz tint_diagnostic_utils absl_strings)
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000923 if (${COMPILER_IS_LIKE_GNU})
924 target_compile_options(libtint-fuzz PRIVATE -fvisibility=hidden)
925 endif()
926
927 if (NOT ${TINT_LIB_FUZZING_ENGINE_LINK_OPTIONS} STREQUAL "")
928 # This is set when the fuzzers are being built by OSS-Fuzz. In this case the
929 # variable provides the necessary linker flags, and OSS-Fuzz will take care
930 # of passing suitable compiler flags.
931 target_link_options(libtint-fuzz PUBLIC ${TINT_LIB_FUZZING_ENGINE_LINK_OPTIONS})
932 else()
933 # When the fuzzers are being built outside of OSS-Fuzz, specific libFuzzer
934 # arguments to enable fuzzing are used.
935 target_compile_options(libtint-fuzz PUBLIC -fsanitize=fuzzer -fsanitize-coverage=trace-cmp)
936 target_link_options(libtint-fuzz PUBLIC -fsanitize=fuzzer -fsanitize-coverage=trace-cmp)
937 endif()
938endif()
939
940if(${TINT_BUILD_SPV_READER} OR ${TINT_BUILD_SPV_WRITER})
941 tint_spvtools_compile_options(libtint)
942 if (${TINT_BUILD_FUZZERS})
943 tint_spvtools_compile_options(libtint-fuzz)
944 endif()
945endif()
946
Ben Claytonba200e82022-11-07 17:24:10 +0000947
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000948################################################################################
949# Tests
950################################################################################
951if(TINT_BUILD_TESTS)
dan sinclair16b4cf82022-11-03 21:10:40 +0000952 list(APPEND TINT_TEST_SRCS
dan sinclair46725bd2023-07-21 00:40:07 +0000953 clone_context_test.cc
954 lang/core/builtin/number_test.cc
955 lang/core/constant/composite_test.cc
956 lang/core/constant/manager_test.cc
957 lang/core/constant/scalar_test.cc
958 lang/core/constant/splat_test.cc
959 lang/core/constant/value_test.cc
960 lang/core/type/array_test.cc
961 lang/core/type/atomic_test.cc
962 lang/core/type/bool_test.cc
963 lang/core/type/builtin_structs_test.cc
964 lang/core/type/depth_multisampled_texture_test.cc
965 lang/core/type/depth_texture_test.cc
966 lang/core/type/external_texture_test.cc
967 lang/core/type/f16_test.cc
968 lang/core/type/f32_test.cc
969 lang/core/type/i32_test.cc
970 lang/core/type/manager_test.cc
971 lang/core/type/matrix_test.cc
972 lang/core/type/multisampled_texture_test.cc
973 lang/core/type/pointer_test.cc
974 lang/core/type/reference_test.cc
975 lang/core/type/sampled_texture_test.cc
976 lang/core/type/sampler_test.cc
977 lang/core/type/storage_texture_test.cc
978 lang/core/type/struct_test.cc
979 lang/core/type/texture_test.cc
980 lang/core/type/type_test.cc
981 lang/core/type/u32_test.cc
982 lang/core/type/vector_test.cc
dan sinclair99181d82023-07-20 01:14:15 +0000983 lang/wgsl/ast/alias_test.cc
984 lang/wgsl/ast/assignment_statement_test.cc
985 lang/wgsl/ast/binary_expression_test.cc
986 lang/wgsl/ast/binding_attribute_test.cc
987 lang/wgsl/ast/bitcast_expression_test.cc
988 lang/wgsl/ast/block_statement_test.cc
989 lang/wgsl/ast/bool_literal_expression_test.cc
990 lang/wgsl/ast/break_if_statement_test.cc
991 lang/wgsl/ast/break_statement_test.cc
992 lang/wgsl/ast/builtin_attribute_test.cc
993 lang/wgsl/ast/builtin_texture_helper_test.cc
994 lang/wgsl/ast/builtin_texture_helper_test.h
995 lang/wgsl/ast/call_expression_test.cc
996 lang/wgsl/ast/call_statement_test.cc
997 lang/wgsl/ast/case_selector_test.cc
998 lang/wgsl/ast/case_statement_test.cc
999 lang/wgsl/ast/compound_assignment_statement_test.cc
1000 lang/wgsl/ast/const_assert_test.cc
1001 lang/wgsl/ast/continue_statement_test.cc
1002 lang/wgsl/ast/diagnostic_attribute_test.cc
1003 lang/wgsl/ast/diagnostic_control_test.cc
1004 lang/wgsl/ast/diagnostic_directive_test.cc
1005 lang/wgsl/ast/diagnostic_rule_name_test.cc
1006 lang/wgsl/ast/discard_statement_test.cc
1007 lang/wgsl/ast/enable_test.cc
1008 lang/wgsl/ast/float_literal_expression_test.cc
1009 lang/wgsl/ast/for_loop_statement_test.cc
1010 lang/wgsl/ast/function_test.cc
1011 lang/wgsl/ast/group_attribute_test.cc
1012 lang/wgsl/ast/id_attribute_test.cc
dan sinclair99181d82023-07-20 01:14:15 +00001013 lang/wgsl/ast/identifier_expression_test.cc
dan sinclair46725bd2023-07-21 00:40:07 +00001014 lang/wgsl/ast/identifier_test.cc
dan sinclair99181d82023-07-20 01:14:15 +00001015 lang/wgsl/ast/if_statement_test.cc
1016 lang/wgsl/ast/increment_decrement_statement_test.cc
1017 lang/wgsl/ast/index_accessor_expression_test.cc
1018 lang/wgsl/ast/index_attribute_test.cc
1019 lang/wgsl/ast/int_literal_expression_test.cc
1020 lang/wgsl/ast/interpolate_attribute_test.cc
1021 lang/wgsl/ast/location_attribute_test.cc
1022 lang/wgsl/ast/loop_statement_test.cc
1023 lang/wgsl/ast/member_accessor_expression_test.cc
1024 lang/wgsl/ast/module_test.cc
1025 lang/wgsl/ast/phony_expression_test.cc
1026 lang/wgsl/ast/return_statement_test.cc
1027 lang/wgsl/ast/stage_attribute_test.cc
1028 lang/wgsl/ast/stride_attribute_test.cc
1029 lang/wgsl/ast/struct_member_align_attribute_test.cc
1030 lang/wgsl/ast/struct_member_offset_attribute_test.cc
1031 lang/wgsl/ast/struct_member_size_attribute_test.cc
1032 lang/wgsl/ast/struct_member_test.cc
1033 lang/wgsl/ast/struct_test.cc
1034 lang/wgsl/ast/switch_statement_test.cc
1035 lang/wgsl/ast/templated_identifier_test.cc
1036 lang/wgsl/ast/test_helper.h
1037 lang/wgsl/ast/test_helper_test.cc
dan sinclair46725bd2023-07-21 00:40:07 +00001038 lang/wgsl/ast/transform/transform_test.cc
dan sinclair99181d82023-07-20 01:14:15 +00001039 lang/wgsl/ast/traverse_expressions_test.cc
1040 lang/wgsl/ast/unary_op_expression_test.cc
1041 lang/wgsl/ast/variable_decl_statement_test.cc
1042 lang/wgsl/ast/variable_test.cc
1043 lang/wgsl/ast/while_statement_test.cc
1044 lang/wgsl/ast/workgroup_attribute_test.cc
dan sinclair46725bd2023-07-21 00:40:07 +00001045 lang/wgsl/helpers/append_vector_test.cc
1046 lang/wgsl/helpers/check_supported_extensions_test.cc
1047 lang/wgsl/helpers/flatten_bindings_test.cc
dan sinclair96db5542023-07-20 09:21:10 +00001048 lang/wgsl/program/program_builder_test.cc
1049 lang/wgsl/program/program_test.cc
dan sinclair46725bd2023-07-21 00:40:07 +00001050 lang/wgsl/sem/builtin_test.cc
1051 lang/wgsl/sem/diagnostic_severity_test.cc
1052 lang/wgsl/sem/struct_test.cc
1053 lang/wgsl/sem/value_expression_test.cc
dan sinclair9d97f222023-07-24 17:11:53 +00001054 lang/wgsl/resolver/address_space_layout_validation_test.cc
1055 lang/wgsl/resolver/address_space_validation_test.cc
1056 lang/wgsl/resolver/alias_analysis_test.cc
1057 lang/wgsl/resolver/array_accessor_test.cc
1058 lang/wgsl/resolver/assignment_validation_test.cc
1059 lang/wgsl/resolver/atomics_test.cc
1060 lang/wgsl/resolver/atomics_validation_test.cc
1061 lang/wgsl/resolver/attribute_validation_test.cc
1062 lang/wgsl/resolver/bitcast_validation_test.cc
1063 lang/wgsl/resolver/builtin_enum_test.cc
1064 lang/wgsl/resolver/builtin_structs_test.cc
1065 lang/wgsl/resolver/builtin_test.cc
1066 lang/wgsl/resolver/builtin_validation_test.cc
1067 lang/wgsl/resolver/builtins_validation_test.cc
1068 lang/wgsl/resolver/call_test.cc
1069 lang/wgsl/resolver/call_validation_test.cc
1070 lang/wgsl/resolver/compound_assignment_validation_test.cc
1071 lang/wgsl/resolver/compound_statement_test.cc
1072 lang/wgsl/resolver/const_assert_test.cc
1073 lang/wgsl/resolver/const_eval_binary_op_test.cc
1074 lang/wgsl/resolver/const_eval_bitcast_test.cc
1075 lang/wgsl/resolver/const_eval_builtin_test.cc
1076 lang/wgsl/resolver/const_eval_construction_test.cc
1077 lang/wgsl/resolver/const_eval_conversion_test.cc
1078 lang/wgsl/resolver/const_eval_indexing_test.cc
1079 lang/wgsl/resolver/const_eval_member_access_test.cc
1080 lang/wgsl/resolver/const_eval_runtime_semantics_test.cc
1081 lang/wgsl/resolver/const_eval_test.h
1082 lang/wgsl/resolver/const_eval_unary_op_test.cc
1083 lang/wgsl/resolver/control_block_validation_test.cc
1084 lang/wgsl/resolver/dependency_graph_test.cc
1085 lang/wgsl/resolver/diagnostic_control_test.cc
1086 lang/wgsl/resolver/dual_source_blending_extension_test.cc
1087 lang/wgsl/resolver/entry_point_validation_test.cc
1088 lang/wgsl/resolver/evaluation_stage_test.cc
1089 lang/wgsl/resolver/expression_kind_test.cc
1090 lang/wgsl/resolver/f16_extension_test.cc
1091 lang/wgsl/resolver/function_validation_test.cc
1092 lang/wgsl/resolver/host_shareable_validation_test.cc
1093 lang/wgsl/resolver/increment_decrement_validation_test.cc
1094 lang/wgsl/resolver/inferred_type_test.cc
1095 lang/wgsl/resolver/intrinsic_table_test.cc
1096 lang/wgsl/resolver/is_host_shareable_test.cc
1097 lang/wgsl/resolver/is_storeable_test.cc
1098 lang/wgsl/resolver/load_test.cc
1099 lang/wgsl/resolver/materialize_test.cc
1100 lang/wgsl/resolver/override_test.cc
1101 lang/wgsl/resolver/ptr_ref_test.cc
1102 lang/wgsl/resolver/ptr_ref_validation_test.cc
1103 lang/wgsl/resolver/resolver_behavior_test.cc
1104 lang/wgsl/resolver/resolver_test.cc
1105 lang/wgsl/resolver/resolver_test_helper.cc
1106 lang/wgsl/resolver/resolver_test_helper.h
1107 lang/wgsl/resolver/root_identifier_test.cc
1108 lang/wgsl/resolver/side_effects_test.cc
1109 lang/wgsl/resolver/struct_address_space_use_test.cc
1110 lang/wgsl/resolver/struct_layout_test.cc
1111 lang/wgsl/resolver/struct_pipeline_stage_use_test.cc
1112 lang/wgsl/resolver/type_validation_test.cc
1113 lang/wgsl/resolver/unresolved_identifier_test.cc
1114 lang/wgsl/resolver/validation_test.cc
1115 lang/wgsl/resolver/validator_is_storeable_test.cc
1116 lang/wgsl/resolver/value_constructor_validation_test.cc
1117 lang/wgsl/resolver/variable_test.cc
1118 lang/wgsl/resolver/variable_validation_test.cc
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001119 test_main.cc
James Price95b06122023-05-17 15:52:05 +00001120 transform/manager_test.cc
dan sinclair22b4dd22023-07-21 00:40:07 +00001121 utils/cli/cli_test.cc
dan sinclair22b4dd22023-07-21 00:40:07 +00001122 utils/command/command_test.cc
dan sinclair46725bd2023-07-21 00:40:07 +00001123 utils/containers/bitset_test.cc
1124 utils/containers/enum_set_test.cc
dan sinclair22b4dd22023-07-21 00:40:07 +00001125 utils/containers/hashmap_test.cc
1126 utils/containers/hashset_test.cc
1127 utils/containers/map_test.cc
dan sinclair22b4dd22023-07-21 00:40:07 +00001128 utils/containers/predicates_test.cc
dan sinclair22b4dd22023-07-21 00:40:07 +00001129 utils/containers/reverse_test.cc
dan sinclair46725bd2023-07-21 00:40:07 +00001130 utils/containers/scope_stack_test.cc
dan sinclair22b4dd22023-07-21 00:40:07 +00001131 utils/containers/slice_test.cc
dan sinclair22b4dd22023-07-21 00:40:07 +00001132 utils/containers/transform_test.cc
dan sinclair22b4dd22023-07-21 00:40:07 +00001133 utils/containers/unique_allocator_test.cc
1134 utils/containers/unique_vector_test.cc
1135 utils/containers/vector_test.cc
dan sinclair46725bd2023-07-21 00:40:07 +00001136 utils/debug/debug_test.cc
1137 utils/diagnostic/diagnostic_test.cc
1138 utils/diagnostic/formatter_test.cc
1139 utils/diagnostic/printer_test.cc
1140 utils/diagnostic/source_test.cc
1141 utils/file/tmpfile_test.cc
1142 utils/macros/defer_test.cc
1143 utils/macros/scoped_assignment_test.cc
1144 utils/math/crc32_test.cc
1145 utils/math/hash_test.cc
1146 utils/math/math_test.cc
1147 utils/memory/bitcast_test.cc
1148 utils/memory/block_allocator_test.cc
1149 utils/memory/bump_allocator_test.cc
1150 utils/reflection/reflection_test.cc
1151 utils/result/result_test.cc
1152 utils/rtti/castable_test.cc
1153 utils/rtti/switch_test.cc
dan sinclair22b4dd22023-07-21 00:40:07 +00001154 utils/text/float_to_string_test.cc
dan sinclair46725bd2023-07-21 00:40:07 +00001155 utils/text/string_stream_test.cc
1156 utils/text/string_test.cc
1157 utils/text/symbol_table_test.cc
1158 utils/text/symbol_test.cc
1159 utils/text/unicode_test.cc
1160 utils/traits/traits_test.cc
1161 writer/ast_text_generator_test.cc
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001162 )
1163
dan sinclair6521a352023-03-14 16:18:24 +00001164 # Noet, the source files are included here otherwise the cmd sources would not be included in the
1165 # test binary.
1166 list(APPEND TINT_TEST_SRCS
1167 cmd/generate_external_texture_bindings.cc
1168 cmd/generate_external_texture_bindings.h
1169 cmd/generate_external_texture_bindings_test.cc
1170 )
1171
James Pricebe656f72022-05-11 22:05:15 +00001172 # Uniformity analysis tests depend on WGSL reader
1173 if(${TINT_BUILD_WGSL_READER})
1174 list(APPEND TINT_TEST_SRCS
dan sinclair9d97f222023-07-24 17:11:53 +00001175 lang/wgsl/resolver/uniformity_test.cc
James Pricebe656f72022-05-11 22:05:15 +00001176 )
1177 endif()
1178
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001179 # Inspector tests depend on WGSL reader
1180 if(${TINT_BUILD_WGSL_READER})
1181 list(APPEND TINT_TEST_SRCS
dan sinclaird5ac9602023-07-20 09:21:10 +00001182 lang/wgsl/inspector/inspector_test.cc
1183 lang/wgsl/inspector/test_inspector_builder.cc
1184 lang/wgsl/inspector/test_inspector_builder.h
1185 lang/wgsl/inspector/test_inspector_runner.cc
1186 lang/wgsl/inspector/test_inspector_runner.h
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001187 )
1188 endif()
1189
1190 if(${TINT_BUILD_SPV_READER} AND ${TINT_BUILD_WGSL_WRITER})
1191 list(APPEND TINT_TEST_SRCS
dan sinclairb2e45492023-07-20 01:14:15 +00001192 lang/spirv/reader/enum_converter_test.cc
1193 lang/spirv/reader/fail_stream_test.cc
1194 lang/spirv/reader/function_arithmetic_test.cc
1195 lang/spirv/reader/function_bit_test.cc
1196 lang/spirv/reader/function_cfg_test.cc
1197 lang/spirv/reader/function_call_test.cc
1198 lang/spirv/reader/function_composite_test.cc
1199 lang/spirv/reader/function_conversion_test.cc
1200 lang/spirv/reader/function_decl_test.cc
1201 lang/spirv/reader/function_glsl_std_450_test.cc
1202 lang/spirv/reader/function_logical_test.cc
1203 lang/spirv/reader/function_memory_test.cc
1204 lang/spirv/reader/function_misc_test.cc
1205 lang/spirv/reader/function_var_test.cc
1206 lang/spirv/reader/namer_test.cc
1207 lang/spirv/reader/parser_impl_barrier_test.cc
1208 lang/spirv/reader/parser_impl_constant_test.cc
1209 lang/spirv/reader/parser_impl_convert_member_decoration_test.cc
1210 lang/spirv/reader/parser_impl_convert_type_test.cc
1211 lang/spirv/reader/parser_impl_function_decl_test.cc
1212 lang/spirv/reader/parser_impl_get_decorations_test.cc
1213 lang/spirv/reader/parser_impl_handle_test.cc
1214 lang/spirv/reader/parser_impl_import_test.cc
1215 lang/spirv/reader/parser_impl_module_var_test.cc
1216 lang/spirv/reader/parser_impl_named_types_test.cc
1217 lang/spirv/reader/parser_impl_test_helper.cc
1218 lang/spirv/reader/parser_impl_test_helper.h
1219 lang/spirv/reader/parser_impl_test.cc
1220 lang/spirv/reader/parser_impl_user_name_test.cc
1221 lang/spirv/reader/parser_type_test.cc
1222 lang/spirv/reader/parser_test.cc
1223 lang/spirv/reader/spirv_tools_helpers_test.cc
1224 lang/spirv/reader/spirv_tools_helpers_test.h
1225 lang/spirv/reader/usage_test.cc
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001226 )
1227 endif()
1228
1229 if(${TINT_BUILD_WGSL_READER})
1230 list(APPEND TINT_TEST_SRCS
dan sinclair7cf568f2023-07-20 01:14:15 +00001231 lang/wgsl/reader/classify_template_args_test.cc
1232 lang/wgsl/reader/lexer_test.cc
1233 lang/wgsl/reader/parser_test.cc
1234 lang/wgsl/reader/parser_impl_additive_expression_test.cc
1235 lang/wgsl/reader/parser_impl_argument_expression_list_test.cc
1236 lang/wgsl/reader/parser_impl_assignment_stmt_test.cc
1237 lang/wgsl/reader/parser_impl_bitwise_expression_test.cc
1238 lang/wgsl/reader/parser_impl_break_stmt_test.cc
1239 lang/wgsl/reader/parser_impl_bug_cases_test.cc
1240 lang/wgsl/reader/parser_impl_call_stmt_test.cc
1241 lang/wgsl/reader/parser_impl_compound_stmt_test.cc
1242 lang/wgsl/reader/parser_impl_const_literal_test.cc
1243 lang/wgsl/reader/parser_impl_continue_stmt_test.cc
1244 lang/wgsl/reader/parser_impl_continuing_stmt_test.cc
1245 lang/wgsl/reader/parser_impl_core_lhs_expression_test.cc
1246 lang/wgsl/reader/parser_impl_diagnostic_attribute_test.cc
1247 lang/wgsl/reader/parser_impl_diagnostic_control_test.cc
1248 lang/wgsl/reader/parser_impl_diagnostic_directive_test.cc
1249 lang/wgsl/reader/parser_impl_enable_directive_test.cc
1250 lang/wgsl/reader/parser_impl_error_msg_test.cc
1251 lang/wgsl/reader/parser_impl_error_resync_test.cc
1252 lang/wgsl/reader/parser_impl_expression_test.cc
1253 lang/wgsl/reader/parser_impl_for_stmt_test.cc
1254 lang/wgsl/reader/parser_impl_function_decl_test.cc
1255 lang/wgsl/reader/parser_impl_function_attribute_list_test.cc
1256 lang/wgsl/reader/parser_impl_function_attribute_test.cc
1257 lang/wgsl/reader/parser_impl_function_header_test.cc
1258 lang/wgsl/reader/parser_impl_global_constant_decl_test.cc
1259 lang/wgsl/reader/parser_impl_global_decl_test.cc
1260 lang/wgsl/reader/parser_impl_global_variable_decl_test.cc
1261 lang/wgsl/reader/parser_impl_if_stmt_test.cc
1262 lang/wgsl/reader/parser_impl_increment_decrement_stmt_test.cc
1263 lang/wgsl/reader/parser_impl_lhs_expression_test.cc
1264 lang/wgsl/reader/parser_impl_loop_stmt_test.cc
1265 lang/wgsl/reader/parser_impl_math_expression_test.cc
1266 lang/wgsl/reader/parser_impl_multiplicative_expression_test.cc
1267 lang/wgsl/reader/parser_impl_param_list_test.cc
1268 lang/wgsl/reader/parser_impl_paren_expression_test.cc
1269 lang/wgsl/reader/parser_impl_primary_expression_test.cc
1270 lang/wgsl/reader/parser_impl_relational_expression_test.cc
1271 lang/wgsl/reader/parser_impl_reserved_keyword_test.cc
1272 lang/wgsl/reader/parser_impl_require_directive_test.cc
1273 lang/wgsl/reader/parser_impl_shift_expression_test.cc
1274 lang/wgsl/reader/parser_impl_singular_expression_test.cc
1275 lang/wgsl/reader/parser_impl_statement_test.cc
1276 lang/wgsl/reader/parser_impl_statements_test.cc
1277 lang/wgsl/reader/parser_impl_struct_body_decl_test.cc
1278 lang/wgsl/reader/parser_impl_struct_decl_test.cc
1279 lang/wgsl/reader/parser_impl_struct_attribute_decl_test.cc
1280 lang/wgsl/reader/parser_impl_struct_member_attribute_decl_test.cc
1281 lang/wgsl/reader/parser_impl_struct_member_attribute_test.cc
1282 lang/wgsl/reader/parser_impl_struct_member_test.cc
1283 lang/wgsl/reader/parser_impl_switch_body_test.cc
1284 lang/wgsl/reader/parser_impl_switch_stmt_test.cc
1285 lang/wgsl/reader/parser_impl_test.cc
1286 lang/wgsl/reader/parser_impl_test_helper.cc
1287 lang/wgsl/reader/parser_impl_test_helper.h
1288 lang/wgsl/reader/parser_impl_type_alias_test.cc
1289 lang/wgsl/reader/parser_impl_type_decl_test.cc
1290 lang/wgsl/reader/parser_impl_unary_expression_test.cc
1291 lang/wgsl/reader/parser_impl_variable_decl_test.cc
1292 lang/wgsl/reader/parser_impl_variable_attribute_list_test.cc
1293 lang/wgsl/reader/parser_impl_variable_attribute_test.cc
1294 lang/wgsl/reader/parser_impl_variable_ident_decl_test.cc
1295 lang/wgsl/reader/parser_impl_variable_stmt_test.cc
1296 lang/wgsl/reader/parser_impl_variable_qualifier_test.cc
1297 lang/wgsl/reader/parser_impl_while_stmt_test.cc
1298 lang/wgsl/reader/token_test.cc
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001299 )
1300 endif()
1301
1302 if(${TINT_BUILD_SPV_WRITER})
1303 list(APPEND TINT_TEST_SRCS
James Price74d04a82023-07-20 14:44:22 +00001304 lang/spirv/ast_writer/binary_writer_test.cc
1305 lang/spirv/ast_writer/builder_accessor_expression_test.cc
1306 lang/spirv/ast_writer/builder_assign_test.cc
1307 lang/spirv/ast_writer/builder_binary_expression_test.cc
1308 lang/spirv/ast_writer/builder_bitcast_expression_test.cc
1309 lang/spirv/ast_writer/builder_block_test.cc
1310 lang/spirv/ast_writer/builder_builtin_test.cc
1311 lang/spirv/ast_writer/builder_builtin_texture_test.cc
1312 lang/spirv/ast_writer/builder_call_test.cc
1313 lang/spirv/ast_writer/builder_const_assert_test.cc
1314 lang/spirv/ast_writer/builder_constructor_expression_test.cc
1315 lang/spirv/ast_writer/builder_discard_test.cc
1316 lang/spirv/ast_writer/builder_entry_point_test.cc
1317 lang/spirv/ast_writer/builder_format_conversion_test.cc
1318 lang/spirv/ast_writer/builder_function_attribute_test.cc
1319 lang/spirv/ast_writer/builder_function_test.cc
1320 lang/spirv/ast_writer/builder_function_variable_test.cc
1321 lang/spirv/ast_writer/builder_global_variable_test.cc
1322 lang/spirv/ast_writer/builder_ident_expression_test.cc
1323 lang/spirv/ast_writer/builder_if_test.cc
1324 lang/spirv/ast_writer/builder_literal_test.cc
1325 lang/spirv/ast_writer/builder_loop_test.cc
1326 lang/spirv/ast_writer/builder_return_test.cc
1327 lang/spirv/ast_writer/builder_switch_test.cc
1328 lang/spirv/ast_writer/builder_test.cc
1329 lang/spirv/ast_writer/builder_type_test.cc
1330 lang/spirv/ast_writer/builder_unary_op_expression_test.cc
1331 lang/spirv/ast_writer/instruction_test.cc
1332 lang/spirv/ast_writer/module_test.cc
1333 lang/spirv/ast_writer/operand_test.cc
1334 lang/spirv/ast_writer/scalar_constant_test.cc
1335 lang/spirv/ast_writer/spv_dump.cc
1336 lang/spirv/ast_writer/spv_dump.h
1337 lang/spirv/ast_writer/test_helper.h
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001338 )
James Price8f9ea962023-05-04 01:31:36 +00001339
1340 if(${TINT_BUILD_IR})
1341 list(APPEND TINT_TEST_SRCS
dan sinclair97c37272023-07-24 17:11:53 +00001342 lang/core/ir/transform/builtin_polyfill_spirv_test.cc
1343 lang/core/ir/transform/handle_matrix_arithmetic_test.cc
1344 lang/core/ir/transform/expand_implicit_splats_test.cc
1345 lang/core/ir/transform/merge_return_test.cc
1346 lang/core/ir/transform/shader_io_spirv_test.cc
1347 lang/core/ir/transform/var_for_dynamic_index_test.cc
James Price2280cc62023-07-21 03:42:48 +00001348 lang/spirv/writer/access_test.cc
1349 lang/spirv/writer/atomic_builtin_test.cc
1350 lang/spirv/writer/binary_test.cc
1351 lang/spirv/writer/bitcast_test.cc
1352 lang/spirv/writer/builtin_test.cc
1353 lang/spirv/writer/constant_test.cc
1354 lang/spirv/writer/construct_test.cc
1355 lang/spirv/writer/convert_test.cc
1356 lang/spirv/writer/discard_test.cc
1357 lang/spirv/writer/function_test.cc
1358 lang/spirv/writer/if_test.cc
1359 lang/spirv/writer/let_test.cc
1360 lang/spirv/writer/loop_test.cc
1361 lang/spirv/writer/switch_test.cc
1362 lang/spirv/writer/swizzle_test.cc
1363 lang/spirv/writer/test_helper.h
1364 lang/spirv/writer/texture_builtin_test.cc
1365 lang/spirv/writer/type_test.cc
1366 lang/spirv/writer/unary_test.cc
1367 lang/spirv/writer/var_test.cc
1368 lang/spirv/writer/writer_test.cc
James Price8f9ea962023-05-04 01:31:36 +00001369 )
Ben Clayton80416612023-07-24 14:03:34 +00001370
1371 if (${TINT_BUILD_WGSL_WRITER})
1372 list(APPEND TINT_TEST_SRCS
dan sinclair97c37272023-07-24 17:11:53 +00001373 lang/core/ir/transform/rename_conflicts_wgsl_test.cc
Ben Clayton80416612023-07-24 14:03:34 +00001374 )
1375 endif()
James Price8f9ea962023-05-04 01:31:36 +00001376 endif()
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001377 endif()
1378
1379 if(${TINT_BUILD_WGSL_WRITER})
1380 list(APPEND TINT_TEST_SRCS
dan sinclairff6eba52023-07-20 01:14:15 +00001381 lang/wgsl/ast_writer/generator_impl_test.cc
1382 lang/wgsl/ast_writer/generator_impl_alias_type_test.cc
1383 lang/wgsl/ast_writer/generator_impl_array_accessor_test.cc
1384 lang/wgsl/ast_writer/generator_impl_assign_test.cc
1385 lang/wgsl/ast_writer/generator_impl_binary_test.cc
1386 lang/wgsl/ast_writer/generator_impl_bitcast_test.cc
1387 lang/wgsl/ast_writer/generator_impl_block_test.cc
1388 lang/wgsl/ast_writer/generator_impl_break_test.cc
1389 lang/wgsl/ast_writer/generator_impl_call_test.cc
1390 lang/wgsl/ast_writer/generator_impl_case_test.cc
1391 lang/wgsl/ast_writer/generator_impl_cast_test.cc
1392 lang/wgsl/ast_writer/generator_impl_const_assert_test.cc
1393 lang/wgsl/ast_writer/generator_impl_constructor_test.cc
1394 lang/wgsl/ast_writer/generator_impl_continue_test.cc
1395 lang/wgsl/ast_writer/generator_impl_diagnostic_test.cc
1396 lang/wgsl/ast_writer/generator_impl_discard_test.cc
1397 lang/wgsl/ast_writer/generator_impl_enable_test.cc
1398 lang/wgsl/ast_writer/generator_impl_function_test.cc
1399 lang/wgsl/ast_writer/generator_impl_global_decl_test.cc
1400 lang/wgsl/ast_writer/generator_impl_identifier_test.cc
1401 lang/wgsl/ast_writer/generator_impl_if_test.cc
1402 lang/wgsl/ast_writer/generator_impl_loop_test.cc
1403 lang/wgsl/ast_writer/generator_impl_literal_test.cc
1404 lang/wgsl/ast_writer/generator_impl_member_accessor_test.cc
1405 lang/wgsl/ast_writer/generator_impl_return_test.cc
1406 lang/wgsl/ast_writer/generator_impl_switch_test.cc
1407 lang/wgsl/ast_writer/generator_impl_type_test.cc
1408 lang/wgsl/ast_writer/generator_impl_unary_op_test.cc
1409 lang/wgsl/ast_writer/generator_impl_variable_decl_statement_test.cc
1410 lang/wgsl/ast_writer/generator_impl_variable_test.cc
1411 lang/wgsl/ast_writer/test_helper.h
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001412 )
1413 endif()
1414
1415 if(${TINT_BUILD_WGSL_READER} AND ${TINT_BUILD_WGSL_WRITER})
1416 list(APPEND TINT_TEST_SRCS
dan sinclair99181d82023-07-20 01:14:15 +00001417 lang/wgsl/ast/module_clone_test.cc
1418 lang/wgsl/ast/transform/add_empty_entry_point_test.cc
1419 lang/wgsl/ast/transform/add_block_attribute_test.cc
1420 lang/wgsl/ast/transform/array_length_from_uniform_test.cc
1421 lang/wgsl/ast/transform/binding_remapper_test.cc
1422 lang/wgsl/ast/transform/builtin_polyfill_test.cc
1423 lang/wgsl/ast/transform/calculate_array_length_test.cc
1424 lang/wgsl/ast/transform/clamp_frag_depth_test.cc
1425 lang/wgsl/ast/transform/canonicalize_entry_point_io_test.cc
1426 lang/wgsl/ast/transform/combine_samplers_test.cc
1427 lang/wgsl/ast/transform/decompose_memory_access_test.cc
1428 lang/wgsl/ast/transform/decompose_strided_array_test.cc
1429 lang/wgsl/ast/transform/decompose_strided_matrix_test.cc
1430 lang/wgsl/ast/transform/demote_to_helper_test.cc
1431 lang/wgsl/ast/transform/direct_variable_access_test.cc
1432 lang/wgsl/ast/transform/disable_uniformity_analysis_test.cc
1433 lang/wgsl/ast/transform/expand_compound_assignment_test.cc
1434 lang/wgsl/ast/transform/first_index_offset_test.cc
1435 lang/wgsl/ast/transform/fold_trivial_lets_test.cc
1436 lang/wgsl/ast/transform/for_loop_to_loop_test.cc
1437 lang/wgsl/ast/transform/expand_compound_assignment_test.cc
1438 lang/wgsl/ast/transform/localize_struct_array_assignment_test.cc
1439 lang/wgsl/ast/transform/merge_return_test.cc
1440 lang/wgsl/ast/transform/module_scope_var_to_entry_point_param_test.cc
1441 lang/wgsl/ast/transform/multiplanar_external_texture_test.cc
1442 lang/wgsl/ast/transform/num_workgroups_from_uniform_test.cc
1443 lang/wgsl/ast/transform/packed_vec3_test.cc
1444 lang/wgsl/ast/transform/pad_structs_test.cc
1445 lang/wgsl/ast/transform/preserve_padding_test.cc
1446 lang/wgsl/ast/transform/promote_initializers_to_let_test.cc
1447 lang/wgsl/ast/transform/promote_side_effects_to_decl_test.cc
1448 lang/wgsl/ast/transform/remove_continue_in_switch_test.cc
1449 lang/wgsl/ast/transform/remove_phonies_test.cc
1450 lang/wgsl/ast/transform/remove_unreachable_statements_test.cc
1451 lang/wgsl/ast/transform/renamer_test.cc
1452 lang/wgsl/ast/transform/robustness_test.cc
1453 lang/wgsl/ast/transform/simplify_pointers_test.cc
1454 lang/wgsl/ast/transform/single_entry_point_test.cc
1455 lang/wgsl/ast/transform/spirv_atomic_test.cc
1456 lang/wgsl/ast/transform/std140_exhaustive_test.cc
1457 lang/wgsl/ast/transform/std140_f16_test.cc
1458 lang/wgsl/ast/transform/std140_f32_test.cc
1459 lang/wgsl/ast/transform/std140_test.cc
1460 lang/wgsl/ast/transform/substitute_override_test.cc
1461 lang/wgsl/ast/transform/test_helper.h
1462 lang/wgsl/ast/transform/texture_1d_to_2d_test.cc
1463 lang/wgsl/ast/transform/truncate_interstage_variables_test.cc
1464 lang/wgsl/ast/transform/unshadow_test.cc
1465 lang/wgsl/ast/transform/var_for_dynamic_index_test.cc
1466 lang/wgsl/ast/transform/vectorize_matrix_conversions_test.cc
1467 lang/wgsl/ast/transform/vectorize_scalar_matrix_initializers_test.cc
1468 lang/wgsl/ast/transform/vertex_pulling_test.cc
1469 lang/wgsl/ast/transform/while_to_loop_test.cc
1470 lang/wgsl/ast/transform/zero_init_workgroup_memory_test.cc
1471 lang/wgsl/ast/transform/utils/get_insertion_point_test.cc
1472 lang/wgsl/ast/transform/utils/hoist_to_decl_before_test.cc
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001473 )
1474 endif()
1475
1476 if(${TINT_BUILD_MSL_WRITER})
1477 list(APPEND TINT_TEST_SRCS
dan sinclaird5575ce2023-07-20 01:14:15 +00001478 lang/msl/ast_writer/generator_impl_array_accessor_test.cc
1479 lang/msl/ast_writer/generator_impl_assign_test.cc
1480 lang/msl/ast_writer/generator_impl_binary_test.cc
1481 lang/msl/ast_writer/generator_impl_bitcast_test.cc
1482 lang/msl/ast_writer/generator_impl_block_test.cc
1483 lang/msl/ast_writer/generator_impl_break_test.cc
1484 lang/msl/ast_writer/generator_impl_builtin_test.cc
1485 lang/msl/ast_writer/generator_impl_builtin_texture_test.cc
1486 lang/msl/ast_writer/generator_impl_call_test.cc
1487 lang/msl/ast_writer/generator_impl_case_test.cc
1488 lang/msl/ast_writer/generator_impl_cast_test.cc
1489 lang/msl/ast_writer/generator_impl_const_assert_test.cc
1490 lang/msl/ast_writer/generator_impl_constructor_test.cc
1491 lang/msl/ast_writer/generator_impl_continue_test.cc
1492 lang/msl/ast_writer/generator_impl_discard_test.cc
1493 lang/msl/ast_writer/generator_impl_function_test.cc
1494 lang/msl/ast_writer/generator_impl_identifier_test.cc
1495 lang/msl/ast_writer/generator_impl_if_test.cc
1496 lang/msl/ast_writer/generator_impl_import_test.cc
1497 lang/msl/ast_writer/generator_impl_loop_test.cc
1498 lang/msl/ast_writer/generator_impl_member_accessor_test.cc
1499 lang/msl/ast_writer/generator_impl_module_constant_test.cc
1500 lang/msl/ast_writer/generator_impl_return_test.cc
1501 lang/msl/ast_writer/generator_impl_sanitizer_test.cc
1502 lang/msl/ast_writer/generator_impl_switch_test.cc
1503 lang/msl/ast_writer/generator_impl_test.cc
1504 lang/msl/ast_writer/generator_impl_type_test.cc
1505 lang/msl/ast_writer/generator_impl_unary_op_test.cc
1506 lang/msl/ast_writer/generator_impl_variable_decl_statement_test.cc
1507 lang/msl/ast_writer/generator_support_test.cc
1508 lang/msl/ast_writer/test_helper.h
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001509 )
dan sinclaircadd0c02023-06-26 13:50:42 +00001510
1511 if(${TINT_BUILD_IR})
1512 list(APPEND TINT_TEST_SRCS
dan sinclaird5575ce2023-07-20 01:14:15 +00001513 lang/msl/writer/generator_impl_ir_constant_test.cc
1514 lang/msl/writer/generator_impl_ir_function_test.cc
1515 lang/msl/writer/generator_impl_ir_type_test.cc
1516 lang/msl/writer/test_helper_ir.h
dan sinclaircadd0c02023-06-26 13:50:42 +00001517 )
1518 endif()
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001519 endif()
1520
1521 if (${TINT_BUILD_GLSL_WRITER})
1522 list(APPEND TINT_TEST_SRCS
dan sinclair8046fbb2023-07-20 01:14:15 +00001523 lang/glsl/ast_writer/generator_impl_array_accessor_test.cc
1524 lang/glsl/ast_writer/generator_impl_assign_test.cc
1525 lang/glsl/ast_writer/generator_impl_binary_test.cc
1526 lang/glsl/ast_writer/generator_impl_bitcast_test.cc
1527 lang/glsl/ast_writer/generator_impl_block_test.cc
1528 lang/glsl/ast_writer/generator_impl_break_test.cc
1529 lang/glsl/ast_writer/generator_impl_builtin_test.cc
1530 lang/glsl/ast_writer/generator_impl_builtin_texture_test.cc
1531 lang/glsl/ast_writer/generator_impl_call_test.cc
1532 lang/glsl/ast_writer/generator_impl_case_test.cc
1533 lang/glsl/ast_writer/generator_impl_cast_test.cc
1534 lang/glsl/ast_writer/generator_impl_constructor_test.cc
1535 lang/glsl/ast_writer/generator_impl_continue_test.cc
1536 lang/glsl/ast_writer/generator_impl_discard_test.cc
1537 lang/glsl/ast_writer/generator_impl_function_test.cc
1538 lang/glsl/ast_writer/generator_impl_identifier_test.cc
1539 lang/glsl/ast_writer/generator_impl_if_test.cc
1540 lang/glsl/ast_writer/generator_impl_import_test.cc
1541 lang/glsl/ast_writer/generator_impl_loop_test.cc
1542 lang/glsl/ast_writer/generator_impl_member_accessor_test.cc
1543 lang/glsl/ast_writer/generator_impl_module_constant_test.cc
1544 lang/glsl/ast_writer/generator_impl_return_test.cc
1545 lang/glsl/ast_writer/generator_impl_sanitizer_test.cc
1546 lang/glsl/ast_writer/generator_impl_storage_buffer_test.cc
1547 lang/glsl/ast_writer/generator_impl_switch_test.cc
1548 lang/glsl/ast_writer/generator_impl_test.cc
1549 lang/glsl/ast_writer/generator_impl_type_test.cc
1550 lang/glsl/ast_writer/generator_impl_unary_op_test.cc
1551 lang/glsl/ast_writer/generator_impl_uniform_buffer_test.cc
1552 lang/glsl/ast_writer/generator_impl_variable_decl_statement_test.cc
1553 lang/glsl/ast_writer/generator_impl_workgroup_var_test.cc
1554 lang/glsl/ast_writer/test_helper.h
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001555 )
1556 endif()
1557
1558 if (${TINT_BUILD_HLSL_WRITER})
1559 list(APPEND TINT_TEST_SRCS
dan sinclair5fbe1f62023-07-20 01:14:15 +00001560 lang/hlsl/ast_writer/generator_impl_array_accessor_test.cc
1561 lang/hlsl/ast_writer/generator_impl_assign_test.cc
1562 lang/hlsl/ast_writer/generator_impl_binary_test.cc
1563 lang/hlsl/ast_writer/generator_impl_bitcast_test.cc
1564 lang/hlsl/ast_writer/generator_impl_block_test.cc
1565 lang/hlsl/ast_writer/generator_impl_break_test.cc
1566 lang/hlsl/ast_writer/generator_impl_builtin_test.cc
1567 lang/hlsl/ast_writer/generator_impl_builtin_texture_test.cc
1568 lang/hlsl/ast_writer/generator_impl_call_test.cc
1569 lang/hlsl/ast_writer/generator_impl_case_test.cc
1570 lang/hlsl/ast_writer/generator_impl_cast_test.cc
1571 lang/hlsl/ast_writer/generator_impl_const_assert_test.cc
1572 lang/hlsl/ast_writer/generator_impl_constructor_test.cc
1573 lang/hlsl/ast_writer/generator_impl_continue_test.cc
1574 lang/hlsl/ast_writer/generator_impl_discard_test.cc
1575 lang/hlsl/ast_writer/generator_impl_function_test.cc
1576 lang/hlsl/ast_writer/generator_impl_identifier_test.cc
1577 lang/hlsl/ast_writer/generator_impl_if_test.cc
1578 lang/hlsl/ast_writer/generator_impl_import_test.cc
1579 lang/hlsl/ast_writer/generator_impl_loop_test.cc
1580 lang/hlsl/ast_writer/generator_impl_member_accessor_test.cc
1581 lang/hlsl/ast_writer/generator_impl_module_constant_test.cc
1582 lang/hlsl/ast_writer/generator_impl_return_test.cc
1583 lang/hlsl/ast_writer/generator_impl_sanitizer_test.cc
1584 lang/hlsl/ast_writer/generator_impl_switch_test.cc
1585 lang/hlsl/ast_writer/generator_impl_test.cc
1586 lang/hlsl/ast_writer/generator_impl_type_test.cc
1587 lang/hlsl/ast_writer/generator_impl_unary_op_test.cc
1588 lang/hlsl/ast_writer/generator_impl_variable_decl_statement_test.cc
1589 lang/hlsl/ast_writer/generator_impl_workgroup_var_test.cc
1590 lang/hlsl/ast_writer/test_helper.h
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001591 )
1592 endif()
1593
dan sinclair92612612022-11-01 18:15:50 +00001594 if (${TINT_BUILD_IR})
1595 list(APPEND TINT_TEST_SRCS
dan sinclair97c37272023-07-24 17:11:53 +00001596 lang/core/ir/access_test.cc
1597 lang/core/ir/binary_test.cc
1598 lang/core/ir/bitcast_test.cc
1599 lang/core/ir/block_param_test.cc
1600 lang/core/ir/block_test.cc
1601 lang/core/ir/break_if_test.cc
1602 lang/core/ir/constant_test.cc
1603 lang/core/ir/construct_test.cc
1604 lang/core/ir/continue_test.cc
1605 lang/core/ir/convert_test.cc
1606 lang/core/ir/core_builtin_call_test.cc
1607 lang/core/ir/discard_test.cc
1608 lang/core/ir/exit_if_test.cc
1609 lang/core/ir/exit_loop_test.cc
1610 lang/core/ir/exit_switch_test.cc
1611 lang/core/ir/from_program_accessor_test.cc
1612 lang/core/ir/from_program_binary_test.cc
1613 lang/core/ir/from_program_builtin_test.cc
1614 lang/core/ir/from_program_call_test.cc
1615 lang/core/ir/from_program_function_test.cc
1616 lang/core/ir/from_program_let_test.cc
1617 lang/core/ir/from_program_literal_test.cc
1618 lang/core/ir/from_program_materialize_test.cc
1619 lang/core/ir/from_program_store_test.cc
1620 lang/core/ir/from_program_test.cc
1621 lang/core/ir/from_program_unary_test.cc
1622 lang/core/ir/from_program_var_test.cc
1623 lang/core/ir/function_param_test.cc
1624 lang/core/ir/function_test.cc
1625 lang/core/ir/if_test.cc
1626 lang/core/ir/instruction_result_test.cc
1627 lang/core/ir/instruction_test.cc
1628 lang/core/ir/intrinsic_call_test.cc
1629 lang/core/ir/ir_test_helper.h
1630 lang/core/ir/let_test.cc
1631 lang/core/ir/load_test.cc
1632 lang/core/ir/load_vector_element_test.cc
1633 lang/core/ir/loop_test.cc
1634 lang/core/ir/module_test.cc
1635 lang/core/ir/multi_in_block_test.cc
1636 lang/core/ir/next_iteration_test.cc
1637 lang/core/ir/operand_instruction_test.cc
1638 lang/core/ir/program_test_helper.h
1639 lang/core/ir/return_test.cc
1640 lang/core/ir/store_test.cc
1641 lang/core/ir/store_vector_element_test.cc
1642 lang/core/ir/switch_test.cc
1643 lang/core/ir/swizzle_test.cc
1644 lang/core/ir/transform/add_empty_entry_point_test.cc
1645 lang/core/ir/transform/block_decorated_structs_test.cc
1646 lang/core/ir/transform/demote_to_helper_test.cc
1647 lang/core/ir/unary_test.cc
1648 lang/core/ir/user_call_test.cc
1649 lang/core/ir/validator_test.cc
1650 lang/core/ir/value_test.cc
1651 lang/core/ir/var_test.cc
dan sinclair92612612022-11-01 18:15:50 +00001652 )
1653 endif()
1654
Ben Clayton9940c7b2023-05-16 22:07:39 +00001655 if (${TINT_BUILD_IR} AND ${TINT_BUILD_WGSL_READER} AND ${TINT_BUILD_WGSL_WRITER})
1656 list(APPEND TINT_TEST_SRCS
dan sinclair97c37272023-07-24 17:11:53 +00001657 lang/core/ir/to_program_roundtrip_test.cc
Ben Clayton9940c7b2023-05-16 22:07:39 +00001658 )
1659 endif()
1660
Ben Claytonfa5a1d92023-07-21 12:29:08 +00001661 if (${TINT_BUILD_IR} AND ${TINT_BUILD_WGSL_READER})
1662 list(APPEND TINT_TEST_SRCS
dan sinclair97c37272023-07-24 17:11:53 +00001663 lang/core/ir/from_program_shadowing_test.cc
Ben Claytonfa5a1d92023-07-21 12:29:08 +00001664 )
1665 endif()
1666
Ben Clayton7afd2c42023-06-22 17:15:43 +00001667 if (${TINT_BUILD_IR} AND ${TINT_BUILD_WGSL_WRITER})
1668 list(APPEND TINT_TEST_SRCS
dan sinclair97c37272023-07-24 17:11:53 +00001669 lang/core/ir/to_program_inlining_test.cc
1670 lang/core/ir/to_program_test.cc
Ben Clayton7afd2c42023-06-22 17:15:43 +00001671 )
1672 endif()
Ben Clayton9940c7b2023-05-16 22:07:39 +00001673
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001674 if (${TINT_BUILD_FUZZERS})
1675 list(APPEND TINT_TEST_SRCS
1676 fuzzers/mersenne_twister_engine.cc
1677 fuzzers/mersenne_twister_engine.h
1678 fuzzers/random_generator.cc
1679 fuzzers/random_generator.h
1680 fuzzers/random_generator_engine.cc
1681 fuzzers/random_generator_engine.h
1682 fuzzers/random_generator_test.cc
1683 )
1684 endif()
1685
1686 add_executable(tint_unittests ${TINT_TEST_SRCS})
1687 set_target_properties(${target} PROPERTIES FOLDER "Tests")
1688
Ben Claytonba200e82022-11-07 17:24:10 +00001689 if(MSVC)
1690 # TODO(crbug.com/tint/1749): MSVC debug builds can suffer from stack
1691 # overflows when resolving deeply nested expression chains or statements.
1692 # Production builds neither use MSVC nor debug, so just bump the stack size
1693 # for this build combination.
Ben Clayton94181522022-11-09 20:55:33 +00001694 if (IS_DEBUG_BUILD)
1695 target_link_options(tint_unittests PRIVATE "/STACK:4194304") # 4MB, default is 1MB
Ben Claytonba200e82022-11-07 17:24:10 +00001696 endif()
1697 else()
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001698 target_compile_options(tint_unittests PRIVATE
1699 -Wno-global-constructors
1700 -Wno-weak-vtables
1701 )
1702 endif()
1703
1704 ## Test executable
1705 target_include_directories(
1706 tint_unittests PRIVATE ${gmock_SOURCE_DIR}/include)
1707 target_link_libraries(tint_unittests libtint gmock tint_utils_io)
1708 tint_default_compile_options(tint_unittests)
1709
1710 if(${TINT_BUILD_SPV_READER} OR ${TINT_BUILD_SPV_WRITER})
1711 tint_spvtools_compile_options(tint_unittests)
1712 endif()
1713
1714 add_test(NAME tint_unittests COMMAND tint_unittests)
1715endif(TINT_BUILD_TESTS)
1716
1717################################################################################
1718# Benchmarks
1719################################################################################
1720if(TINT_BUILD_BENCHMARKS)
1721 if(NOT TINT_BUILD_WGSL_READER)
1722 message(FATAL_ERROR "TINT_BUILD_BENCHMARKS requires TINT_BUILD_WGSL_READER")
1723 endif()
1724
dan sinclair16b4cf82022-11-03 21:10:40 +00001725 list(APPEND TINT_BENCHMARK_SRCS
dan sinclair22b4dd22023-07-21 00:40:07 +00001726 "utils/rtti/switch_bench.cc"
dan sinclair11cecc12022-11-03 16:28:51 +00001727 "bench/benchmark.cc"
dan sinclair7cf568f2023-07-20 01:14:15 +00001728 "lang/wgsl/reader/parser_bench.cc"
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001729 )
1730
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001731 if (${TINT_BUILD_GLSL_WRITER})
dan sinclair8046fbb2023-07-20 01:14:15 +00001732 list(APPEND TINT_BENCHMARK_SRCS lang/glsl/ast_writer/generator_bench.cc)
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001733 endif()
1734 if (${TINT_BUILD_HLSL_WRITER})
dan sinclair5fbe1f62023-07-20 01:14:15 +00001735 list(APPEND TINT_BENCHMARK_SRCS lang/hlsl/ast_writer/generator_bench.cc)
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001736 endif()
1737 if (${TINT_BUILD_MSL_WRITER})
dan sinclaird5575ce2023-07-20 01:14:15 +00001738 list(APPEND TINT_BENCHMARK_SRCS lang/msl/ast_writer/generator_bench.cc)
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001739 endif()
1740 if (${TINT_BUILD_SPV_WRITER})
James Price74d04a82023-07-20 14:44:22 +00001741 list(APPEND TINT_BENCHMARK_SRCS lang/spirv/ast_writer/generator_bench.cc)
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001742 endif()
1743 if (${TINT_BUILD_WGSL_WRITER})
dan sinclairff6eba52023-07-20 01:14:15 +00001744 list(APPEND TINT_BENCHMARK_SRCS lang/wgsl/ast_writer/generator_bench.cc)
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001745 endif()
1746
dan sinclair16b4cf82022-11-03 21:10:40 +00001747 add_executable(tint-benchmark ${TINT_BENCHMARK_SRCS})
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001748 set_target_properties(${target} PROPERTIES FOLDER "Benchmarks")
1749
1750 tint_core_compile_options(tint-benchmark)
1751
1752 target_link_libraries(tint-benchmark PRIVATE benchmark::benchmark libtint)
Ben Clayton8fc9b862023-04-19 15:03:19 +00001753
1754 if (TINT_EXTERNAL_BENCHMARK_CORPUS_DIR)
1755 # Glob all the files at TINT_EXTERNAL_BENCHMARK_CORPUS_DIR, and create a header
Ben Clayton1a8bc1d2023-05-14 01:36:30 +00001756 # that lists these with the macros:
1757 # TINT_BENCHMARK_EXTERNAL_WGSL_PROGRAMS()
1758 # TINT_BENCHMARK_EXTERNAL_SPV_PROGRAMS()
Ben Clayton8fc9b862023-04-19 15:03:19 +00001759 set(TINT_BENCHMARK_GEN_DIR "${DAWN_BUILD_GEN_DIR}/src/tint/benchmark/")
Ben Clayton1a8bc1d2023-05-14 01:36:30 +00001760 set(TINT_BENCHMARK_EXTERNAL_SHADERS_HEADER "${TINT_BENCHMARK_GEN_DIR}/external_wgsl_programs.h")
Ben Clayton8fc9b862023-04-19 15:03:19 +00001761 message("Globbing ${TINT_EXTERNAL_BENCHMARK_CORPUS_DIR}...")
Ben Clayton1a8bc1d2023-05-14 01:36:30 +00001762
Ben Clayton8fc9b862023-04-19 15:03:19 +00001763 file(GLOB_RECURSE
Ben Clayton1a8bc1d2023-05-14 01:36:30 +00001764 TINT_EXTERNAL_WGSL_BENCHMARK_FILES
Ben Clayton8fc9b862023-04-19 15:03:19 +00001765 RELATIVE "${TINT_EXTERNAL_BENCHMARK_CORPUS_DIR}"
1766 "${TINT_EXTERNAL_BENCHMARK_CORPUS_DIR}/**.wgsl")
Ben Clayton1a8bc1d2023-05-14 01:36:30 +00001767 list(TRANSFORM TINT_EXTERNAL_WGSL_BENCHMARK_FILES REPLACE
Ben Clayton8fc9b862023-04-19 15:03:19 +00001768 "(.+)"
1769 " BENCHMARK_CAPTURE\(FUNC, \"\\1\", \"${TINT_EXTERNAL_BENCHMARK_CORPUS_DIR}/\\1\")")
Ben Clayton1a8bc1d2023-05-14 01:36:30 +00001770 list(JOIN TINT_EXTERNAL_WGSL_BENCHMARK_FILES "; \\\n" TINT_EXTERNAL_WGSL_BENCHMARK_FILES)
1771
1772 file(GLOB_RECURSE
1773 TINT_EXTERNAL_SPV_BENCHMARK_FILES
1774 RELATIVE "${TINT_EXTERNAL_BENCHMARK_CORPUS_DIR}"
1775 "${TINT_EXTERNAL_BENCHMARK_CORPUS_DIR}/**.spv")
1776
1777 list(TRANSFORM TINT_EXTERNAL_SPV_BENCHMARK_FILES REPLACE
1778 "(.+)"
1779 " BENCHMARK_CAPTURE\(FUNC, \"\\1\", \"${TINT_EXTERNAL_BENCHMARK_CORPUS_DIR}/\\1\")")
1780 list(JOIN TINT_EXTERNAL_SPV_BENCHMARK_FILES "; \\\n" TINT_EXTERNAL_SPV_BENCHMARK_FILES)
1781
Ben Clayton8fc9b862023-04-19 15:03:19 +00001782 file(CONFIGURE
Ben Clayton1a8bc1d2023-05-14 01:36:30 +00001783 OUTPUT "${TINT_BENCHMARK_EXTERNAL_SHADERS_HEADER}"
1784 CONTENT "
1785#define TINT_BENCHMARK_EXTERNAL_WGSL_PROGRAMS(FUNC) \\
1786${TINT_EXTERNAL_WGSL_BENCHMARK_FILES};
1787
1788#define TINT_BENCHMARK_EXTERNAL_SPV_PROGRAMS(FUNC) \\
1789${TINT_EXTERNAL_SPV_BENCHMARK_FILES};")
1790 # Define TINT_BENCHMARK_EXTERNAL_SHADERS_HEADER to the generated header path
Ben Clayton8fc9b862023-04-19 15:03:19 +00001791 target_compile_definitions(tint-benchmark PRIVATE
Ben Clayton1a8bc1d2023-05-14 01:36:30 +00001792 "TINT_BENCHMARK_EXTERNAL_SHADERS_HEADER=\"${TINT_BENCHMARK_EXTERNAL_SHADERS_HEADER}\"")
Ben Clayton8fc9b862023-04-19 15:03:19 +00001793 endif()
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001794endif(TINT_BUILD_BENCHMARKS)