diff --git a/src/BUILD.gn b/src/BUILD.gn index 2a940b6c56..335a04fc97 100644 --- a/src/BUILD.gn +++ b/src/BUILD.gn @@ -253,31 +253,6 @@ template("libtint_source_set") { } } -libtint_source_set("libtint_sem_src") { - sources = [ - "sem/array.cc", - "sem/array.h", - "sem/call.cc", - "sem/call.h", - "sem/call_target.cc", - "sem/call_target.h", - "sem/expression.cc", - "sem/expression.h", - "sem/function.cc", - "sem/info.cc", - "sem/info.h", - "sem/intrinsic.cc", - "sem/intrinsic.h", - "sem/member_accessor_expression.cc", - "sem/node.cc", - "sem/node.h", - "sem/statement.cc", - "sem/struct.cc", - "sem/type_mappings.h", - "sem/variable.cc", - ] -} - libtint_source_set("libtint_core_all_src") { sources = [ "ast/access_control.cc", @@ -286,12 +261,13 @@ libtint_source_set("libtint_core_all_src") { "ast/access_decoration.h", "ast/alias.cc", "ast/alias.h", - "ast/array_accessor_expression.cc", - "ast/array_accessor_expression.h", "ast/array.cc", "ast/array.h", + "ast/array_accessor_expression.cc", + "ast/array_accessor_expression.h", "ast/assignment_statement.cc", "ast/assignment_statement.h", + "ast/ast_type.cc", # TODO(bclayton) - rename to type.cc "ast/binary_expression.cc", "ast/binary_expression.h", "ast/binding_decoration.cc", @@ -300,16 +276,16 @@ libtint_source_set("libtint_core_all_src") { "ast/bitcast_expression.h", "ast/block_statement.cc", "ast/block_statement.h", - "ast/bool_literal.cc", - "ast/bool_literal.h", "ast/bool.cc", "ast/bool.h", + "ast/bool_literal.cc", + "ast/bool_literal.h", "ast/break_statement.cc", "ast/break_statement.h", - "ast/builtin_decoration.cc", - "ast/builtin_decoration.h", "ast/builtin.cc", "ast/builtin.h", + "ast/builtin_decoration.cc", + "ast/builtin_decoration.h", "ast/call_expression.cc", "ast/call_expression.h", "ast/call_statement.cc", @@ -392,38 +368,37 @@ libtint_source_set("libtint_core_all_src") { "ast/storage_texture.h", "ast/stride_decoration.cc", "ast/stride_decoration.h", + "ast/struct.cc", + "ast/struct.h", "ast/struct_block_decoration.cc", "ast/struct_block_decoration.h", + "ast/struct_member.cc", + "ast/struct_member.h", "ast/struct_member_align_decoration.cc", "ast/struct_member_align_decoration.h", "ast/struct_member_offset_decoration.cc", "ast/struct_member_offset_decoration.h", "ast/struct_member_size_decoration.cc", "ast/struct_member_size_decoration.h", - "ast/struct_member.cc", - "ast/struct_member.h", - "ast/struct.cc", - "ast/struct.h", "ast/switch_statement.cc", "ast/switch_statement.h", "ast/texture.cc", "ast/texture.h", + "ast/type.h", "ast/type_constructor_expression.cc", "ast/type_constructor_expression.h", - "ast/ast_type.cc", # TODO(bclayton) - rename to type.cc - "ast/type.h", "ast/u32.cc", "ast/u32.h", "ast/uint_literal.cc", "ast/uint_literal.h", - "ast/unary_op_expression.cc", - "ast/unary_op_expression.h", "ast/unary_op.cc", "ast/unary_op.h", - "ast/variable_decl_statement.cc", - "ast/variable_decl_statement.h", + "ast/unary_op_expression.cc", + "ast/unary_op_expression.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", @@ -453,12 +428,12 @@ libtint_source_set("libtint_core_all_src") { "inspector/scalar.h", "intrinsic_table.cc", "intrinsic_table.h", + "program.cc", + "program.h", "program_builder.cc", "program_builder.h", "program_id.cc", "program_id.h", - "program.cc", - "program.h", "reader/reader.cc", "reader/reader.h", "resolver/resolver.cc", @@ -468,22 +443,29 @@ libtint_source_set("libtint_core_all_src") { "sem/access_control_type.h", "sem/alias_type.cc", "sem/alias_type.h", + "sem/array.h", "sem/array_type.cc", "sem/array_type.h", "sem/bool_type.cc", "sem/bool_type.h", + "sem/call.h", + "sem/call_target.h", "sem/depth_texture_type.cc", "sem/depth_texture_type.h", + "sem/expression.h", "sem/external_texture_type.cc", "sem/external_texture_type.h", "sem/f32_type.cc", "sem/f32_type.h", "sem/i32_type.cc", "sem/i32_type.h", + "sem/info.h", + "sem/intrinsic.h", "sem/matrix_type.cc", "sem/matrix_type.h", "sem/multisampled_texture_type.cc", "sem/multisampled_texture_type.h", + "sem/node.h", "sem/pointer_type.cc", "sem/pointer_type.h", "sem/sampled_texture_type.cc", @@ -500,6 +482,7 @@ libtint_source_set("libtint_core_all_src") { "sem/type.h", "sem/type_manager.cc", "sem/type_manager.h", + "sem/type_mappings.h", "sem/u32_type.cc", "sem/u32_type.h", "sem/vector_type.cc", @@ -508,10 +491,10 @@ libtint_source_set("libtint_core_all_src") { "sem/void_type.h", "source.cc", "source.h", - "symbol_table.cc", - "symbol_table.h", "symbol.cc", "symbol.h", + "symbol_table.cc", + "symbol_table.h", "traits.h", "transform/binding_point.h", "transform/binding_remapper.cc", @@ -544,10 +527,10 @@ libtint_source_set("libtint_core_all_src") { "writer/append_vector.h", "writer/float_to_string.cc", "writer/float_to_string.h", - "writer/text_generator.cc", - "writer/text_generator.h", "writer/text.cc", "writer/text.h", + "writer/text_generator.cc", + "writer/text_generator.h", "writer/writer.cc", "writer/writer.h", ] @@ -561,8 +544,27 @@ libtint_source_set("libtint_core_all_src") { } } +libtint_source_set("libtint_sem_src") { + sources = [ + "sem/array.cc", + "sem/call.cc", + "sem/call_target.cc", + "sem/expression.cc", + "sem/function.cc", + "sem/info.cc", + "sem/intrinsic.cc", + "sem/member_accessor_expression.cc", + "sem/node.cc", + "sem/statement.cc", + "sem/struct.cc", + "sem/variable.cc", + ] + + public_deps = [ ":libtint_core_all_src" ] +} + libtint_source_set("libtint_core_src") { - deps = [ + public_deps = [ ":libtint_core_all_src", ":libtint_sem_src", ] @@ -588,7 +590,10 @@ libtint_source_set("libtint_spv_reader_src") { "reader/spirv/usage.h", ] - public_deps = [ ":libtint_core_src" ] + public_deps = [ + ":libtint_core_src", + "${tint_spirv_tools_dir}/:spvtools_opt", + ] } libtint_source_set("libtint_spv_writer_src") { diff --git a/test/BUILD.gn b/test/BUILD.gn index 2b19a60d98..4dd045315f 100644 --- a/test/BUILD.gn +++ b/test/BUILD.gn @@ -107,6 +107,27 @@ config("tint_unittests_config") { ] } +source_set("tint_test_helpers") { + sources = [ + "../src/ast/intrinsic_texture_helper_test.cc", + "../src/ast/intrinsic_texture_helper_test.h", + "../src/transform/test_helper.h", + "../src/utils/command.h", + "../src/utils/tmpfile.h", + ] + + if (is_linux || is_mac) { + sources += [ "../src/utils/command_posix.cc" ] + sources += [ "../src/utils/tmpfile_posix.cc" ] + } else if (is_win) { + sources += [ "../src/utils/command_windows.cc" ] + sources += [ "../src/utils/tmpfile_windows.cc" ] + } else { + sources += [ "../src/utils/command_other.cc" ] + sources += [ "../src/utils/tmpfile_other.cc" ] + } +} + template("tint_unittests_source_set") { source_set(target_name) { forward_variables_from(invoker, "*", [ "configs" ]) @@ -127,6 +148,7 @@ template("tint_unittests_source_set") { } deps += [ ":gmock_and_gtest", + ":tint_test_helpers", "${tint_root_dir}/src:libtint_core_src", ] } @@ -169,8 +191,6 @@ tint_unittests_source_set("tint_unittests_core_src") { "../src/ast/identifier_expression_test.cc", "../src/ast/if_statement_test.cc", "../src/ast/int_literal_test.cc", - "../src/ast/intrinsic_texture_helper_test.cc", - "../src/ast/intrinsic_texture_helper_test.h", "../src/ast/location_decoration_test.cc", "../src/ast/loop_statement_test.cc", "../src/ast/matrix_test.cc", @@ -224,9 +244,9 @@ tint_unittests_source_set("tint_unittests_core_src") { "../src/resolver/intrinsic_test.cc", "../src/resolver/is_host_shareable_test.cc", "../src/resolver/is_storeable_test.cc", + "../src/resolver/resolver_test.cc", "../src/resolver/resolver_test_helper.cc", "../src/resolver/resolver_test_helper.h", - "../src/resolver/resolver_test.cc", "../src/resolver/storage_class_validation_test.cc", "../src/resolver/struct_layout_test.cc", "../src/resolver/struct_pipeline_stage_use_test.cc", @@ -265,32 +285,17 @@ tint_unittests_source_set("tint_unittests_core_src") { "../src/transform/emit_vertex_point_size_test.cc", "../src/transform/first_index_offset_test.cc", "../src/transform/renamer_test.cc", - "../src/transform/test_helper.h", "../src/transform/vertex_pulling_test.cc", - "../src/utils/command.h", "../src/utils/command_test.cc", - "../src/utils/command.h", "../src/utils/get_or_create_test.cc", "../src/utils/hash_test.cc", "../src/utils/math_test.cc", "../src/utils/tmpfile_test.cc", - "../src/utils/tmpfile.h", "../src/utils/unique_vector_test.cc", "../src/writer/append_vector_test.cc", "../src/writer/float_to_string_test.cc", ] - if (is_linux || is_mac) { - sources += [ "../src/utils/command_posix.cc" ] - sources += [ "../src/utils/tmpfile_posix.cc" ] - } else if (is_win) { - sources += [ "../src/utils/command_windows.cc" ] - sources += [ "../src/utils/tmpfile_windows.cc" ] - } else { - sources += [ "../src/utils/command_other.cc" ] - sources += [ "../src/utils/tmpfile_other.cc" ] - } - deps = [ ":tint_unittests_core_sem_src", "${tint_root_dir}/src:libtint_wgsl_reader_src", @@ -372,7 +377,10 @@ tint_unittests_source_set("tint_unittests_spv_writer_src") { "../src/writer/spirv/test_helper.h", ] - deps = [ "${tint_root_dir}/src:libtint_spv_writer_src" ] + deps = [ + "${tint_root_dir}/src:libtint_spv_writer_src", + "${tint_spirv_tools_dir}/:spvtools", + ] } tint_unittests_source_set("tint_unittests_wgsl_reader_src") {