From a0b513f0dac7498c7f70ac86e66c9390114ff90e Mon Sep 17 00:00:00 2001 From: Stephen Gutekanst Date: Sun, 13 Feb 2022 01:24:51 -0700 Subject: [PATCH] gpu-dawn: use source scanning for tint_core_all_src target Signed-off-by: Stephen Gutekanst --- gpu-dawn/build.zig | 30 ++-- .../src/dawn/sources/tint_core_all_src.cc | 132 ------------------ .../src/dawn/sources/tint_core_all_src_2.cc | 9 -- 3 files changed, 21 insertions(+), 150 deletions(-) delete mode 100644 gpu-dawn/src/dawn/sources/tint_core_all_src.cc delete mode 100644 gpu-dawn/src/dawn/sources/tint_core_all_src_2.cc diff --git a/gpu-dawn/build.zig b/gpu-dawn/build.zig index fca11c14..0f268fa8 100644 --- a/gpu-dawn/build.zig +++ b/gpu-dawn/build.zig @@ -846,12 +846,24 @@ fn buildLibTint(b: *Builder, step: *std.build.LibExeObjStep, options: Options) * // libtint_core_all_src var sources = std.ArrayList([]const u8).init(b.allocator); - sources.appendSlice(&.{ - thisDir() ++ "/src/dawn/sources/tint_core_all_src.cc", - thisDir() ++ "/src/dawn/sources/tint_core_all_src_2.cc", - thisDir() ++ "/libs/dawn/third_party/tint/src/ast/node.cc", - thisDir() ++ "/libs/dawn/third_party/tint/src/ast/texture.cc", - }) catch unreachable; + inline for (&[_][]const u8{ + "third_party/tint/src/ast/", + "third_party/tint/src/", + "third_party/tint/src/diagnostic/", + "third_party/tint/src/inspector/", + "third_party/tint/src/reader/", + "third_party/tint/src/resolver/", + "third_party/tint/src/transform/", + "third_party/tint/src/writer/", + "third_party/tint/src/ast/", + }) |dir| scanSources( + b, + &sources, + "libs/dawn/" ++ dir, + &.{ ".cpp", ".c", ".cc" }, + &.{}, + &.{ "test", "benchmark", "printer_windows", "printer_linux", "printer_other" }, + ) catch unreachable; const target = (std.zig.system.NativeTargetInfo.detect(b.allocator, step.target) catch unreachable).target; switch (target.os.tag) { @@ -867,7 +879,7 @@ fn buildLibTint(b: *Builder, step: *std.build.LibExeObjStep, options: Options) * "libs/dawn/third_party/tint/src/sem/", &.{ ".cpp", ".c", ".cc" }, &.{}, - &.{"test", "benchmark"}, + &.{ "test", "benchmark" }, ) catch unreachable; // libtint_spv_reader_src @@ -877,7 +889,7 @@ fn buildLibTint(b: *Builder, step: *std.build.LibExeObjStep, options: Options) * "libs/dawn/third_party/tint/src/reader/spirv/", &.{ ".cpp", ".c", ".cc" }, &.{}, - &.{"test", "benchmark"}, + &.{ "test", "benchmark" }, ) catch unreachable; // libtint_spv_writer_src @@ -887,7 +899,7 @@ fn buildLibTint(b: *Builder, step: *std.build.LibExeObjStep, options: Options) * "libs/dawn/third_party/tint/src/writer/spirv/", &.{ ".cpp", ".c", ".cc" }, &.{}, - &.{"test", "benchmark"}, + &.{ "test", "benchmark" }, ) catch unreachable; // TODO(build-system): make optional diff --git a/gpu-dawn/src/dawn/sources/tint_core_all_src.cc b/gpu-dawn/src/dawn/sources/tint_core_all_src.cc deleted file mode 100644 index 0945462b..00000000 --- a/gpu-dawn/src/dawn/sources/tint_core_all_src.cc +++ /dev/null @@ -1,132 +0,0 @@ -#include "third_party/tint/src/ast/access.cc" -#include "third_party/tint/src/ast/alias.cc" -#include "third_party/tint/src/ast/array.cc" -#include "third_party/tint/src/ast/assignment_statement.cc" -#include "third_party/tint/src/ast/atomic.cc" -#include "third_party/tint/src/ast/binary_expression.cc" -#include "third_party/tint/src/ast/binding_decoration.cc" -#include "third_party/tint/src/ast/bitcast_expression.cc" -#include "third_party/tint/src/ast/block_statement.cc" -#include "third_party/tint/src/ast/bool.cc" -#include "third_party/tint/src/ast/bool_literal_expression.cc" -#include "third_party/tint/src/ast/break_statement.cc" -#include "third_party/tint/src/ast/builtin.cc" -#include "third_party/tint/src/ast/builtin_decoration.cc" -#include "third_party/tint/src/ast/call_expression.cc" -#include "third_party/tint/src/ast/call_statement.cc" -#include "third_party/tint/src/ast/case_statement.cc" -#include "third_party/tint/src/ast/continue_statement.cc" -#include "third_party/tint/src/ast/depth_multisampled_texture.cc" -#include "third_party/tint/src/ast/disable_validation_decoration.cc" -#include "third_party/tint/src/ast/discard_statement.cc" -#include "third_party/tint/src/ast/else_statement.cc" -#include "third_party/tint/src/ast/external_texture.cc" -#include "third_party/tint/src/ast/f32.cc" -#include "third_party/tint/src/ast/fallthrough_statement.cc" -#include "third_party/tint/src/ast/float_literal_expression.cc" -#include "third_party/tint/src/ast/for_loop_statement.cc" -#include "third_party/tint/src/ast/function.cc" -#include "third_party/tint/src/ast/group_decoration.cc" -#include "third_party/tint/src/ast/i32.cc" -#include "third_party/tint/src/ast/identifier_expression.cc" -#include "third_party/tint/src/ast/if_statement.cc" -#include "third_party/tint/src/ast/index_accessor_expression.cc" -#include "third_party/tint/src/ast/int_literal_expression.cc" -#include "third_party/tint/src/ast/interpolate_decoration.cc" -#include "third_party/tint/src/ast/invariant_decoration.cc" -#include "third_party/tint/src/ast/location_decoration.cc" -#include "third_party/tint/src/ast/loop_statement.cc" -#include "third_party/tint/src/ast/matrix.cc" -#include "third_party/tint/src/ast/member_accessor_expression.cc" -#include "third_party/tint/src/ast/module.cc" -#include "third_party/tint/src/ast/multisampled_texture.cc" -#include "third_party/tint/src/ast/override_decoration.cc" -#include "third_party/tint/src/ast/phony_expression.cc" -#include "third_party/tint/src/ast/pipeline_stage.cc" -#include "third_party/tint/src/ast/pointer.cc" -#include "third_party/tint/src/ast/return_statement.cc" -#include "third_party/tint/src/ast/sampled_texture.cc" -#include "third_party/tint/src/ast/sampler.cc" -#include "third_party/tint/src/ast/sint_literal_expression.cc" -#include "third_party/tint/src/ast/stage_decoration.cc" -#include "third_party/tint/src/ast/storage_class.cc" -#include "third_party/tint/src/ast/storage_texture.cc" -#include "third_party/tint/src/ast/stride_decoration.cc" -#include "third_party/tint/src/ast/struct.cc" -#include "third_party/tint/src/ast/struct_block_decoration.cc" -#include "third_party/tint/src/ast/struct_member.cc" -#include "third_party/tint/src/ast/struct_member_align_decoration.cc" -#include "third_party/tint/src/ast/struct_member_offset_decoration.cc" -#include "third_party/tint/src/ast/struct_member_size_decoration.cc" -#include "third_party/tint/src/ast/switch_statement.cc" -#include "third_party/tint/src/ast/type_name.cc" -#include "third_party/tint/src/ast/u32.cc" -#include "third_party/tint/src/ast/uint_literal_expression.cc" -#include "third_party/tint/src/ast/unary_op.cc" -#include "third_party/tint/src/ast/unary_op_expression.cc" -#include "third_party/tint/src/ast/variable.cc" -#include "third_party/tint/src/ast/variable_decl_statement.cc" -#include "third_party/tint/src/ast/vector.cc" -#include "third_party/tint/src/ast/void.cc" -#include "third_party/tint/src/ast/workgroup_decoration.cc" -#include "third_party/tint/src/castable.cc" -#include "third_party/tint/src/clone_context.cc" -#include "third_party/tint/src/debug.cc" -#include "third_party/tint/src/demangler.cc" -#include "third_party/tint/src/diagnostic/diagnostic.cc" -#include "third_party/tint/src/diagnostic/formatter.cc" -#include "third_party/tint/src/diagnostic/printer.cc" -#include "third_party/tint/src/inspector/entry_point.cc" -#include "third_party/tint/src/inspector/inspector.cc" -#include "third_party/tint/src/inspector/resource_binding.cc" -#include "third_party/tint/src/inspector/scalar.cc" -#include "third_party/tint/src/intrinsic_table.cc" -#include "third_party/tint/src/program.cc" -#include "third_party/tint/src/program_builder.cc" -#include "third_party/tint/src/program_id.cc" -#include "third_party/tint/src/reader/reader.cc" -#include "third_party/tint/src/resolver/dependency_graph.cc" -#include "third_party/tint/src/resolver/resolver.cc" -#include "third_party/tint/src/resolver/resolver_constants.cc" -#include "third_party/tint/src/resolver/resolver_validation.cc" -#include "third_party/tint/src/source.cc" -#include "third_party/tint/src/symbol.cc" -#include "third_party/tint/src/symbol_table.cc" -#include "third_party/tint/src/transform/add_empty_entry_point.cc" -#include "third_party/tint/src/transform/add_spirv_block_decoration.cc" -#include "third_party/tint/src/transform/array_length_from_uniform.cc" -#include "third_party/tint/src/transform/binding_remapper.cc" -#include "third_party/tint/src/transform/calculate_array_length.cc" -#include "third_party/tint/src/transform/canonicalize_entry_point_io.cc" -#include "third_party/tint/src/transform/decompose_memory_access.cc" -#include "third_party/tint/src/transform/decompose_strided_matrix.cc" -#include "third_party/tint/src/transform/external_texture_transform.cc" -#include "third_party/tint/src/transform/first_index_offset.cc" -#include "third_party/tint/src/transform/fold_constants.cc" -#include "third_party/tint/src/transform/fold_trivial_single_use_lets.cc" -#include "third_party/tint/src/transform/for_loop_to_loop.cc" -#include "third_party/tint/src/transform/localize_struct_array_assignment.cc" -#include "third_party/tint/src/transform/loop_to_for_loop.cc" -#include "third_party/tint/src/transform/manager.cc" -#include "third_party/tint/src/transform/module_scope_var_to_entry_point_param.cc" -#include "third_party/tint/src/transform/multiplanar_external_texture.cc" -#include "third_party/tint/src/transform/num_workgroups_from_uniform.cc" -#include "third_party/tint/src/transform/pad_array_elements.cc" -#include "third_party/tint/src/transform/promote_initializers_to_const_var.cc" -#include "third_party/tint/src/transform/remove_phonies.cc" -#include "third_party/tint/src/transform/remove_unreachable_statements.cc" -#include "third_party/tint/src/transform/renamer.cc" -#include "third_party/tint/src/transform/robustness.cc" -#include "third_party/tint/src/transform/simplify_pointers.cc" -#include "third_party/tint/src/transform/single_entry_point.cc" -#include "third_party/tint/src/transform/unshadow.cc" -#include "third_party/tint/src/transform/vectorize_scalar_matrix_constructors.cc" -#include "third_party/tint/src/transform/vertex_pulling.cc" -#include "third_party/tint/src/transform/wrap_arrays_in_structs.cc" -#include "third_party/tint/src/transform/zero_init_workgroup_memory.cc" -#include "third_party/tint/src/writer/append_vector.cc" -#include "third_party/tint/src/writer/array_length_from_uniform_options.cc" -#include "third_party/tint/src/writer/float_to_string.cc" -#include "third_party/tint/src/writer/text.cc" -#include "third_party/tint/src/writer/text_generator.cc" -#include "third_party/tint/src/writer/writer.cc" diff --git a/gpu-dawn/src/dawn/sources/tint_core_all_src_2.cc b/gpu-dawn/src/dawn/sources/tint_core_all_src_2.cc deleted file mode 100644 index 4aacd71e..00000000 --- a/gpu-dawn/src/dawn/sources/tint_core_all_src_2.cc +++ /dev/null @@ -1,9 +0,0 @@ -#include "third_party/tint/src/ast/ast_type.cc" -#include "third_party/tint/src/ast/decoration.cc" -#include "third_party/tint/src/ast/depth_texture.cc" -#include "third_party/tint/src/ast/expression.cc" -#include "third_party/tint/src/ast/internal_decoration.cc" -#include "third_party/tint/src/ast/literal_expression.cc" -#include "third_party/tint/src/ast/statement.cc" -#include "third_party/tint/src/ast/type_decl.cc" -#include "third_party/tint/src/transform/transform.cc"