From d54dabeab522febb901a6567d3b1cd7d063faff8 Mon Sep 17 00:00:00 2001 From: dan sinclair Date: Sat, 21 Jan 2023 18:50:20 +0000 Subject: [PATCH] Split the reader/ and writer/ out of libtint_core_all_src. This CL splits the code in `reader/` and `writer/` out of the `libtint_core_all_src` target and into individual `libtint_reader_src` and `libtint_writer_src` targets. The various readers and writers are updated to have the specific target as dependencies. The `deps` are moved to being private from `public_deps`. The places where dependencies were missing are updated. Change-Id: I4e30113cdc6b1e1941efa34ce6579f8f501201ad Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117242 Kokoro: Kokoro Commit-Queue: Dan Sinclair Reviewed-by: Ben Clayton --- src/tint/BUILD.gn | 109 +++++++++++++++++++++++++++++------------- src/tint/cmd/BUILD.gn | 1 + 2 files changed, 76 insertions(+), 34 deletions(-) diff --git a/src/tint/BUILD.gn b/src/tint/BUILD.gn index 941fc8350f..139f8ee8af 100644 --- a/src/tint/BUILD.gn +++ b/src/tint/BUILD.gn @@ -113,7 +113,7 @@ source_set("tint_utils_io") { sources += [ "utils/io/tmpfile_other.cc" ] } - public_deps = [ ":libtint_core_all_src" ] + deps = [ ":libtint_core_all_src" ] } ############################################################################### @@ -127,7 +127,10 @@ source_set("tint_val") { "val/msl.cc", "val/val.h", ] - public_deps = [ ":tint_utils_io" ] + deps = [ + ":libtint_core_all_src", + ":tint_utils_io", + ] } ############################################################################### @@ -398,8 +401,6 @@ libtint_source_set("libtint_core_all_src") { "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", @@ -612,24 +613,6 @@ libtint_source_set("libtint_core_all_src") { "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/check_supported_extensions.cc", - "writer/check_supported_extensions.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 || is_mac) { @@ -700,7 +683,7 @@ libtint_source_set("libtint_sem_src") { "sem/while_statement.h", ] - public_deps = [ ":libtint_core_all_src" ] + deps = [ ":libtint_core_all_src" ] } libtint_source_set("libtint_type_src") { @@ -768,7 +751,7 @@ libtint_source_set("libtint_type_src") { "type/void.h", ] - public_deps = [ ":libtint_core_all_src" ] + deps = [ ":libtint_core_all_src" ] } libtint_source_set("libtint_constant_src") { @@ -785,7 +768,7 @@ libtint_source_set("libtint_constant_src") { "constant/value.cc", "constant/value.h", ] - public_deps = [ ":libtint_core_all_src" ] + deps = [ ":libtint_core_all_src" ] } libtint_source_set("libtint_core_src") { @@ -794,9 +777,19 @@ libtint_source_set("libtint_core_src") { ":libtint_core_all_src", ":libtint_sem_src", ":libtint_type_src", + ":libtint_writer_src", ] } +libtint_source_set("libtint_reader_src") { + sources = [ + "reader/reader.cc", + "reader/reader.h", + ] + + deps = [ ":libtint_core_all_src" ] +} + libtint_source_set("libtint_spv_reader_src") { sources = [ "reader/spirv/construct.cc", @@ -820,14 +813,40 @@ libtint_source_set("libtint_spv_reader_src") { "reader/spirv/usage.h", ] - public_deps = [ - ":libtint_core_src", + deps = [ + ":libtint_core_all_src", + ":libtint_reader_src", "${tint_spirv_tools_dir}/:spvtools_opt", ] public_configs = [ "${tint_spirv_tools_dir}/:spvtools_internal_config" ] } +libtint_source_set("libtint_writer_src") { + sources = [ + "writer/append_vector.cc", + "writer/append_vector.h", + "writer/array_length_from_uniform_options.cc", + "writer/array_length_from_uniform_options.h", + "writer/check_supported_extensions.cc", + "writer/check_supported_extensions.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", + ] + + deps = [ ":libtint_core_all_src" ] +} + libtint_source_set("libtint_spv_writer_src") { sources = [ "writer/spirv/binary_writer.cc", @@ -847,7 +866,10 @@ libtint_source_set("libtint_spv_writer_src") { "writer/spirv/scalar_constant.h", ] - public_deps = [ ":libtint_core_src" ] + deps = [ + ":libtint_core_src", + ":libtint_writer_src", + ] } libtint_source_set("libtint_wgsl_reader_src") { @@ -863,7 +885,10 @@ libtint_source_set("libtint_wgsl_reader_src") { "reader/wgsl/token.h", ] - public_deps = [ ":libtint_core_src" ] + deps = [ + ":libtint_core_all_src", + ":libtint_reader_src", + ] } libtint_source_set("libtint_wgsl_writer_src") { @@ -874,7 +899,10 @@ libtint_source_set("libtint_wgsl_writer_src") { "writer/wgsl/generator_impl.h", ] - public_deps = [ ":libtint_core_src" ] + deps = [ + ":libtint_core_src", + ":libtint_writer_src", + ] } libtint_source_set("libtint_msl_writer_src") { @@ -885,7 +913,10 @@ libtint_source_set("libtint_msl_writer_src") { "writer/msl/generator_impl.h", ] - public_deps = [ ":libtint_core_src" ] + deps = [ + ":libtint_core_src", + ":libtint_writer_src", + ] } libtint_source_set("libtint_hlsl_writer_src") { @@ -896,7 +927,10 @@ libtint_source_set("libtint_hlsl_writer_src") { "writer/hlsl/generator_impl.h", ] - public_deps = [ ":libtint_core_src" ] + deps = [ + ":libtint_core_src", + ":libtint_writer_src", + ] } libtint_source_set("libtint_glsl_writer_src") { @@ -907,7 +941,10 @@ libtint_source_set("libtint_glsl_writer_src") { "writer/glsl/generator_impl.h", ] - public_deps = [ ":libtint_core_src" ] + deps = [ + ":libtint_core_src", + ":libtint_writer_src", + ] } source_set("libtint") { @@ -1386,6 +1423,7 @@ if (tint_build_unittests) { "writer/generate_external_texture_bindings_test.cc", "writer/text_generator_test.cc", ] + deps = [ ":libtint_writer_src" ] } tint_unittests_source_set("tint_unittests_spv_reader_src") { @@ -1425,7 +1463,10 @@ if (tint_build_unittests) { "reader/spirv/usage_test.cc", ] - deps = [ ":libtint_spv_reader_src" ] + deps = [ + ":libtint_spv_reader_src", + "${tint_spirv_tools_dir}/:spvtools_opt", + ] } tint_unittests_source_set("tint_unittests_spv_writer_src") { diff --git a/src/tint/cmd/BUILD.gn b/src/tint/cmd/BUILD.gn index c2f4322d67..3052d9e9f9 100644 --- a/src/tint/cmd/BUILD.gn +++ b/src/tint/cmd/BUILD.gn @@ -19,6 +19,7 @@ executable("tint") { sources = [ "main.cc" ] deps = [ "${tint_root_dir}/src/tint:libtint", + "${tint_root_dir}/src/tint:tint_utils_io", "${tint_root_dir}/src/tint:tint_val", "${tint_spirv_tools_dir}/:spvtools", "${tint_spirv_tools_dir}/:spvtools_opt",