blob: 648cf17c771e6bf7a432903cc02a4f4db77c4111 [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")
16import("../../tint_overrides_with_defaults.gni")
17
18###############################################################################
19# Common - Configs, etc. shared across targets
20###############################################################################
21
22config("tint_common_config") {
23 include_dirs = [
24 "${target_gen_dir}",
25 "${tint_root_dir}/",
26 "${tint_spirv_headers_dir}/include",
27 "${tint_spirv_tools_dir}/",
28 "${tint_spirv_tools_dir}/include",
29 ]
30}
31
32config("tint_public_config") {
33 defines = []
34 if (tint_build_spv_reader) {
35 defines += [ "TINT_BUILD_SPV_READER=1" ]
36 } else {
37 defines += [ "TINT_BUILD_SPV_READER=0" ]
38 }
39
40 if (tint_build_spv_writer) {
41 defines += [ "TINT_BUILD_SPV_WRITER=1" ]
42 } else {
43 defines += [ "TINT_BUILD_SPV_WRITER=0" ]
44 }
45
46 if (tint_build_wgsl_reader) {
47 defines += [ "TINT_BUILD_WGSL_READER=1" ]
48 } else {
49 defines += [ "TINT_BUILD_WGSL_READER=0" ]
50 }
51
52 if (tint_build_wgsl_writer) {
53 defines += [ "TINT_BUILD_WGSL_WRITER=1" ]
54 } else {
55 defines += [ "TINT_BUILD_WGSL_WRITER=0" ]
56 }
57
58 if (tint_build_msl_writer) {
59 defines += [ "TINT_BUILD_MSL_WRITER=1" ]
60 } else {
61 defines += [ "TINT_BUILD_MSL_WRITER=0" ]
62 }
63
64 if (tint_build_hlsl_writer) {
65 defines += [ "TINT_BUILD_HLSL_WRITER=1" ]
66 } else {
67 defines += [ "TINT_BUILD_HLSL_WRITER=0" ]
68 }
69
70 if (tint_build_glsl_writer) {
71 defines += [ "TINT_BUILD_GLSL_WRITER=1" ]
72 } else {
73 defines += [ "TINT_BUILD_GLSL_WRITER=0" ]
74 }
75
76 include_dirs = [
77 "${tint_root_dir}/",
78 "${tint_root_dir}/include/",
79 "${tint_spirv_headers_dir}/include",
80 ]
81}
82
83config("tint_config") {
84 include_dirs = []
85 if (tint_build_spv_reader || tint_build_spv_writer) {
86 include_dirs += [ "${tint_spirv_tools_dir}/include/" ]
87 }
88}
89
90###############################################################################
91# Helper library for IO operations
92# Only to be used by tests and sample executable
93###############################################################################
94source_set("tint_utils_io") {
95 sources = [
96 "utils/io/command.h",
97 "utils/io/tmpfile.h",
98 ]
99
100 if (is_linux || is_mac) {
101 sources += [ "utils/io/command_posix.cc" ]
102 sources += [ "utils/io/tmpfile_posix.cc" ]
103 } else if (is_win) {
104 sources += [ "utils/io/command_windows.cc" ]
105 sources += [ "utils/io/tmpfile_windows.cc" ]
106 } else {
107 sources += [ "utils/io/command_other.cc" ]
108 sources += [ "utils/io/tmpfile_other.cc" ]
109 }
110
111 public_deps = [ ":libtint_core_all_src" ]
112}
113
114###############################################################################
115# Helper library for validating generated shaders
116# As this depends on tint_utils_io, this is only to be used by tests and sample
117# executable
118###############################################################################
119source_set("tint_val") {
120 sources = [
121 "val/hlsl.cc",
122 "val/msl.cc",
123 "val/val.h",
124 ]
125 public_deps = [ ":tint_utils_io" ]
126}
127
128###############################################################################
129# Library - Tint core and optional modules of libtint
130###############################################################################
131# libtint source sets are divided into a non-optional core in :libtint_core_src
132# and optional :libtint_*_src subsets, because ninja does not like having
133# multiple source files with the same name, like function.cc, in the same
134# source set
135# target.
136#
137# Targets that want to use tint as a library should depend on ":libtint" and
138# use the build flags to control what is included, instead of trying to specify
139# the subsets that they want.
140
141template("libtint_source_set") {
142 source_set(target_name) {
143 forward_variables_from(invoker, "*", [ "configs" ])
144
145 if (!defined(invoker.deps)) {
146 deps = []
147 }
148 deps += [
149 "${tint_spirv_headers_dir}:spv_headers",
150 "${tint_spirv_tools_dir}:spvtools_core_enums_unified1",
151 "${tint_spirv_tools_dir}:spvtools_core_tables_unified1",
152 "${tint_spirv_tools_dir}:spvtools_headers",
153 "${tint_spirv_tools_dir}:spvtools_language_header_cldebuginfo100",
154 "${tint_spirv_tools_dir}:spvtools_language_header_debuginfo",
155 "${tint_spirv_tools_dir}:spvtools_language_header_vkdebuginfo100",
156 ]
157
158 if (defined(invoker.configs)) {
159 configs += invoker.configs
160 }
161 configs += [ ":tint_common_config" ]
162 if (build_with_chromium) {
163 configs -= [ "//build/config/compiler:chromium_code" ]
164 configs += [ "//build/config/compiler:no_chromium_code" ]
165 }
166
167 if (!defined(invoker.public_configs)) {
168 public_configs = []
169 }
170 public_configs += [ ":tint_public_config" ]
171 }
172}
173
174libtint_source_set("libtint_core_all_src") {
175 sources = [
176 "ast/access.cc",
177 "ast/access.h",
178 "ast/alias.cc",
179 "ast/alias.h",
180 "ast/array.cc",
181 "ast/array.h",
182 "ast/assignment_statement.cc",
183 "ast/assignment_statement.h",
184 "ast/ast_type.cc", # TODO(bclayton) - rename to type.cc
185 "ast/atomic.cc",
186 "ast/atomic.h",
187 "ast/attribute.cc",
188 "ast/attribute.h",
189 "ast/binary_expression.cc",
190 "ast/binary_expression.h",
191 "ast/binding_attribute.cc",
192 "ast/binding_attribute.h",
193 "ast/bitcast_expression.cc",
194 "ast/bitcast_expression.h",
195 "ast/block_statement.cc",
196 "ast/block_statement.h",
197 "ast/bool.cc",
198 "ast/bool.h",
199 "ast/bool_literal_expression.cc",
200 "ast/bool_literal_expression.h",
201 "ast/break_statement.cc",
202 "ast/break_statement.h",
203 "ast/builtin.cc",
204 "ast/builtin.h",
205 "ast/builtin_attribute.cc",
206 "ast/builtin_attribute.h",
207 "ast/call_expression.cc",
208 "ast/call_expression.h",
209 "ast/call_statement.cc",
210 "ast/call_statement.h",
211 "ast/case_statement.cc",
212 "ast/case_statement.h",
James Price49241862022-03-31 22:30:10 +0000213 "ast/compound_assignment_statement.cc",
214 "ast/compound_assignment_statement.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000215 "ast/continue_statement.cc",
216 "ast/continue_statement.h",
217 "ast/depth_multisampled_texture.cc",
218 "ast/depth_multisampled_texture.h",
219 "ast/depth_texture.cc",
220 "ast/depth_texture.h",
221 "ast/disable_validation_attribute.cc",
222 "ast/disable_validation_attribute.h",
223 "ast/discard_statement.cc",
224 "ast/discard_statement.h",
Zhaoming Jiang7098d3d2022-04-27 02:27:52 +0000225 "ast/enable.cc",
226 "ast/enable.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000227 "ast/expression.cc",
228 "ast/expression.h",
Ben Clayton7f2b8cd2022-05-18 22:41:48 +0000229 "ast/extension.cc",
230 "ast/extension.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000231 "ast/external_texture.cc",
232 "ast/external_texture.h",
Zhaoming Jiang62bfd312022-05-13 12:01:11 +0000233 "ast/f16.cc",
234 "ast/f16.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000235 "ast/f32.cc",
236 "ast/f32.h",
237 "ast/fallthrough_statement.cc",
238 "ast/fallthrough_statement.h",
239 "ast/float_literal_expression.cc",
240 "ast/float_literal_expression.h",
241 "ast/for_loop_statement.cc",
242 "ast/for_loop_statement.h",
243 "ast/function.cc",
244 "ast/function.h",
245 "ast/group_attribute.cc",
246 "ast/group_attribute.h",
247 "ast/i32.cc",
248 "ast/i32.h",
249 "ast/id_attribute.cc",
250 "ast/id_attribute.h",
251 "ast/identifier_expression.cc",
252 "ast/identifier_expression.h",
253 "ast/if_statement.cc",
254 "ast/if_statement.h",
James Priceebe97412022-04-07 13:42:45 +0000255 "ast/increment_decrement_statement.cc",
256 "ast/increment_decrement_statement.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000257 "ast/index_accessor_expression.cc",
258 "ast/index_accessor_expression.h",
259 "ast/int_literal_expression.cc",
260 "ast/int_literal_expression.h",
261 "ast/internal_attribute.cc",
262 "ast/internal_attribute.h",
263 "ast/interpolate_attribute.cc",
264 "ast/interpolate_attribute.h",
265 "ast/invariant_attribute.cc",
266 "ast/invariant_attribute.h",
267 "ast/literal_expression.cc",
268 "ast/literal_expression.h",
269 "ast/location_attribute.cc",
270 "ast/location_attribute.h",
271 "ast/loop_statement.cc",
272 "ast/loop_statement.h",
273 "ast/matrix.cc",
274 "ast/matrix.h",
275 "ast/member_accessor_expression.cc",
276 "ast/member_accessor_expression.h",
277 "ast/module.cc",
278 "ast/module.h",
279 "ast/multisampled_texture.cc",
280 "ast/multisampled_texture.h",
281 "ast/node.cc",
282 "ast/node.h",
283 "ast/phony_expression.cc",
284 "ast/phony_expression.h",
285 "ast/pipeline_stage.cc",
286 "ast/pipeline_stage.h",
287 "ast/pointer.cc",
288 "ast/pointer.h",
289 "ast/return_statement.cc",
290 "ast/return_statement.h",
291 "ast/sampled_texture.cc",
292 "ast/sampled_texture.h",
293 "ast/sampler.cc",
294 "ast/sampler.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000295 "ast/stage_attribute.cc",
296 "ast/stage_attribute.h",
297 "ast/statement.cc",
298 "ast/statement.h",
299 "ast/storage_class.cc",
300 "ast/storage_class.h",
301 "ast/storage_texture.cc",
302 "ast/storage_texture.h",
303 "ast/stride_attribute.cc",
304 "ast/stride_attribute.h",
305 "ast/struct.cc",
306 "ast/struct.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000307 "ast/struct_member.cc",
308 "ast/struct_member.h",
309 "ast/struct_member_align_attribute.cc",
310 "ast/struct_member_align_attribute.h",
311 "ast/struct_member_offset_attribute.cc",
312 "ast/struct_member_offset_attribute.h",
313 "ast/struct_member_size_attribute.cc",
314 "ast/struct_member_size_attribute.h",
315 "ast/switch_statement.cc",
316 "ast/switch_statement.h",
317 "ast/texture.cc",
318 "ast/texture.h",
319 "ast/traverse_expressions.h",
320 "ast/type.h",
321 "ast/type_decl.cc",
322 "ast/type_decl.h",
323 "ast/type_name.cc",
324 "ast/type_name.h",
325 "ast/u32.cc",
326 "ast/u32.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000327 "ast/unary_op.cc",
328 "ast/unary_op.h",
329 "ast/unary_op_expression.cc",
330 "ast/unary_op_expression.h",
331 "ast/variable.cc",
332 "ast/variable.h",
333 "ast/variable_decl_statement.cc",
334 "ast/variable_decl_statement.h",
335 "ast/vector.cc",
336 "ast/vector.h",
337 "ast/void.cc",
338 "ast/void.h",
dan sinclair49d1a2d2022-06-16 12:01:27 +0000339 "ast/while_statement.cc",
340 "ast/while_statement.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000341 "ast/workgroup_attribute.cc",
342 "ast/workgroup_attribute.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000343 "castable.cc",
344 "castable.h",
345 "clone_context.cc",
346 "clone_context.h",
347 "debug.cc",
348 "debug.h",
349 "demangler.cc",
350 "demangler.h",
351 "diagnostic/diagnostic.cc",
352 "diagnostic/diagnostic.h",
353 "diagnostic/formatter.cc",
354 "diagnostic/formatter.h",
355 "diagnostic/printer.cc",
356 "diagnostic/printer.h",
357 "inspector/entry_point.cc",
358 "inspector/entry_point.h",
359 "inspector/inspector.cc",
360 "inspector/inspector.h",
361 "inspector/resource_binding.cc",
362 "inspector/resource_binding.h",
363 "inspector/scalar.cc",
364 "inspector/scalar.h",
Ben Claytonc2eccfc2022-05-25 15:04:24 +0000365 "number.cc",
Zhaoming Jiang62bfd312022-05-13 12:01:11 +0000366 "number.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000367 "program.cc",
368 "program.h",
369 "program_builder.cc",
370 "program_builder.h",
371 "program_id.cc",
372 "program_id.h",
373 "reader/reader.cc",
374 "reader/reader.h",
Ben Clayton451eee02022-06-01 23:57:20 +0000375 "resolver/const_eval.cc",
376 "resolver/const_eval.h",
Ben Clayton6ae608c2022-05-16 20:54:42 +0000377 "resolver/ctor_conv_intrinsic.cc",
378 "resolver/ctor_conv_intrinsic.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000379 "resolver/dependency_graph.cc",
380 "resolver/dependency_graph.h",
Ben Claytone1325162022-05-06 15:13:01 +0000381 "resolver/intrinsic_table.cc",
382 "resolver/intrinsic_table.h",
383 "resolver/intrinsic_table.inl",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000384 "resolver/resolver.cc",
385 "resolver/resolver.h",
386 "resolver/resolver_constants.cc",
dan sinclairbb62ef02022-04-19 15:00:44 +0000387 "resolver/sem_helper.cc",
388 "resolver/sem_helper.h",
James Pricebe656f72022-05-11 22:05:15 +0000389 "resolver/uniformity.cc",
390 "resolver/uniformity.h",
dan sinclairf05575b2022-04-21 13:40:16 +0000391 "resolver/validator.cc",
392 "resolver/validator.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000393 "scope_stack.h",
Ben Clayton23696b12022-05-18 21:56:28 +0000394 "sem/abstract_float.h",
395 "sem/abstract_int.h",
396 "sem/abstract_numeric.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000397 "sem/array.h",
Ben Clayton01004b72022-04-28 18:49:04 +0000398 "sem/atomic.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000399 "sem/behavior.h",
400 "sem/binding_point.h",
Ben Clayton01004b72022-04-28 18:49:04 +0000401 "sem/bool.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000402 "sem/builtin.h",
403 "sem/builtin_type.h",
404 "sem/call.h",
405 "sem/call_target.h",
406 "sem/constant.h",
Ben Clayton01004b72022-04-28 18:49:04 +0000407 "sem/depth_multisampled_texture.h",
408 "sem/depth_texture.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000409 "sem/expression.h",
Ben Clayton01004b72022-04-28 18:49:04 +0000410 "sem/external_texture.h",
Zhaoming Jiang62bfd312022-05-13 12:01:11 +0000411 "sem/f16.h",
Ben Clayton01004b72022-04-28 18:49:04 +0000412 "sem/f32.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000413 "sem/for_loop_statement.h",
Ben Clayton01004b72022-04-28 18:49:04 +0000414 "sem/i32.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000415 "sem/if_statement.h",
416 "sem/info.h",
417 "sem/loop_statement.h",
Ben Clayton932418e2022-05-24 21:42:03 +0000418 "sem/materialize.h",
Ben Clayton01004b72022-04-28 18:49:04 +0000419 "sem/matrix.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000420 "sem/module.h",
Ben Clayton01004b72022-04-28 18:49:04 +0000421 "sem/multisampled_texture.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000422 "sem/node.h",
423 "sem/parameter_usage.h",
424 "sem/pipeline_stage_set.h",
Ben Clayton01004b72022-04-28 18:49:04 +0000425 "sem/pointer.h",
426 "sem/reference.h",
427 "sem/sampled_texture.h",
Ben Clayton01004b72022-04-28 18:49:04 +0000428 "sem/sampler.h",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000429 "sem/sampler_texture_pair.h",
Ben Clayton01004b72022-04-28 18:49:04 +0000430 "sem/storage_texture.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000431 "sem/switch_statement.h",
Ben Clayton01004b72022-04-28 18:49:04 +0000432 "sem/texture.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000433 "sem/type.h",
434 "sem/type_constructor.h",
435 "sem/type_conversion.h",
436 "sem/type_manager.h",
437 "sem/type_mappings.h",
Ben Clayton01004b72022-04-28 18:49:04 +0000438 "sem/u32.h",
439 "sem/vector.h",
440 "sem/void.h",
dan sinclair49d1a2d2022-06-16 12:01:27 +0000441 "sem/while_statement.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000442 "source.cc",
443 "source.h",
444 "symbol.cc",
445 "symbol.h",
446 "symbol_table.cc",
447 "symbol_table.h",
448 "text/unicode.cc",
449 "text/unicode.h",
450 "traits.h",
451 "transform/add_empty_entry_point.cc",
452 "transform/add_empty_entry_point.h",
453 "transform/add_spirv_block_attribute.cc",
454 "transform/add_spirv_block_attribute.h",
455 "transform/array_length_from_uniform.cc",
456 "transform/array_length_from_uniform.h",
457 "transform/binding_remapper.cc",
458 "transform/binding_remapper.h",
Ben Clayton27aa57c2022-02-22 23:13:39 +0000459 "transform/builtin_polyfill.cc",
460 "transform/builtin_polyfill.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000461 "transform/calculate_array_length.cc",
462 "transform/calculate_array_length.h",
463 "transform/canonicalize_entry_point_io.cc",
464 "transform/canonicalize_entry_point_io.h",
465 "transform/combine_samplers.cc",
466 "transform/combine_samplers.h",
467 "transform/decompose_memory_access.cc",
468 "transform/decompose_memory_access.h",
469 "transform/decompose_strided_array.cc",
470 "transform/decompose_strided_array.h",
471 "transform/decompose_strided_matrix.cc",
472 "transform/decompose_strided_matrix.h",
James Price791b4352022-05-11 13:50:33 +0000473 "transform/disable_uniformity_analysis.cc",
474 "transform/disable_uniformity_analysis.h",
Corentin Wallezb28d6c82022-04-07 11:36:06 +0000475 "transform/expand_compound_assignment.cc",
476 "transform/expand_compound_assignment.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000477 "transform/first_index_offset.cc",
478 "transform/first_index_offset.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000479 "transform/fold_trivial_single_use_lets.cc",
480 "transform/fold_trivial_single_use_lets.h",
481 "transform/for_loop_to_loop.cc",
482 "transform/for_loop_to_loop.h",
483 "transform/localize_struct_array_assignment.cc",
484 "transform/localize_struct_array_assignment.h",
485 "transform/loop_to_for_loop.cc",
486 "transform/loop_to_for_loop.h",
487 "transform/manager.cc",
488 "transform/manager.h",
489 "transform/module_scope_var_to_entry_point_param.cc",
490 "transform/module_scope_var_to_entry_point_param.h",
491 "transform/multiplanar_external_texture.cc",
492 "transform/multiplanar_external_texture.h",
493 "transform/num_workgroups_from_uniform.cc",
494 "transform/num_workgroups_from_uniform.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000495 "transform/promote_initializers_to_const_var.cc",
496 "transform/promote_initializers_to_const_var.h",
Antonio Maioranoc25ddf42022-03-15 15:03:03 +0000497 "transform/promote_side_effects_to_decl.cc",
498 "transform/promote_side_effects_to_decl.h",
Antonio Maioranob3497102022-03-31 15:02:25 +0000499 "transform/remove_continue_in_switch.cc",
500 "transform/remove_continue_in_switch.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000501 "transform/remove_phonies.cc",
502 "transform/remove_phonies.h",
503 "transform/remove_unreachable_statements.cc",
504 "transform/remove_unreachable_statements.h",
505 "transform/renamer.cc",
506 "transform/renamer.h",
507 "transform/robustness.cc",
508 "transform/robustness.h",
509 "transform/simplify_pointers.cc",
510 "transform/simplify_pointers.h",
511 "transform/single_entry_point.cc",
512 "transform/single_entry_point.h",
513 "transform/transform.cc",
514 "transform/transform.h",
515 "transform/unshadow.cc",
516 "transform/unshadow.h",
Antonio Maiorano66d66682022-03-28 20:51:32 +0000517 "transform/unwind_discard_functions.cc",
518 "transform/unwind_discard_functions.h",
Antonio Maioranoc2e9bb72022-03-30 20:11:35 +0000519 "transform/utils/get_insertion_point.cc",
520 "transform/utils/get_insertion_point.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000521 "transform/utils/hoist_to_decl_before.cc",
522 "transform/utils/hoist_to_decl_before.h",
523 "transform/var_for_dynamic_index.cc",
524 "transform/var_for_dynamic_index.h",
525 "transform/vectorize_scalar_matrix_constructors.cc",
526 "transform/vectorize_scalar_matrix_constructors.h",
527 "transform/vertex_pulling.cc",
528 "transform/vertex_pulling.h",
dan sinclair49d1a2d2022-06-16 12:01:27 +0000529 "transform/while_to_loop.cc",
530 "transform/while_to_loop.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000531 "transform/wrap_arrays_in_structs.cc",
532 "transform/wrap_arrays_in_structs.h",
533 "transform/zero_init_workgroup_memory.cc",
534 "transform/zero_init_workgroup_memory.h",
Ben Clayton7cbd8202022-05-05 15:34:41 +0000535 "utils/bitcast.h",
Ben Clayton4cb13292022-03-04 21:09:24 +0000536 "utils/block_allocator.h",
Ben Clayton9707e6b2022-05-25 19:28:55 +0000537 "utils/compiler_macros.h",
538 "utils/concat.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000539 "utils/crc32.h",
540 "utils/debugger.cc",
541 "utils/debugger.h",
542 "utils/enum_set.h",
543 "utils/hash.h",
544 "utils/map.h",
545 "utils/math.h",
546 "utils/scoped_assignment.h",
547 "utils/string.h",
Ben Claytone2283192022-03-05 00:29:15 +0000548 "utils/unique_allocator.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000549 "utils/unique_vector.h",
550 "writer/append_vector.cc",
551 "writer/append_vector.h",
552 "writer/array_length_from_uniform_options.cc",
553 "writer/array_length_from_uniform_options.h",
Antonio Maiorano4e98fb02022-05-02 19:49:19 +0000554 "writer/flatten_bindings.cc",
555 "writer/flatten_bindings.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000556 "writer/float_to_string.cc",
557 "writer/float_to_string.h",
Antonio Maioranoa730eb72022-04-06 13:57:54 +0000558 "writer/generate_external_texture_bindings.cc",
559 "writer/generate_external_texture_bindings.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000560 "writer/text.cc",
561 "writer/text.h",
562 "writer/text_generator.cc",
563 "writer/text_generator.h",
564 "writer/writer.cc",
565 "writer/writer.h",
566 ]
567
568 if (is_linux) {
569 sources += [ "diagnostic/printer_linux.cc" ]
570 } else if (is_win) {
571 sources += [ "diagnostic/printer_windows.cc" ]
572 } else {
573 sources += [ "diagnostic/printer_other.cc" ]
574 }
575}
576
577libtint_source_set("libtint_sem_src") {
578 sources = [
Ben Clayton94328872022-04-29 09:14:15 +0000579 "sem/abstract_float.cc",
580 "sem/abstract_float.h",
581 "sem/abstract_int.cc",
582 "sem/abstract_int.h",
583 "sem/abstract_numeric.cc",
584 "sem/abstract_numeric.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000585 "sem/array.cc",
586 "sem/array.h",
Ben Clayton01004b72022-04-28 18:49:04 +0000587 "sem/atomic.cc",
588 "sem/atomic.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000589 "sem/behavior.cc",
590 "sem/behavior.h",
591 "sem/binding_point.h",
592 "sem/block_statement.cc",
Ben Clayton01004b72022-04-28 18:49:04 +0000593 "sem/bool.cc",
594 "sem/bool.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000595 "sem/builtin.cc",
596 "sem/builtin.h",
597 "sem/builtin_type.cc",
598 "sem/builtin_type.h",
599 "sem/call.cc",
600 "sem/call.h",
601 "sem/call_target.cc",
602 "sem/call_target.h",
603 "sem/constant.cc",
604 "sem/constant.h",
Ben Clayton01004b72022-04-28 18:49:04 +0000605 "sem/depth_multisampled_texture.cc",
606 "sem/depth_multisampled_texture.h",
607 "sem/depth_texture.cc",
608 "sem/depth_texture.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000609 "sem/expression.cc",
610 "sem/expression.h",
Ben Clayton01004b72022-04-28 18:49:04 +0000611 "sem/external_texture.cc",
612 "sem/external_texture.h",
Zhaoming Jiang62bfd312022-05-13 12:01:11 +0000613 "sem/f16.cc",
614 "sem/f16.h",
Ben Clayton01004b72022-04-28 18:49:04 +0000615 "sem/f32.cc",
616 "sem/f32.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000617 "sem/for_loop_statement.cc",
618 "sem/for_loop_statement.h",
619 "sem/function.cc",
Ben Clayton01004b72022-04-28 18:49:04 +0000620 "sem/i32.cc",
621 "sem/i32.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000622 "sem/if_statement.cc",
623 "sem/if_statement.h",
624 "sem/info.cc",
625 "sem/info.h",
626 "sem/loop_statement.cc",
627 "sem/loop_statement.h",
Ben Clayton2081ee42022-05-19 19:32:29 +0000628 "sem/materialize.cc",
629 "sem/materialize.h",
Ben Clayton01004b72022-04-28 18:49:04 +0000630 "sem/matrix.cc",
631 "sem/matrix.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000632 "sem/member_accessor_expression.cc",
633 "sem/module.cc",
634 "sem/module.h",
Ben Clayton01004b72022-04-28 18:49:04 +0000635 "sem/multisampled_texture.cc",
636 "sem/multisampled_texture.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000637 "sem/node.cc",
638 "sem/node.h",
639 "sem/parameter_usage.cc",
640 "sem/parameter_usage.h",
641 "sem/pipeline_stage_set.h",
Ben Clayton01004b72022-04-28 18:49:04 +0000642 "sem/pointer.cc",
643 "sem/pointer.h",
644 "sem/reference.cc",
645 "sem/reference.h",
646 "sem/sampled_texture.cc",
647 "sem/sampled_texture.h",
648 "sem/sampler.cc",
649 "sem/sampler.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000650 "sem/statement.cc",
Ben Clayton01004b72022-04-28 18:49:04 +0000651 "sem/storage_texture.cc",
652 "sem/storage_texture.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000653 "sem/struct.cc",
654 "sem/switch_statement.cc",
655 "sem/switch_statement.h",
Ben Clayton01004b72022-04-28 18:49:04 +0000656 "sem/texture.cc",
657 "sem/texture.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000658 "sem/type.cc",
659 "sem/type.h",
660 "sem/type_constructor.cc",
661 "sem/type_constructor.h",
662 "sem/type_conversion.cc",
663 "sem/type_conversion.h",
664 "sem/type_manager.cc",
665 "sem/type_manager.h",
666 "sem/type_mappings.h",
Ben Clayton01004b72022-04-28 18:49:04 +0000667 "sem/u32.cc",
668 "sem/u32.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000669 "sem/variable.cc",
Ben Clayton01004b72022-04-28 18:49:04 +0000670 "sem/vector.cc",
671 "sem/vector.h",
672 "sem/void.cc",
673 "sem/void.h",
dan sinclair49d1a2d2022-06-16 12:01:27 +0000674 "sem/while_statement.cc",
675 "sem/while_statement.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000676 ]
677
678 public_deps = [ ":libtint_core_all_src" ]
679}
680
681libtint_source_set("libtint_core_src") {
682 public_deps = [
683 ":libtint_core_all_src",
684 ":libtint_sem_src",
685 ]
686}
687
688libtint_source_set("libtint_spv_reader_src") {
689 sources = [
690 "reader/spirv/construct.cc",
691 "reader/spirv/construct.h",
692 "reader/spirv/entry_point_info.cc",
693 "reader/spirv/entry_point_info.h",
694 "reader/spirv/enum_converter.cc",
695 "reader/spirv/enum_converter.h",
696 "reader/spirv/fail_stream.h",
697 "reader/spirv/function.cc",
698 "reader/spirv/function.h",
699 "reader/spirv/namer.cc",
700 "reader/spirv/namer.h",
701 "reader/spirv/parser.cc",
702 "reader/spirv/parser.h",
703 "reader/spirv/parser_impl.cc",
704 "reader/spirv/parser_impl.h",
705 "reader/spirv/parser_type.cc",
706 "reader/spirv/parser_type.h",
707 "reader/spirv/usage.cc",
708 "reader/spirv/usage.h",
709 ]
710
711 public_deps = [
712 ":libtint_core_src",
713 "${tint_spirv_tools_dir}/:spvtools_opt",
714 ]
715
716 public_configs = [ "${tint_spirv_tools_dir}/:spvtools_internal_config" ]
717}
718
719libtint_source_set("libtint_spv_writer_src") {
720 sources = [
721 "writer/spirv/binary_writer.cc",
722 "writer/spirv/binary_writer.h",
723 "writer/spirv/builder.cc",
724 "writer/spirv/builder.h",
725 "writer/spirv/function.cc",
726 "writer/spirv/function.h",
727 "writer/spirv/generator.cc",
728 "writer/spirv/generator.h",
Antonio Maioranob5c46c32022-04-11 21:10:20 +0000729 "writer/spirv/generator_impl.cc",
730 "writer/spirv/generator_impl.h",
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000731 "writer/spirv/instruction.cc",
732 "writer/spirv/instruction.h",
733 "writer/spirv/operand.cc",
734 "writer/spirv/operand.h",
735 "writer/spirv/scalar_constant.h",
736 ]
737
738 public_deps = [ ":libtint_core_src" ]
739}
740
741libtint_source_set("libtint_wgsl_reader_src") {
742 sources = [
743 "reader/wgsl/lexer.cc",
744 "reader/wgsl/lexer.h",
745 "reader/wgsl/parser.cc",
746 "reader/wgsl/parser.h",
747 "reader/wgsl/parser_impl.cc",
748 "reader/wgsl/parser_impl.h",
749 "reader/wgsl/parser_impl_detail.h",
750 "reader/wgsl/token.cc",
751 "reader/wgsl/token.h",
752 ]
753
754 public_deps = [ ":libtint_core_src" ]
755}
756
757libtint_source_set("libtint_wgsl_writer_src") {
758 sources = [
759 "writer/wgsl/generator.cc",
760 "writer/wgsl/generator.h",
761 "writer/wgsl/generator_impl.cc",
762 "writer/wgsl/generator_impl.h",
763 ]
764
765 public_deps = [ ":libtint_core_src" ]
766}
767
768libtint_source_set("libtint_msl_writer_src") {
769 sources = [
770 "writer/msl/generator.cc",
771 "writer/msl/generator.h",
772 "writer/msl/generator_impl.cc",
773 "writer/msl/generator_impl.h",
774 ]
775
776 public_deps = [ ":libtint_core_src" ]
777}
778
779libtint_source_set("libtint_hlsl_writer_src") {
780 sources = [
781 "writer/hlsl/generator.cc",
782 "writer/hlsl/generator.h",
783 "writer/hlsl/generator_impl.cc",
784 "writer/hlsl/generator_impl.h",
785 ]
786
787 public_deps = [ ":libtint_core_src" ]
788}
789
790libtint_source_set("libtint_glsl_writer_src") {
791 sources = [
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000792 "writer/glsl/generator.cc",
793 "writer/glsl/generator.h",
794 "writer/glsl/generator_impl.cc",
795 "writer/glsl/generator_impl.h",
796 ]
797
798 public_deps = [ ":libtint_core_src" ]
799}
800
801source_set("libtint") {
802 public_deps = [ ":libtint_core_src" ]
803
804 if (tint_build_spv_reader) {
805 public_deps += [ ":libtint_spv_reader_src" ]
806 }
807
808 if (tint_build_spv_writer) {
809 public_deps += [ ":libtint_spv_writer_src" ]
810 }
811
812 if (tint_build_wgsl_reader) {
813 public_deps += [ ":libtint_wgsl_reader_src" ]
814 }
815
816 if (tint_build_wgsl_writer) {
817 public_deps += [ ":libtint_wgsl_writer_src" ]
818 }
819
820 if (tint_build_msl_writer) {
821 public_deps += [ ":libtint_msl_writer_src" ]
822 }
823
824 if (tint_build_hlsl_writer) {
825 public_deps += [ ":libtint_hlsl_writer_src" ]
826 }
827
828 if (tint_build_glsl_writer) {
829 public_deps += [ ":libtint_glsl_writer_src" ]
830 }
831
832 configs += [ ":tint_common_config" ]
833 public_configs = [ ":tint_public_config" ]
834
835 if (build_with_chromium) {
836 configs -= [ "//build/config/compiler:chromium_code" ]
837 configs += [ "//build/config/compiler:no_chromium_code" ]
838 }
839}