blob: ea32d7898e6eacdd139ed4af05b0d29d3be03415 [file] [log] [blame]
# Copyright 2021 The Tint Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//build_overrides/build.gni")
import("../../tint_overrides_with_defaults.gni")
if (tint_build_unittests) {
import("//testing/test.gni")
}
###############################################################################
# Common - Configs, etc. shared across targets
###############################################################################
config("tint_common_config") {
include_dirs = [
"${target_gen_dir}",
"${tint_root_dir}/",
"${tint_spirv_headers_dir}/include",
"${tint_spirv_tools_dir}/",
"${tint_spirv_tools_dir}/include",
]
}
config("tint_public_config") {
defines = []
if (tint_build_spv_reader) {
defines += [ "TINT_BUILD_SPV_READER=1" ]
} else {
defines += [ "TINT_BUILD_SPV_READER=0" ]
}
if (tint_build_spv_writer) {
defines += [ "TINT_BUILD_SPV_WRITER=1" ]
} else {
defines += [ "TINT_BUILD_SPV_WRITER=0" ]
}
if (tint_build_wgsl_reader) {
defines += [ "TINT_BUILD_WGSL_READER=1" ]
} else {
defines += [ "TINT_BUILD_WGSL_READER=0" ]
}
if (tint_build_wgsl_writer) {
defines += [ "TINT_BUILD_WGSL_WRITER=1" ]
} else {
defines += [ "TINT_BUILD_WGSL_WRITER=0" ]
}
if (tint_build_msl_writer) {
defines += [ "TINT_BUILD_MSL_WRITER=1" ]
} else {
defines += [ "TINT_BUILD_MSL_WRITER=0" ]
}
if (tint_build_hlsl_writer) {
defines += [ "TINT_BUILD_HLSL_WRITER=1" ]
} else {
defines += [ "TINT_BUILD_HLSL_WRITER=0" ]
}
if (tint_build_glsl_writer) {
defines += [ "TINT_BUILD_GLSL_WRITER=1" ]
} else {
defines += [ "TINT_BUILD_GLSL_WRITER=0" ]
}
include_dirs = [
"${tint_root_dir}/",
"${tint_root_dir}/include/",
"${tint_spirv_headers_dir}/include",
]
}
config("tint_config") {
include_dirs = []
if (tint_build_spv_reader || tint_build_spv_writer) {
include_dirs += [ "${tint_spirv_tools_dir}/include/" ]
}
}
###############################################################################
# Helper library for IO operations
# Only to be used by tests and sample executable
###############################################################################
source_set("tint_utils_io") {
sources = [
"utils/io/command.h",
"utils/io/tmpfile.h",
]
if (is_linux || is_mac) {
sources += [ "utils/io/command_posix.cc" ]
sources += [ "utils/io/tmpfile_posix.cc" ]
} else if (is_win) {
sources += [ "utils/io/command_windows.cc" ]
sources += [ "utils/io/tmpfile_windows.cc" ]
} else {
sources += [ "utils/io/command_other.cc" ]
sources += [ "utils/io/tmpfile_other.cc" ]
}
public_deps = [ ":libtint_core_all_src" ]
}
###############################################################################
# Helper library for validating generated shaders
# As this depends on tint_utils_io, this is only to be used by tests and sample
# executable
###############################################################################
source_set("tint_val") {
sources = [
"val/hlsl.cc",
"val/msl.cc",
"val/val.h",
]
public_deps = [ ":tint_utils_io" ]
}
###############################################################################
# Library - Tint core and optional modules of libtint
###############################################################################
# libtint source sets are divided into a non-optional core in :libtint_core_src
# and optional :libtint_*_src subsets, because ninja does not like having
# multiple source files with the same name, like function.cc, in the same
# source set
# target.
#
# Targets that want to use tint as a library should depend on ":libtint" and
# use the build flags to control what is included, instead of trying to specify
# the subsets that they want.
template("libtint_source_set") {
source_set(target_name) {
forward_variables_from(invoker, "*", [ "configs" ])
if (!defined(invoker.deps)) {
deps = []
}
deps += [
"${tint_spirv_headers_dir}:spv_headers",
"${tint_spirv_tools_dir}:spvtools_core_enums_unified1",
"${tint_spirv_tools_dir}:spvtools_core_tables_unified1",
"${tint_spirv_tools_dir}:spvtools_headers",
"${tint_spirv_tools_dir}:spvtools_language_header_cldebuginfo100",
"${tint_spirv_tools_dir}:spvtools_language_header_debuginfo",
"${tint_spirv_tools_dir}:spvtools_language_header_vkdebuginfo100",
]
if (defined(invoker.configs)) {
configs += invoker.configs
}
configs += [ ":tint_common_config" ]
if (build_with_chromium) {
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
}
if (!defined(invoker.public_configs)) {
public_configs = []
}
public_configs += [ ":tint_public_config" ]
}
}
libtint_source_set("libtint_core_all_src") {
sources = [
"ast/access.cc",
"ast/access.h",
"ast/alias.cc",
"ast/alias.h",
"ast/array.cc",
"ast/array.h",
"ast/assignment_statement.cc",
"ast/assignment_statement.h",
"ast/ast_type.cc", # TODO(bclayton) - rename to type.cc
"ast/atomic.cc",
"ast/atomic.h",
"ast/attribute.cc",
"ast/attribute.h",
"ast/binary_expression.cc",
"ast/binary_expression.h",
"ast/binding_attribute.cc",
"ast/binding_attribute.h",
"ast/bitcast_expression.cc",
"ast/bitcast_expression.h",
"ast/block_statement.cc",
"ast/block_statement.h",
"ast/bool.cc",
"ast/bool.h",
"ast/bool_literal_expression.cc",
"ast/bool_literal_expression.h",
"ast/break_statement.cc",
"ast/break_statement.h",
"ast/builtin_attribute.cc",
"ast/builtin_attribute.h",
"ast/builtin_value.cc",
"ast/builtin_value.h",
"ast/call_expression.cc",
"ast/call_expression.h",
"ast/call_statement.cc",
"ast/call_statement.h",
"ast/case_statement.cc",
"ast/case_statement.h",
"ast/compound_assignment_statement.cc",
"ast/compound_assignment_statement.h",
"ast/const.cc",
"ast/const.h",
"ast/continue_statement.cc",
"ast/continue_statement.h",
"ast/depth_multisampled_texture.cc",
"ast/depth_multisampled_texture.h",
"ast/depth_texture.cc",
"ast/depth_texture.h",
"ast/disable_validation_attribute.cc",
"ast/disable_validation_attribute.h",
"ast/discard_statement.cc",
"ast/discard_statement.h",
"ast/enable.cc",
"ast/enable.h",
"ast/expression.cc",
"ast/expression.h",
"ast/extension.cc",
"ast/extension.h",
"ast/external_texture.cc",
"ast/external_texture.h",
"ast/f16.cc",
"ast/f16.h",
"ast/f32.cc",
"ast/f32.h",
"ast/fallthrough_statement.cc",
"ast/fallthrough_statement.h",
"ast/float_literal_expression.cc",
"ast/float_literal_expression.h",
"ast/for_loop_statement.cc",
"ast/for_loop_statement.h",
"ast/function.cc",
"ast/function.h",
"ast/group_attribute.cc",
"ast/group_attribute.h",
"ast/i32.cc",
"ast/i32.h",
"ast/id_attribute.cc",
"ast/id_attribute.h",
"ast/identifier_expression.cc",
"ast/identifier_expression.h",
"ast/if_statement.cc",
"ast/if_statement.h",
"ast/increment_decrement_statement.cc",
"ast/increment_decrement_statement.h",
"ast/index_accessor_expression.cc",
"ast/index_accessor_expression.h",
"ast/int_literal_expression.cc",
"ast/int_literal_expression.h",
"ast/internal_attribute.cc",
"ast/internal_attribute.h",
"ast/interpolate_attribute.cc",
"ast/interpolate_attribute.h",
"ast/invariant_attribute.cc",
"ast/invariant_attribute.h",
"ast/let.cc",
"ast/let.h",
"ast/literal_expression.cc",
"ast/literal_expression.h",
"ast/location_attribute.cc",
"ast/location_attribute.h",
"ast/loop_statement.cc",
"ast/loop_statement.h",
"ast/matrix.cc",
"ast/matrix.h",
"ast/member_accessor_expression.cc",
"ast/member_accessor_expression.h",
"ast/module.cc",
"ast/module.h",
"ast/multisampled_texture.cc",
"ast/multisampled_texture.h",
"ast/node.cc",
"ast/node.h",
"ast/node_id.h",
"ast/override.cc",
"ast/override.h",
"ast/parameter.cc",
"ast/parameter.h",
"ast/phony_expression.cc",
"ast/phony_expression.h",
"ast/pipeline_stage.cc",
"ast/pipeline_stage.h",
"ast/pointer.cc",
"ast/pointer.h",
"ast/return_statement.cc",
"ast/return_statement.h",
"ast/sampled_texture.cc",
"ast/sampled_texture.h",
"ast/sampler.cc",
"ast/sampler.h",
"ast/stage_attribute.cc",
"ast/stage_attribute.h",
"ast/statement.cc",
"ast/statement.h",
"ast/static_assert.cc",
"ast/static_assert.h",
"ast/storage_class.cc",
"ast/storage_class.h",
"ast/storage_texture.cc",
"ast/storage_texture.h",
"ast/stride_attribute.cc",
"ast/stride_attribute.h",
"ast/struct.cc",
"ast/struct.h",
"ast/struct_member.cc",
"ast/struct_member.h",
"ast/struct_member_align_attribute.cc",
"ast/struct_member_align_attribute.h",
"ast/struct_member_offset_attribute.cc",
"ast/struct_member_offset_attribute.h",
"ast/struct_member_size_attribute.cc",
"ast/struct_member_size_attribute.h",
"ast/switch_statement.cc",
"ast/switch_statement.h",
"ast/texel_format.cc",
"ast/texel_format.h",
"ast/texture.cc",
"ast/texture.h",
"ast/traverse_expressions.h",
"ast/type.h",
"ast/type_decl.cc",
"ast/type_decl.h",
"ast/type_name.cc",
"ast/type_name.h",
"ast/u32.cc",
"ast/u32.h",
"ast/unary_op.cc",
"ast/unary_op.h",
"ast/unary_op_expression.cc",
"ast/unary_op_expression.h",
"ast/var.cc",
"ast/var.h",
"ast/variable.cc",
"ast/variable.h",
"ast/variable_decl_statement.cc",
"ast/variable_decl_statement.h",
"ast/vector.cc",
"ast/vector.h",
"ast/void.cc",
"ast/void.h",
"ast/while_statement.cc",
"ast/while_statement.h",
"ast/workgroup_attribute.cc",
"ast/workgroup_attribute.h",
"castable.cc",
"castable.h",
"clone_context.cc",
"clone_context.h",
"debug.cc",
"debug.h",
"demangler.cc",
"demangler.h",
"diagnostic/diagnostic.cc",
"diagnostic/diagnostic.h",
"diagnostic/formatter.cc",
"diagnostic/formatter.h",
"diagnostic/printer.cc",
"diagnostic/printer.h",
"inspector/entry_point.cc",
"inspector/entry_point.h",
"inspector/inspector.cc",
"inspector/inspector.h",
"inspector/resource_binding.cc",
"inspector/resource_binding.h",
"inspector/scalar.cc",
"inspector/scalar.h",
"number.cc",
"number.h",
"program.cc",
"program.h",
"program_builder.cc",
"program_builder.h",
"program_id.cc",
"program_id.h",
"reader/reader.cc",
"reader/reader.h",
"reflection.h",
"resolver/const_eval.cc",
"resolver/const_eval.h",
"resolver/ctor_conv_intrinsic.cc",
"resolver/ctor_conv_intrinsic.h",
"resolver/dependency_graph.cc",
"resolver/dependency_graph.h",
"resolver/intrinsic_table.cc",
"resolver/intrinsic_table.h",
"resolver/intrinsic_table.inl",
"resolver/resolver.cc",
"resolver/resolver.h",
"resolver/sem_helper.cc",
"resolver/sem_helper.h",
"resolver/uniformity.cc",
"resolver/uniformity.h",
"resolver/validator.cc",
"resolver/validator.h",
"scope_stack.h",
"sem/abstract_float.h",
"sem/abstract_int.h",
"sem/abstract_numeric.h",
"sem/array.h",
"sem/atomic.h",
"sem/behavior.h",
"sem/binding_point.h",
"sem/bool.h",
"sem/builtin.h",
"sem/builtin_type.h",
"sem/call.h",
"sem/call_target.h",
"sem/constant.h",
"sem/depth_multisampled_texture.h",
"sem/depth_texture.h",
"sem/evaluation_stage.h",
"sem/expression.h",
"sem/external_texture.h",
"sem/f16.h",
"sem/f32.h",
"sem/for_loop_statement.h",
"sem/i32.h",
"sem/if_statement.h",
"sem/index_accessor_expression.h",
"sem/info.h",
"sem/loop_statement.h",
"sem/materialize.h",
"sem/matrix.h",
"sem/module.h",
"sem/multisampled_texture.h",
"sem/node.h",
"sem/parameter_usage.h",
"sem/pipeline_stage_set.h",
"sem/pointer.h",
"sem/reference.h",
"sem/sampled_texture.h",
"sem/sampler.h",
"sem/sampler_texture_pair.h",
"sem/storage_texture.h",
"sem/switch_statement.h",
"sem/texture.h",
"sem/type.h",
"sem/type_constructor.h",
"sem/type_conversion.h",
"sem/type_manager.h",
"sem/type_mappings.h",
"sem/u32.h",
"sem/vector.h",
"sem/void.h",
"sem/while_statement.h",
"source.cc",
"source.h",
"symbol.cc",
"symbol.h",
"symbol_table.cc",
"symbol_table.h",
"text/unicode.cc",
"text/unicode.h",
"traits.h",
"transform/add_block_attribute.cc",
"transform/add_block_attribute.h",
"transform/add_empty_entry_point.cc",
"transform/add_empty_entry_point.h",
"transform/array_length_from_uniform.cc",
"transform/array_length_from_uniform.h",
"transform/binding_remapper.cc",
"transform/binding_remapper.h",
"transform/builtin_polyfill.cc",
"transform/builtin_polyfill.h",
"transform/calculate_array_length.cc",
"transform/calculate_array_length.h",
"transform/canonicalize_entry_point_io.cc",
"transform/canonicalize_entry_point_io.h",
"transform/combine_samplers.cc",
"transform/combine_samplers.h",
"transform/decompose_memory_access.cc",
"transform/decompose_memory_access.h",
"transform/decompose_strided_array.cc",
"transform/decompose_strided_array.h",
"transform/decompose_strided_matrix.cc",
"transform/decompose_strided_matrix.h",
"transform/disable_uniformity_analysis.cc",
"transform/disable_uniformity_analysis.h",
"transform/expand_compound_assignment.cc",
"transform/expand_compound_assignment.h",
"transform/first_index_offset.cc",
"transform/first_index_offset.h",
"transform/fold_trivial_single_use_lets.cc",
"transform/fold_trivial_single_use_lets.h",
"transform/for_loop_to_loop.cc",
"transform/for_loop_to_loop.h",
"transform/localize_struct_array_assignment.cc",
"transform/localize_struct_array_assignment.h",
"transform/loop_to_for_loop.cc",
"transform/loop_to_for_loop.h",
"transform/manager.cc",
"transform/manager.h",
"transform/module_scope_var_to_entry_point_param.cc",
"transform/module_scope_var_to_entry_point_param.h",
"transform/multiplanar_external_texture.cc",
"transform/multiplanar_external_texture.h",
"transform/num_workgroups_from_uniform.cc",
"transform/num_workgroups_from_uniform.h",
"transform/promote_initializers_to_let.cc",
"transform/promote_initializers_to_let.h",
"transform/promote_side_effects_to_decl.cc",
"transform/promote_side_effects_to_decl.h",
"transform/remove_continue_in_switch.cc",
"transform/remove_continue_in_switch.h",
"transform/remove_phonies.cc",
"transform/remove_phonies.h",
"transform/remove_unreachable_statements.cc",
"transform/remove_unreachable_statements.h",
"transform/renamer.cc",
"transform/renamer.h",
"transform/robustness.cc",
"transform/robustness.h",
"transform/simplify_pointers.cc",
"transform/simplify_pointers.h",
"transform/single_entry_point.cc",
"transform/single_entry_point.h",
"transform/spirv_atomic.cc",
"transform/spirv_atomic.h",
"transform/std140.cc",
"transform/std140.h",
"transform/substitute_override.cc",
"transform/substitute_override.h",
"transform/transform.cc",
"transform/transform.h",
"transform/unshadow.cc",
"transform/unshadow.h",
"transform/unwind_discard_functions.cc",
"transform/unwind_discard_functions.h",
"transform/utils/get_insertion_point.cc",
"transform/utils/get_insertion_point.h",
"transform/utils/hoist_to_decl_before.cc",
"transform/utils/hoist_to_decl_before.h",
"transform/var_for_dynamic_index.cc",
"transform/var_for_dynamic_index.h",
"transform/vectorize_matrix_conversions.cc",
"transform/vectorize_matrix_conversions.h",
"transform/vectorize_scalar_matrix_constructors.cc",
"transform/vectorize_scalar_matrix_constructors.h",
"transform/vertex_pulling.cc",
"transform/vertex_pulling.h",
"transform/while_to_loop.cc",
"transform/while_to_loop.h",
"transform/zero_init_workgroup_memory.cc",
"transform/zero_init_workgroup_memory.h",
"utils/bitcast.h",
"utils/bitset.h",
"utils/block_allocator.h",
"utils/compiler_macros.h",
"utils/concat.h",
"utils/crc32.h",
"utils/debugger.cc",
"utils/debugger.h",
"utils/enum_set.h",
"utils/foreach_macro.h",
"utils/hash.h",
"utils/hashmap.h",
"utils/hashset.h",
"utils/map.h",
"utils/math.h",
"utils/scoped_assignment.h",
"utils/string.h",
"utils/unique_allocator.h",
"utils/unique_vector.h",
"utils/vector.h",
"writer/append_vector.cc",
"writer/append_vector.h",
"writer/array_length_from_uniform_options.cc",
"writer/array_length_from_uniform_options.h",
"writer/flatten_bindings.cc",
"writer/flatten_bindings.h",
"writer/float_to_string.cc",
"writer/float_to_string.h",
"writer/generate_external_texture_bindings.cc",
"writer/generate_external_texture_bindings.h",
"writer/text.cc",
"writer/text.h",
"writer/text_generator.cc",
"writer/text_generator.h",
"writer/writer.cc",
"writer/writer.h",
]
if (is_linux) {
sources += [ "diagnostic/printer_linux.cc" ]
} else if (is_win) {
sources += [ "diagnostic/printer_windows.cc" ]
} else {
sources += [ "diagnostic/printer_other.cc" ]
}
}
libtint_source_set("libtint_sem_src") {
sources = [
"sem/abstract_float.cc",
"sem/abstract_float.h",
"sem/abstract_int.cc",
"sem/abstract_int.h",
"sem/abstract_numeric.cc",
"sem/abstract_numeric.h",
"sem/array.cc",
"sem/array.h",
"sem/atomic.cc",
"sem/atomic.h",
"sem/behavior.cc",
"sem/behavior.h",
"sem/binding_point.h",
"sem/block_statement.cc",
"sem/bool.cc",
"sem/bool.h",
"sem/builtin.cc",
"sem/builtin.h",
"sem/builtin_type.cc",
"sem/builtin_type.h",
"sem/call.cc",
"sem/call.h",
"sem/call_target.cc",
"sem/call_target.h",
"sem/constant.cc",
"sem/constant.h",
"sem/depth_multisampled_texture.cc",
"sem/depth_multisampled_texture.h",
"sem/depth_texture.cc",
"sem/depth_texture.h",
"sem/evaluation_stage.h",
"sem/expression.cc",
"sem/expression.h",
"sem/external_texture.cc",
"sem/external_texture.h",
"sem/f16.cc",
"sem/f16.h",
"sem/f32.cc",
"sem/f32.h",
"sem/for_loop_statement.cc",
"sem/for_loop_statement.h",
"sem/function.cc",
"sem/i32.cc",
"sem/i32.h",
"sem/if_statement.cc",
"sem/if_statement.h",
"sem/index_accessor_expression.cc",
"sem/index_accessor_expression.h",
"sem/info.cc",
"sem/info.h",
"sem/loop_statement.cc",
"sem/loop_statement.h",
"sem/materialize.cc",
"sem/materialize.h",
"sem/matrix.cc",
"sem/matrix.h",
"sem/member_accessor_expression.cc",
"sem/module.cc",
"sem/module.h",
"sem/multisampled_texture.cc",
"sem/multisampled_texture.h",
"sem/node.cc",
"sem/node.h",
"sem/parameter_usage.cc",
"sem/parameter_usage.h",
"sem/pipeline_stage_set.h",
"sem/pointer.cc",
"sem/pointer.h",
"sem/reference.cc",
"sem/reference.h",
"sem/sampled_texture.cc",
"sem/sampled_texture.h",
"sem/sampler.cc",
"sem/sampler.h",
"sem/statement.cc",
"sem/storage_texture.cc",
"sem/storage_texture.h",
"sem/struct.cc",
"sem/switch_statement.cc",
"sem/switch_statement.h",
"sem/texture.cc",
"sem/texture.h",
"sem/type.cc",
"sem/type.h",
"sem/type_constructor.cc",
"sem/type_constructor.h",
"sem/type_conversion.cc",
"sem/type_conversion.h",
"sem/type_manager.cc",
"sem/type_manager.h",
"sem/type_mappings.h",
"sem/u32.cc",
"sem/u32.h",
"sem/variable.cc",
"sem/vector.cc",
"sem/vector.h",
"sem/void.cc",
"sem/void.h",
"sem/while_statement.cc",
"sem/while_statement.h",
]
public_deps = [ ":libtint_core_all_src" ]
}
libtint_source_set("libtint_core_src") {
public_deps = [
":libtint_core_all_src",
":libtint_sem_src",
]
}
libtint_source_set("libtint_spv_reader_src") {
sources = [
"reader/spirv/construct.cc",
"reader/spirv/construct.h",
"reader/spirv/entry_point_info.cc",
"reader/spirv/entry_point_info.h",
"reader/spirv/enum_converter.cc",
"reader/spirv/enum_converter.h",
"reader/spirv/fail_stream.h",
"reader/spirv/function.cc",
"reader/spirv/function.h",
"reader/spirv/namer.cc",
"reader/spirv/namer.h",
"reader/spirv/parser.cc",
"reader/spirv/parser.h",
"reader/spirv/parser_impl.cc",
"reader/spirv/parser_impl.h",
"reader/spirv/parser_type.cc",
"reader/spirv/parser_type.h",
"reader/spirv/usage.cc",
"reader/spirv/usage.h",
]
public_deps = [
":libtint_core_src",
"${tint_spirv_tools_dir}/:spvtools_opt",
]
public_configs = [ "${tint_spirv_tools_dir}/:spvtools_internal_config" ]
}
libtint_source_set("libtint_spv_writer_src") {
sources = [
"writer/spirv/binary_writer.cc",
"writer/spirv/binary_writer.h",
"writer/spirv/builder.cc",
"writer/spirv/builder.h",
"writer/spirv/function.cc",
"writer/spirv/function.h",
"writer/spirv/generator.cc",
"writer/spirv/generator.h",
"writer/spirv/generator_impl.cc",
"writer/spirv/generator_impl.h",
"writer/spirv/instruction.cc",
"writer/spirv/instruction.h",
"writer/spirv/operand.cc",
"writer/spirv/operand.h",
"writer/spirv/scalar_constant.h",
]
public_deps = [ ":libtint_core_src" ]
}
libtint_source_set("libtint_wgsl_reader_src") {
sources = [
"reader/wgsl/lexer.cc",
"reader/wgsl/lexer.h",
"reader/wgsl/parser.cc",
"reader/wgsl/parser.h",
"reader/wgsl/parser_impl.cc",
"reader/wgsl/parser_impl.h",
"reader/wgsl/parser_impl_detail.h",
"reader/wgsl/token.cc",
"reader/wgsl/token.h",
]
public_deps = [ ":libtint_core_src" ]
}
libtint_source_set("libtint_wgsl_writer_src") {
sources = [
"writer/wgsl/generator.cc",
"writer/wgsl/generator.h",
"writer/wgsl/generator_impl.cc",
"writer/wgsl/generator_impl.h",
]
public_deps = [ ":libtint_core_src" ]
}
libtint_source_set("libtint_msl_writer_src") {
sources = [
"writer/msl/generator.cc",
"writer/msl/generator.h",
"writer/msl/generator_impl.cc",
"writer/msl/generator_impl.h",
]
public_deps = [ ":libtint_core_src" ]
}
libtint_source_set("libtint_hlsl_writer_src") {
sources = [
"writer/hlsl/generator.cc",
"writer/hlsl/generator.h",
"writer/hlsl/generator_impl.cc",
"writer/hlsl/generator_impl.h",
]
public_deps = [ ":libtint_core_src" ]
}
libtint_source_set("libtint_glsl_writer_src") {
sources = [
"writer/glsl/generator.cc",
"writer/glsl/generator.h",
"writer/glsl/generator_impl.cc",
"writer/glsl/generator_impl.h",
]
public_deps = [ ":libtint_core_src" ]
}
source_set("libtint") {
public_deps = [ ":libtint_core_src" ]
if (tint_build_spv_reader) {
public_deps += [ ":libtint_spv_reader_src" ]
}
if (tint_build_spv_writer) {
public_deps += [ ":libtint_spv_writer_src" ]
}
if (tint_build_wgsl_reader) {
public_deps += [ ":libtint_wgsl_reader_src" ]
}
if (tint_build_wgsl_writer) {
public_deps += [ ":libtint_wgsl_writer_src" ]
}
if (tint_build_msl_writer) {
public_deps += [ ":libtint_msl_writer_src" ]
}
if (tint_build_hlsl_writer) {
public_deps += [ ":libtint_hlsl_writer_src" ]
}
if (tint_build_glsl_writer) {
public_deps += [ ":libtint_glsl_writer_src" ]
}
configs += [ ":tint_common_config" ]
public_configs = [ ":tint_public_config" ]
if (build_with_chromium) {
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
}
}
if (tint_build_unittests) {
###############################################################################
# Gtest Gmock - Handle building inside and outside of Chromium.
###############################################################################
# When building outside of Chromium we need to define our own targets for GTest
# and GMock. However when compiling inside of Chromium we need to reuse the
# existing targets, both because Chromium has a special harness for swarming
# and because otherwise the "gn check" fails.
if (!build_with_chromium) {
# When we aren't in Chromium we define out own targets based on the location
# of the googletest repo.
config("gtest_config") {
include_dirs = [
"${tint_googletest_dir}/googletest",
"${tint_googletest_dir}/googletest/include",
]
}
static_library("gtest") {
testonly = true
sources = [ "${tint_googletest_dir}/googletest/src/gtest-all.cc" ]
public_configs = [ ":gtest_config" ]
}
config("gmock_config") {
include_dirs = [
"${tint_googletest_dir}/googlemock",
"${tint_googletest_dir}/googlemock/include",
"${tint_googletest_dir}/googletest/include",
]
}
static_library("gmock") {
testonly = true
sources = [ "${tint_googletest_dir}/googlemock/src/gmock-all.cc" ]
public_configs = [ ":gmock_config" ]
}
group("gmock_and_gtest") {
testonly = true
public_deps = [
":gmock",
":gtest",
]
}
} else {
# When we are in Chromium we reuse its targets, and also add some deps that
# are needed to launch the test in swarming mode.
group("gmock_and_gtest") {
testonly = true
public_deps = [
"//base",
"//base/test:test_support",
"//testing/gmock",
"//testing/gtest",
"//third_party/googletest:gmock",
]
}
}
###############################################################################
# Wrapping of Chromium targets
###############################################################################
# These targets are separated because they are Chromium sources files that
# can't use the tint_internal config, otherwise Tint's warning flags get
# applied while compiling a bunch of Chromium's //base (via header inclusion)
source_set("tint_unittests_main") {
testonly = true
deps = [ ":gmock_and_gtest" ]
if (build_with_chromium) {
sources = [ "//gpu/tint_unittests_main.cc" ]
} else {
sources = [ "test_main.cc" ]
configs += [ ":tint_unittests_config" ]
deps += [
":libtint",
":tint_unittests_hlsl_writer_src",
":tint_unittests_msl_writer_src",
":tint_unittests_spv_reader_src",
]
}
}
###############################################################################
# Tests - For libtint core and optional modules
###############################################################################
config("tint_unittests_config") {
include_dirs = [
"${tint_googletest_dir}/googlemock/include",
"${tint_googletest_dir}/googletest/include",
]
configs = [
":tint_common_config",
":tint_public_config",
]
}
template("tint_unittests_source_set") {
source_set(target_name) {
forward_variables_from(invoker, "*", [ "configs" ])
if (defined(invoker.configs)) {
configs += invoker.configs
}
configs += [ ":tint_unittests_config" ]
if (build_with_chromium) {
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
}
testonly = true
if (!defined(invoker.deps)) {
deps = []
}
deps += [
":gmock_and_gtest",
":libtint",
":tint_utils_io",
]
}
}
tint_unittests_source_set("tint_unittests_ast_src") {
sources = [
"ast/alias_test.cc",
"ast/array_test.cc",
"ast/assignment_statement_test.cc",
"ast/atomic_test.cc",
"ast/binary_expression_test.cc",
"ast/binding_attribute_test.cc",
"ast/bitcast_expression_test.cc",
"ast/block_statement_test.cc",
"ast/bool_literal_expression_test.cc",
"ast/bool_test.cc",
"ast/break_statement_test.cc",
"ast/builtin_attribute_test.cc",
"ast/builtin_texture_helper_test.cc",
"ast/builtin_texture_helper_test.h",
"ast/builtin_value_test.cc",
"ast/call_expression_test.cc",
"ast/call_statement_test.cc",
"ast/case_statement_test.cc",
"ast/compound_assignment_statement_test.cc",
"ast/continue_statement_test.cc",
"ast/depth_multisampled_texture_test.cc",
"ast/depth_texture_test.cc",
"ast/discard_statement_test.cc",
"ast/enable_test.cc",
"ast/extension_test.cc",
"ast/external_texture_test.cc",
"ast/f16_test.cc",
"ast/f32_test.cc",
"ast/fallthrough_statement_test.cc",
"ast/float_literal_expression_test.cc",
"ast/for_loop_statement_test.cc",
"ast/function_test.cc",
"ast/group_attribute_test.cc",
"ast/i32_test.cc",
"ast/id_attribute_test.cc",
"ast/identifier_expression_test.cc",
"ast/if_statement_test.cc",
"ast/increment_decrement_statement_test.cc",
"ast/index_accessor_expression_test.cc",
"ast/int_literal_expression_test.cc",
"ast/interpolate_attribute_test.cc",
"ast/invariant_attribute_test.cc",
"ast/location_attribute_test.cc",
"ast/loop_statement_test.cc",
"ast/matrix_test.cc",
"ast/member_accessor_expression_test.cc",
"ast/module_clone_test.cc",
"ast/module_test.cc",
"ast/multisampled_texture_test.cc",
"ast/phony_expression_test.cc",
"ast/pointer_test.cc",
"ast/return_statement_test.cc",
"ast/sampled_texture_test.cc",
"ast/sampler_test.cc",
"ast/stage_attribute_test.cc",
"ast/static_assert_test.cc",
"ast/storage_class_test.cc",
"ast/storage_texture_test.cc",
"ast/stride_attribute_test.cc",
"ast/struct_member_align_attribute_test.cc",
"ast/struct_member_offset_attribute_test.cc",
"ast/struct_member_size_attribute_test.cc",
"ast/struct_member_test.cc",
"ast/struct_test.cc",
"ast/switch_statement_test.cc",
"ast/test_helper.h",
"ast/texel_format_test.cc",
"ast/texture_test.cc",
"ast/traverse_expressions_test.cc",
"ast/u32_test.cc",
"ast/unary_op_expression_test.cc",
"ast/variable_decl_statement_test.cc",
"ast/variable_test.cc",
"ast/vector_test.cc",
"ast/while_statement_test.cc",
"ast/workgroup_attribute_test.cc",
]
}
tint_unittests_source_set("tint_unittests_diagnostic_src") {
sources = [
"diagnostic/diagnostic_test.cc",
"diagnostic/formatter_test.cc",
"diagnostic/printer_test.cc",
]
}
tint_unittests_source_set("tint_unittests_inspector_src") {
sources = [
"inspector/inspector_test.cc",
"inspector/test_inspector_builder.cc",
"inspector/test_inspector_builder.h",
"inspector/test_inspector_runner.cc",
"inspector/test_inspector_runner.h",
]
}
tint_unittests_source_set("tint_unittests_resolver_src") {
sources = [
"resolver/array_accessor_test.cc",
"resolver/assignment_validation_test.cc",
"resolver/atomics_test.cc",
"resolver/atomics_validation_test.cc",
"resolver/attribute_validation_test.cc",
"resolver/bitcast_validation_test.cc",
"resolver/builtin_test.cc",
"resolver/builtin_validation_test.cc",
"resolver/builtins_validation_test.cc",
"resolver/call_test.cc",
"resolver/call_validation_test.cc",
"resolver/compound_assignment_validation_test.cc",
"resolver/compound_statement_test.cc",
"resolver/const_eval_test.cc",
"resolver/control_block_validation_test.cc",
"resolver/dependency_graph_test.cc",
"resolver/entry_point_validation_test.cc",
"resolver/evaluation_stage_test.cc",
"resolver/function_validation_test.cc",
"resolver/host_shareable_validation_test.cc",
"resolver/increment_decrement_validation_test.cc",
"resolver/inferred_type_test.cc",
"resolver/intrinsic_table_test.cc",
"resolver/is_host_shareable_test.cc",
"resolver/is_storeable_test.cc",
"resolver/materialize_test.cc",
"resolver/override_test.cc",
"resolver/ptr_ref_test.cc",
"resolver/ptr_ref_validation_test.cc",
"resolver/resolver_behavior_test.cc",
"resolver/resolver_test.cc",
"resolver/resolver_test_helper.cc",
"resolver/resolver_test_helper.h",
"resolver/side_effects_test.cc",
"resolver/source_variable_test.cc",
"resolver/static_assert_test.cc",
"resolver/storage_class_layout_validation_test.cc",
"resolver/storage_class_validation_test.cc",
"resolver/struct_layout_test.cc",
"resolver/struct_pipeline_stage_use_test.cc",
"resolver/struct_storage_class_use_test.cc",
"resolver/type_constructor_validation_test.cc",
"resolver/type_validation_test.cc",
"resolver/uniformity_test.cc",
"resolver/validation_test.cc",
"resolver/validator_is_storeable_test.cc",
"resolver/variable_test.cc",
"resolver/variable_validation_test.cc",
]
deps = [ ":tint_unittests_ast_src" ]
}
tint_unittests_source_set("tint_unittests_sem_src") {
sources = [
"sem/atomic_test.cc",
"sem/bool_test.cc",
"sem/builtin_test.cc",
"sem/depth_multisampled_texture_test.cc",
"sem/depth_texture_test.cc",
"sem/expression_test.cc",
"sem/external_texture_test.cc",
"sem/f16_test.cc",
"sem/f32_test.cc",
"sem/i32_test.cc",
"sem/matrix_test.cc",
"sem/multisampled_texture_test.cc",
"sem/pointer_test.cc",
"sem/reference_test.cc",
"sem/sampled_texture_test.cc",
"sem/sampler_test.cc",
"sem/sem_array_test.cc",
"sem/sem_struct_test.cc",
"sem/storage_texture_test.cc",
"sem/texture_test.cc",
"sem/type_manager_test.cc",
"sem/type_test.cc",
"sem/u32_test.cc",
"sem/vector_test.cc",
]
}
tint_unittests_source_set("tint_unittests_text_src") {
sources = [ "text/unicode_test.cc" ]
}
tint_unittests_source_set("tint_unittests_transform_src") {
sources = [
"transform/add_block_attribute_test.cc",
"transform/add_empty_entry_point_test.cc",
"transform/array_length_from_uniform_test.cc",
"transform/binding_remapper_test.cc",
"transform/builtin_polyfill_test.cc",
"transform/calculate_array_length_test.cc",
"transform/canonicalize_entry_point_io_test.cc",
"transform/combine_samplers_test.cc",
"transform/decompose_memory_access_test.cc",
"transform/decompose_strided_array_test.cc",
"transform/decompose_strided_matrix_test.cc",
"transform/disable_uniformity_analysis_test.cc",
"transform/expand_compound_assignment_test.cc",
"transform/first_index_offset_test.cc",
"transform/fold_trivial_single_use_lets_test.cc",
"transform/for_loop_to_loop_test.cc",
"transform/localize_struct_array_assignment_test.cc",
"transform/loop_to_for_loop_test.cc",
"transform/module_scope_var_to_entry_point_param_test.cc",
"transform/multiplanar_external_texture_test.cc",
"transform/num_workgroups_from_uniform_test.cc",
"transform/promote_initializers_to_let_test.cc",
"transform/promote_side_effects_to_decl_test.cc",
"transform/remove_continue_in_switch_test.cc",
"transform/remove_phonies_test.cc",
"transform/remove_unreachable_statements_test.cc",
"transform/renamer_test.cc",
"transform/robustness_test.cc",
"transform/simplify_pointers_test.cc",
"transform/single_entry_point_test.cc",
"transform/spirv_atomic_test.cc",
"transform/std140_test.cc",
"transform/substitute_override_test.cc",
"transform/test_helper.h",
"transform/transform_test.cc",
"transform/unshadow_test.cc",
"transform/unwind_discard_functions_test.cc",
"transform/utils/get_insertion_point_test.cc",
"transform/utils/hoist_to_decl_before_test.cc",
"transform/var_for_dynamic_index_test.cc",
"transform/vectorize_matrix_conversions_test.cc",
"transform/vectorize_scalar_matrix_constructors_test.cc",
"transform/vertex_pulling_test.cc",
"transform/while_to_loop_test.cc",
"transform/zero_init_workgroup_memory_test.cc",
]
}
tint_unittests_source_set("tint_unittests_utils_src") {
sources = [
"utils/bitcast_test.cc",
"utils/bitset_test.cc",
"utils/crc32_test.cc",
"utils/defer_test.cc",
"utils/enum_set_test.cc",
"utils/hash_test.cc",
"utils/hashmap_test.cc",
"utils/hashset_test.cc",
"utils/io/command_test.cc",
"utils/io/tmpfile_test.cc",
"utils/map_test.cc",
"utils/math_test.cc",
"utils/result_test.cc",
"utils/reverse_test.cc",
"utils/scoped_assignment_test.cc",
"utils/string_test.cc",
"utils/transform_test.cc",
"utils/unique_allocator_test.cc",
"utils/unique_vector_test.cc",
"utils/vector_test.cc",
]
}
tint_unittests_source_set("tint_unittests_writer_src") {
sources = [
"writer/append_vector_test.cc",
"writer/flatten_bindings_test.cc",
"writer/float_to_string_test.cc",
"writer/generate_external_texture_bindings_test.cc",
"writer/text_generator_test.cc",
]
}
tint_unittests_source_set("tint_unittests_spv_reader_src") {
sources = [
"reader/spirv/enum_converter_test.cc",
"reader/spirv/fail_stream_test.cc",
"reader/spirv/function_arithmetic_test.cc",
"reader/spirv/function_bit_test.cc",
"reader/spirv/function_call_test.cc",
"reader/spirv/function_cfg_test.cc",
"reader/spirv/function_composite_test.cc",
"reader/spirv/function_conversion_test.cc",
"reader/spirv/function_decl_test.cc",
"reader/spirv/function_glsl_std_450_test.cc",
"reader/spirv/function_logical_test.cc",
"reader/spirv/function_memory_test.cc",
"reader/spirv/function_misc_test.cc",
"reader/spirv/function_var_test.cc",
"reader/spirv/namer_test.cc",
"reader/spirv/parser_impl_barrier_test.cc",
"reader/spirv/parser_impl_convert_member_decoration_test.cc",
"reader/spirv/parser_impl_convert_type_test.cc",
"reader/spirv/parser_impl_function_decl_test.cc",
"reader/spirv/parser_impl_get_decorations_test.cc",
"reader/spirv/parser_impl_handle_test.cc",
"reader/spirv/parser_impl_import_test.cc",
"reader/spirv/parser_impl_module_var_test.cc",
"reader/spirv/parser_impl_named_types_test.cc",
"reader/spirv/parser_impl_test.cc",
"reader/spirv/parser_impl_test_helper.cc",
"reader/spirv/parser_impl_test_helper.h",
"reader/spirv/parser_impl_user_name_test.cc",
"reader/spirv/parser_test.cc",
"reader/spirv/parser_type_test.cc",
"reader/spirv/spirv_tools_helpers_test.cc",
"reader/spirv/spirv_tools_helpers_test.h",
"reader/spirv/usage_test.cc",
]
deps = [ ":libtint_spv_reader_src" ]
}
tint_unittests_source_set("tint_unittests_spv_writer_src") {
sources = [
"writer/spirv/binary_writer_test.cc",
"writer/spirv/builder_accessor_expression_test.cc",
"writer/spirv/builder_assign_test.cc",
"writer/spirv/builder_binary_expression_test.cc",
"writer/spirv/builder_bitcast_expression_test.cc",
"writer/spirv/builder_block_test.cc",
"writer/spirv/builder_builtin_test.cc",
"writer/spirv/builder_builtin_texture_test.cc",
"writer/spirv/builder_call_test.cc",
"writer/spirv/builder_constructor_expression_test.cc",
"writer/spirv/builder_discard_test.cc",
"writer/spirv/builder_entry_point_test.cc",
"writer/spirv/builder_format_conversion_test.cc",
"writer/spirv/builder_function_attribute_test.cc",
"writer/spirv/builder_function_test.cc",
"writer/spirv/builder_function_variable_test.cc",
"writer/spirv/builder_global_variable_test.cc",
"writer/spirv/builder_ident_expression_test.cc",
"writer/spirv/builder_if_test.cc",
"writer/spirv/builder_literal_test.cc",
"writer/spirv/builder_loop_test.cc",
"writer/spirv/builder_return_test.cc",
"writer/spirv/builder_static_assert_test.cc",
"writer/spirv/builder_switch_test.cc",
"writer/spirv/builder_test.cc",
"writer/spirv/builder_type_test.cc",
"writer/spirv/builder_unary_op_expression_test.cc",
"writer/spirv/instruction_test.cc",
"writer/spirv/operand_test.cc",
"writer/spirv/scalar_constant_test.cc",
"writer/spirv/spv_dump.cc",
"writer/spirv/spv_dump.h",
"writer/spirv/test_helper.h",
]
deps = [
":libtint_spv_writer_src",
":tint_unittests_ast_src",
"${tint_spirv_tools_dir}/:spvtools",
]
}
tint_unittests_source_set("tint_unittests_wgsl_reader_src") {
sources = [
"reader/wgsl/lexer_test.cc",
"reader/wgsl/parser_impl_additive_expression_test.cc",
"reader/wgsl/parser_impl_argument_expression_list_test.cc",
"reader/wgsl/parser_impl_assignment_stmt_test.cc",
"reader/wgsl/parser_impl_bitwise_expression_test.cc",
"reader/wgsl/parser_impl_break_stmt_test.cc",
"reader/wgsl/parser_impl_bug_cases_test.cc",
"reader/wgsl/parser_impl_call_stmt_test.cc",
"reader/wgsl/parser_impl_callable_test.cc",
"reader/wgsl/parser_impl_case_body_test.cc",
"reader/wgsl/parser_impl_compound_stmt_test.cc",
"reader/wgsl/parser_impl_const_literal_test.cc",
"reader/wgsl/parser_impl_continue_stmt_test.cc",
"reader/wgsl/parser_impl_continuing_stmt_test.cc",
"reader/wgsl/parser_impl_core_lhs_expression_test.cc",
"reader/wgsl/parser_impl_depth_texture_test.cc",
"reader/wgsl/parser_impl_element_count_expression_test.cc",
"reader/wgsl/parser_impl_enable_directive_test.cc",
"reader/wgsl/parser_impl_error_msg_test.cc",
"reader/wgsl/parser_impl_error_resync_test.cc",
"reader/wgsl/parser_impl_expression_test.cc",
"reader/wgsl/parser_impl_external_texture_test.cc",
"reader/wgsl/parser_impl_for_stmt_test.cc",
"reader/wgsl/parser_impl_function_attribute_list_test.cc",
"reader/wgsl/parser_impl_function_attribute_test.cc",
"reader/wgsl/parser_impl_function_decl_test.cc",
"reader/wgsl/parser_impl_function_header_test.cc",
"reader/wgsl/parser_impl_global_constant_decl_test.cc",
"reader/wgsl/parser_impl_global_decl_test.cc",
"reader/wgsl/parser_impl_global_variable_decl_test.cc",
"reader/wgsl/parser_impl_if_stmt_test.cc",
"reader/wgsl/parser_impl_increment_decrement_stmt_test.cc",
"reader/wgsl/parser_impl_lhs_expression_test.cc",
"reader/wgsl/parser_impl_loop_stmt_test.cc",
"reader/wgsl/parser_impl_math_expression_test.cc",
"reader/wgsl/parser_impl_multiplicative_expression_test.cc",
"reader/wgsl/parser_impl_param_list_test.cc",
"reader/wgsl/parser_impl_paren_expression_test.cc",
"reader/wgsl/parser_impl_pipeline_stage_test.cc",
"reader/wgsl/parser_impl_primary_expression_test.cc",
"reader/wgsl/parser_impl_relational_expression_test.cc",
"reader/wgsl/parser_impl_reserved_keyword_test.cc",
"reader/wgsl/parser_impl_sampled_texture_test.cc",
"reader/wgsl/parser_impl_sampler_test.cc",
"reader/wgsl/parser_impl_shift_expression_test.cc",
"reader/wgsl/parser_impl_singular_expression_test.cc",
"reader/wgsl/parser_impl_statement_test.cc",
"reader/wgsl/parser_impl_statements_test.cc",
"reader/wgsl/parser_impl_storage_class_test.cc",
"reader/wgsl/parser_impl_storage_texture_test.cc",
"reader/wgsl/parser_impl_struct_attribute_decl_test.cc",
"reader/wgsl/parser_impl_struct_body_decl_test.cc",
"reader/wgsl/parser_impl_struct_decl_test.cc",
"reader/wgsl/parser_impl_struct_member_attribute_decl_test.cc",
"reader/wgsl/parser_impl_struct_member_attribute_test.cc",
"reader/wgsl/parser_impl_struct_member_test.cc",
"reader/wgsl/parser_impl_switch_body_test.cc",
"reader/wgsl/parser_impl_switch_stmt_test.cc",
"reader/wgsl/parser_impl_test.cc",
"reader/wgsl/parser_impl_test_helper.cc",
"reader/wgsl/parser_impl_test_helper.h",
"reader/wgsl/parser_impl_texel_format_test.cc",
"reader/wgsl/parser_impl_texture_sampler_test.cc",
"reader/wgsl/parser_impl_type_alias_test.cc",
"reader/wgsl/parser_impl_type_decl_test.cc",
"reader/wgsl/parser_impl_type_decl_without_ident_test.cc",
"reader/wgsl/parser_impl_unary_expression_test.cc",
"reader/wgsl/parser_impl_variable_attribute_list_test.cc",
"reader/wgsl/parser_impl_variable_attribute_test.cc",
"reader/wgsl/parser_impl_variable_decl_test.cc",
"reader/wgsl/parser_impl_variable_ident_decl_test.cc",
"reader/wgsl/parser_impl_variable_qualifier_test.cc",
"reader/wgsl/parser_impl_variable_stmt_test.cc",
"reader/wgsl/parser_impl_vec_mat_prefix_test.cc",
"reader/wgsl/parser_impl_while_stmt_test.cc",
"reader/wgsl/parser_test.cc",
"reader/wgsl/token_test.cc",
]
deps = [ ":libtint_wgsl_reader_src" ]
}
tint_unittests_source_set("tint_unittests_wgsl_writer_src") {
sources = [
"writer/wgsl/generator_impl_alias_type_test.cc",
"writer/wgsl/generator_impl_array_accessor_test.cc",
"writer/wgsl/generator_impl_assign_test.cc",
"writer/wgsl/generator_impl_binary_test.cc",
"writer/wgsl/generator_impl_bitcast_test.cc",
"writer/wgsl/generator_impl_block_test.cc",
"writer/wgsl/generator_impl_break_test.cc",
"writer/wgsl/generator_impl_call_test.cc",
"writer/wgsl/generator_impl_case_test.cc",
"writer/wgsl/generator_impl_cast_test.cc",
"writer/wgsl/generator_impl_constructor_test.cc",
"writer/wgsl/generator_impl_continue_test.cc",
"writer/wgsl/generator_impl_discard_test.cc",
"writer/wgsl/generator_impl_enable_test.cc",
"writer/wgsl/generator_impl_fallthrough_test.cc",
"writer/wgsl/generator_impl_function_test.cc",
"writer/wgsl/generator_impl_global_decl_test.cc",
"writer/wgsl/generator_impl_identifier_test.cc",
"writer/wgsl/generator_impl_if_test.cc",
"writer/wgsl/generator_impl_literal_test.cc",
"writer/wgsl/generator_impl_loop_test.cc",
"writer/wgsl/generator_impl_member_accessor_test.cc",
"writer/wgsl/generator_impl_return_test.cc",
"writer/wgsl/generator_impl_static_assert_test.cc",
"writer/wgsl/generator_impl_switch_test.cc",
"writer/wgsl/generator_impl_test.cc",
"writer/wgsl/generator_impl_type_test.cc",
"writer/wgsl/generator_impl_unary_op_test.cc",
"writer/wgsl/generator_impl_variable_decl_statement_test.cc",
"writer/wgsl/generator_impl_variable_test.cc",
"writer/wgsl/test_helper.h",
]
deps = [
":libtint_wgsl_writer_src",
":tint_unittests_ast_src",
]
}
tint_unittests_source_set("tint_unittests_msl_writer_src") {
sources = [
"writer/msl/generator_impl_array_accessor_test.cc",
"writer/msl/generator_impl_assign_test.cc",
"writer/msl/generator_impl_binary_test.cc",
"writer/msl/generator_impl_bitcast_test.cc",
"writer/msl/generator_impl_block_test.cc",
"writer/msl/generator_impl_break_test.cc",
"writer/msl/generator_impl_builtin_test.cc",
"writer/msl/generator_impl_builtin_texture_test.cc",
"writer/msl/generator_impl_call_test.cc",
"writer/msl/generator_impl_case_test.cc",
"writer/msl/generator_impl_cast_test.cc",
"writer/msl/generator_impl_constructor_test.cc",
"writer/msl/generator_impl_continue_test.cc",
"writer/msl/generator_impl_discard_test.cc",
"writer/msl/generator_impl_function_test.cc",
"writer/msl/generator_impl_identifier_test.cc",
"writer/msl/generator_impl_if_test.cc",
"writer/msl/generator_impl_import_test.cc",
"writer/msl/generator_impl_loop_test.cc",
"writer/msl/generator_impl_member_accessor_test.cc",
"writer/msl/generator_impl_module_constant_test.cc",
"writer/msl/generator_impl_return_test.cc",
"writer/msl/generator_impl_sanitizer_test.cc",
"writer/msl/generator_impl_static_assert_test.cc",
"writer/msl/generator_impl_switch_test.cc",
"writer/msl/generator_impl_test.cc",
"writer/msl/generator_impl_type_test.cc",
"writer/msl/generator_impl_unary_op_test.cc",
"writer/msl/generator_impl_variable_decl_statement_test.cc",
"writer/msl/test_helper.h",
]
deps = [
":libtint_msl_writer_src",
":tint_unittests_ast_src",
]
}
tint_unittests_source_set("tint_unittests_hlsl_writer_src") {
sources = [
"writer/hlsl/generator_impl_array_accessor_test.cc",
"writer/hlsl/generator_impl_assign_test.cc",
"writer/hlsl/generator_impl_binary_test.cc",
"writer/hlsl/generator_impl_bitcast_test.cc",
"writer/hlsl/generator_impl_block_test.cc",
"writer/hlsl/generator_impl_break_test.cc",
"writer/hlsl/generator_impl_builtin_test.cc",
"writer/hlsl/generator_impl_builtin_texture_test.cc",
"writer/hlsl/generator_impl_call_test.cc",
"writer/hlsl/generator_impl_case_test.cc",
"writer/hlsl/generator_impl_cast_test.cc",
"writer/hlsl/generator_impl_constructor_test.cc",
"writer/hlsl/generator_impl_continue_test.cc",
"writer/hlsl/generator_impl_discard_test.cc",
"writer/hlsl/generator_impl_function_test.cc",
"writer/hlsl/generator_impl_identifier_test.cc",
"writer/hlsl/generator_impl_if_test.cc",
"writer/hlsl/generator_impl_import_test.cc",
"writer/hlsl/generator_impl_loop_test.cc",
"writer/hlsl/generator_impl_member_accessor_test.cc",
"writer/hlsl/generator_impl_module_constant_test.cc",
"writer/hlsl/generator_impl_return_test.cc",
"writer/hlsl/generator_impl_sanitizer_test.cc",
"writer/hlsl/generator_impl_static_assert_test.cc",
"writer/hlsl/generator_impl_switch_test.cc",
"writer/hlsl/generator_impl_test.cc",
"writer/hlsl/generator_impl_type_test.cc",
"writer/hlsl/generator_impl_unary_op_test.cc",
"writer/hlsl/generator_impl_variable_decl_statement_test.cc",
"writer/hlsl/generator_impl_workgroup_var_test.cc",
"writer/hlsl/test_helper.h",
]
deps = [
":libtint_hlsl_writer_src",
":tint_unittests_ast_src",
]
}
tint_unittests_source_set("tint_unittests_glsl_writer_src") {
sources = [
"writer/glsl/generator_impl_array_accessor_test.cc",
"writer/glsl/generator_impl_assign_test.cc",
"writer/glsl/generator_impl_binary_test.cc",
"writer/glsl/generator_impl_bitcast_test.cc",
"writer/glsl/generator_impl_block_test.cc",
"writer/glsl/generator_impl_break_test.cc",
"writer/glsl/generator_impl_builtin_test.cc",
"writer/glsl/generator_impl_builtin_texture_test.cc",
"writer/glsl/generator_impl_call_test.cc",
"writer/glsl/generator_impl_case_test.cc",
"writer/glsl/generator_impl_cast_test.cc",
"writer/glsl/generator_impl_constructor_test.cc",
"writer/glsl/generator_impl_continue_test.cc",
"writer/glsl/generator_impl_discard_test.cc",
"writer/glsl/generator_impl_function_test.cc",
"writer/glsl/generator_impl_identifier_test.cc",
"writer/glsl/generator_impl_if_test.cc",
"writer/glsl/generator_impl_import_test.cc",
"writer/glsl/generator_impl_loop_test.cc",
"writer/glsl/generator_impl_member_accessor_test.cc",
"writer/glsl/generator_impl_module_constant_test.cc",
"writer/glsl/generator_impl_return_test.cc",
"writer/glsl/generator_impl_sanitizer_test.cc",
"writer/glsl/generator_impl_storage_buffer_test.cc",
"writer/glsl/generator_impl_switch_test.cc",
"writer/glsl/generator_impl_test.cc",
"writer/glsl/generator_impl_type_test.cc",
"writer/glsl/generator_impl_unary_op_test.cc",
"writer/glsl/generator_impl_uniform_buffer_test.cc",
"writer/glsl/generator_impl_variable_decl_statement_test.cc",
"writer/glsl/generator_impl_workgroup_var_test.cc",
"writer/glsl/test_helper.h",
]
deps = [
":libtint_glsl_writer_src",
":tint_unittests_ast_src",
":tint_unittests_transform_src",
]
}
tint_unittests_source_set("tint_unittests_core_src") {
sources = [
"castable_test.cc",
"clone_context_test.cc",
"debug_test.cc",
"demangler_test.cc",
"number_test.cc",
"program_builder_test.cc",
"program_test.cc",
"reflection_test.cc",
"scope_stack_test.cc",
"source_test.cc",
"symbol_table_test.cc",
"symbol_test.cc",
"traits_test.cc",
"utils/block_allocator_test.cc",
]
deps = [ ":tint_unittests_ast_src" ]
}
if (build_with_chromium) {
tint_unittests_source_set("tint_unittests_fuzzer_src") {
sources = [ "fuzzers/random_generator_test.cc" ]
deps = [
":tint_unittests_core_src",
"fuzzers:tint_fuzzer_common_src",
]
}
}
source_set("tint_unittests_src") {
testonly = true
deps = [
":libtint_wgsl_reader_src",
":libtint_wgsl_writer_src",
":tint_unittests_ast_src",
":tint_unittests_core_src",
":tint_unittests_diagnostic_src",
":tint_unittests_inspector_src",
":tint_unittests_resolver_src",
":tint_unittests_sem_src",
":tint_unittests_text_src",
":tint_unittests_transform_src",
":tint_unittests_utils_src",
":tint_unittests_writer_src",
]
if (tint_build_spv_reader) {
deps += [ ":tint_unittests_spv_reader_src" ]
}
if (tint_build_spv_writer) {
deps += [ ":tint_unittests_spv_writer_src" ]
}
if (tint_build_wgsl_reader) {
deps += [ ":tint_unittests_wgsl_reader_src" ]
}
if (tint_build_wgsl_writer) {
deps += [ ":tint_unittests_wgsl_writer_src" ]
}
if (tint_build_msl_writer) {
deps += [ ":tint_unittests_msl_writer_src" ]
}
if (tint_build_hlsl_writer) {
deps += [ ":tint_unittests_hlsl_writer_src" ]
}
if (tint_build_glsl_writer) {
deps += [ ":tint_unittests_glsl_writer_src" ]
}
if (build_with_chromium) {
deps += [ ":tint_unittests_fuzzer_src" ]
}
configs += [ ":tint_unittests_config" ]
if (build_with_chromium) {
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
}
}
test("tint_unittests") {
deps = [
":gmock_and_gtest",
":tint_unittests_src",
"${tint_spirv_tools_dir}/:spvtools",
"${tint_spirv_tools_dir}/:spvtools_opt",
"${tint_spirv_tools_dir}/:spvtools_val",
]
deps += [ ":tint_unittests_main" ]
configs += [ ":tint_unittests_config" ]
if (build_with_chromium) {
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
}
testonly = true
}
}