2020-04-08 20:40:25 +00:00
|
|
|
# Copyright 2020 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")
|
2020-04-17 13:18:20 +00:00
|
|
|
import("//testing/test.gni")
|
2020-04-15 20:35:38 +00:00
|
|
|
import("tint_overrides_with_defaults.gni")
|
2020-04-08 20:40:25 +00:00
|
|
|
|
2020-04-17 13:18:20 +00:00
|
|
|
###############################################################################
|
|
|
|
# Common - Configs, etc. shared across targets
|
|
|
|
###############################################################################
|
|
|
|
|
2020-04-08 20:40:25 +00:00
|
|
|
config("tint_common_config") {
|
|
|
|
defines = []
|
2020-04-15 20:35:38 +00:00
|
|
|
|
|
|
|
if (tint_build_spv_reader) {
|
|
|
|
defines += [ "TINT_BUILD_SPV_READER=1" ]
|
|
|
|
} else {
|
|
|
|
defines += [ "TINT_BUILD_SPV_READER=0" ]
|
|
|
|
}
|
2020-04-15 20:37:02 +00:00
|
|
|
|
|
|
|
if (tint_build_spv_writer) {
|
|
|
|
defines += [ "TINT_BUILD_SPV_WRITER=1" ]
|
|
|
|
} else {
|
|
|
|
defines += [ "TINT_BUILD_SPV_WRITER=0" ]
|
|
|
|
}
|
2020-04-15 20:47:55 +00:00
|
|
|
|
|
|
|
if (tint_build_wgsl_reader) {
|
|
|
|
defines += [ "TINT_BUILD_WGSL_READER=1" ]
|
|
|
|
} else {
|
|
|
|
defines += [ "TINT_BUILD_WGSL_READER=0" ]
|
|
|
|
}
|
2020-04-15 20:54:10 +00:00
|
|
|
|
|
|
|
if (tint_build_wgsl_writer) {
|
|
|
|
defines += [ "TINT_BUILD_WGSL_WRITER=1" ]
|
|
|
|
} else {
|
|
|
|
defines += [ "TINT_BUILD_WGSL_WRITER=0" ]
|
|
|
|
}
|
2020-04-08 20:40:25 +00:00
|
|
|
}
|
|
|
|
|
2020-04-17 13:18:20 +00:00
|
|
|
###############################################################################
|
|
|
|
# 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.
|
2020-04-15 20:35:38 +00:00
|
|
|
#
|
2020-04-17 13:18:20 +00:00
|
|
|
# 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.
|
2020-04-15 20:35:38 +00:00
|
|
|
|
2020-04-17 13:18:20 +00:00
|
|
|
source_set("libtint_core_src") {
|
2020-04-08 20:40:25 +00:00
|
|
|
sources = [
|
|
|
|
"src/ast/array_accessor_expression.cc",
|
|
|
|
"src/ast/array_accessor_expression.h",
|
|
|
|
"src/ast/as_expression.cc",
|
|
|
|
"src/ast/as_expression.h",
|
|
|
|
"src/ast/assignment_statement.cc",
|
|
|
|
"src/ast/assignment_statement.h",
|
|
|
|
"src/ast/binary_expression.cc",
|
|
|
|
"src/ast/binary_expression.h",
|
|
|
|
"src/ast/binding_decoration.cc",
|
|
|
|
"src/ast/binding_decoration.h",
|
|
|
|
"src/ast/bool_literal.cc",
|
2020-04-09 18:52:06 +00:00
|
|
|
"src/ast/bool_literal.h",
|
2020-04-08 20:40:25 +00:00
|
|
|
"src/ast/break_statement.cc",
|
|
|
|
"src/ast/break_statement.h",
|
|
|
|
"src/ast/builtin.cc",
|
|
|
|
"src/ast/builtin.h",
|
|
|
|
"src/ast/builtin_decoration.cc",
|
|
|
|
"src/ast/builtin_decoration.h",
|
|
|
|
"src/ast/call_expression.cc",
|
|
|
|
"src/ast/call_expression.h",
|
|
|
|
"src/ast/case_statement.cc",
|
|
|
|
"src/ast/case_statement.h",
|
|
|
|
"src/ast/cast_expression.cc",
|
|
|
|
"src/ast/cast_expression.h",
|
|
|
|
"src/ast/constructor_expression.cc",
|
|
|
|
"src/ast/constructor_expression.h",
|
|
|
|
"src/ast/continue_statement.cc",
|
|
|
|
"src/ast/continue_statement.h",
|
|
|
|
"src/ast/decorated_variable.cc",
|
|
|
|
"src/ast/decorated_variable.h",
|
|
|
|
"src/ast/derivative_modifier.cc",
|
|
|
|
"src/ast/derivative_modifier.h",
|
|
|
|
"src/ast/else_statement.cc",
|
|
|
|
"src/ast/else_statement.h",
|
|
|
|
"src/ast/entry_point.cc",
|
|
|
|
"src/ast/entry_point.h",
|
|
|
|
"src/ast/expression.cc",
|
|
|
|
"src/ast/expression.h",
|
|
|
|
"src/ast/fallthrough_statement.cc",
|
|
|
|
"src/ast/fallthrough_statement.h",
|
|
|
|
"src/ast/float_literal.cc",
|
|
|
|
"src/ast/float_literal.h",
|
|
|
|
"src/ast/function.cc",
|
|
|
|
"src/ast/function.h",
|
|
|
|
"src/ast/identifier_expression.cc",
|
|
|
|
"src/ast/identifier_expression.h",
|
|
|
|
"src/ast/if_statement.cc",
|
|
|
|
"src/ast/if_statement.h",
|
|
|
|
"src/ast/import.cc",
|
|
|
|
"src/ast/import.h",
|
|
|
|
"src/ast/int_literal.cc",
|
|
|
|
"src/ast/int_literal.h",
|
|
|
|
"src/ast/kill_statement.cc",
|
|
|
|
"src/ast/kill_statement.h",
|
|
|
|
"src/ast/literal.cc",
|
2020-04-09 18:52:06 +00:00
|
|
|
"src/ast/literal.h",
|
2020-04-08 20:40:25 +00:00
|
|
|
"src/ast/location_decoration.cc",
|
|
|
|
"src/ast/location_decoration.h",
|
|
|
|
"src/ast/loop_statement.cc",
|
|
|
|
"src/ast/loop_statement.h",
|
|
|
|
"src/ast/member_accessor_expression.cc",
|
|
|
|
"src/ast/member_accessor_expression.h",
|
|
|
|
"src/ast/module.cc",
|
|
|
|
"src/ast/module.h",
|
|
|
|
"src/ast/node.cc",
|
|
|
|
"src/ast/node.h",
|
|
|
|
"src/ast/nop_statement.cc",
|
|
|
|
"src/ast/nop_statement.h",
|
|
|
|
"src/ast/pipeline_stage.cc",
|
|
|
|
"src/ast/pipeline_stage.h",
|
|
|
|
"src/ast/return_statement.cc",
|
|
|
|
"src/ast/return_statement.h",
|
|
|
|
"src/ast/scalar_constructor_expression.cc",
|
|
|
|
"src/ast/scalar_constructor_expression.h",
|
|
|
|
"src/ast/set_decoration.cc",
|
|
|
|
"src/ast/set_decoration.h",
|
|
|
|
"src/ast/statement.cc",
|
|
|
|
"src/ast/statement.h",
|
|
|
|
"src/ast/statement_condition.cc",
|
|
|
|
"src/ast/statement_condition.h",
|
|
|
|
"src/ast/storage_class.cc",
|
|
|
|
"src/ast/storage_class.h",
|
|
|
|
"src/ast/struct.cc",
|
|
|
|
"src/ast/struct.h",
|
2020-04-09 18:52:06 +00:00
|
|
|
"src/ast/struct_decoration.cc",
|
|
|
|
"src/ast/struct_decoration.h",
|
2020-04-08 20:40:25 +00:00
|
|
|
"src/ast/struct_member.cc",
|
|
|
|
"src/ast/struct_member.h",
|
|
|
|
"src/ast/struct_member_decoration.cc",
|
|
|
|
"src/ast/struct_member_decoration.h",
|
|
|
|
"src/ast/struct_member_offset_decoration.cc",
|
|
|
|
"src/ast/struct_member_offset_decoration.h",
|
|
|
|
"src/ast/switch_statement.cc",
|
|
|
|
"src/ast/switch_statement.h",
|
|
|
|
"src/ast/type/alias_type.cc",
|
|
|
|
"src/ast/type/alias_type.h",
|
|
|
|
"src/ast/type/array_type.cc",
|
|
|
|
"src/ast/type/array_type.h",
|
|
|
|
"src/ast/type/bool_type.cc",
|
|
|
|
"src/ast/type/bool_type.h",
|
|
|
|
"src/ast/type/f32_type.cc",
|
|
|
|
"src/ast/type/f32_type.h",
|
|
|
|
"src/ast/type/i32_type.cc",
|
|
|
|
"src/ast/type/i32_type.h",
|
|
|
|
"src/ast/type/matrix_type.cc",
|
|
|
|
"src/ast/type/matrix_type.h",
|
|
|
|
"src/ast/type/pointer_type.cc",
|
|
|
|
"src/ast/type/pointer_type.h",
|
|
|
|
"src/ast/type/struct_type.cc",
|
|
|
|
"src/ast/type/struct_type.h",
|
|
|
|
"src/ast/type/type.cc",
|
|
|
|
"src/ast/type/type.h",
|
|
|
|
"src/ast/type/u32_type.cc",
|
|
|
|
"src/ast/type/u32_type.h",
|
|
|
|
"src/ast/type/vector_type.cc",
|
|
|
|
"src/ast/type/vector_type.h",
|
|
|
|
"src/ast/type/void_type.cc",
|
|
|
|
"src/ast/type/void_type.h",
|
2020-04-09 18:52:06 +00:00
|
|
|
"src/ast/type_constructor_expression.cc",
|
|
|
|
"src/ast/type_constructor_expression.h",
|
2020-04-08 20:40:25 +00:00
|
|
|
"src/ast/uint_literal.cc",
|
|
|
|
"src/ast/uint_literal.h",
|
|
|
|
"src/ast/unary_derivative.cc",
|
|
|
|
"src/ast/unary_derivative.h",
|
|
|
|
"src/ast/unary_derivative_expression.cc",
|
|
|
|
"src/ast/unary_derivative_expression.h",
|
|
|
|
"src/ast/unary_method.cc",
|
|
|
|
"src/ast/unary_method.h",
|
|
|
|
"src/ast/unary_method_expression.cc",
|
|
|
|
"src/ast/unary_method_expression.h",
|
|
|
|
"src/ast/unary_op.cc",
|
|
|
|
"src/ast/unary_op.h",
|
|
|
|
"src/ast/unary_op_expression.cc",
|
|
|
|
"src/ast/unary_op_expression.h",
|
|
|
|
"src/ast/unless_statement.cc",
|
|
|
|
"src/ast/unless_statement.h",
|
|
|
|
"src/ast/variable.cc",
|
|
|
|
"src/ast/variable.h",
|
|
|
|
"src/ast/variable_decl_statement.cc",
|
|
|
|
"src/ast/variable_decl_statement.h",
|
2020-04-09 18:52:06 +00:00
|
|
|
"src/ast/variable_decoration.cc",
|
|
|
|
"src/ast/variable_decoration.h",
|
2020-04-08 20:40:25 +00:00
|
|
|
"src/context.cc",
|
2020-04-09 18:52:06 +00:00
|
|
|
"src/context.h",
|
2020-04-08 20:40:25 +00:00
|
|
|
"src/reader/reader.cc",
|
|
|
|
"src/reader/reader.h",
|
|
|
|
"src/scope_stack.h",
|
|
|
|
"src/source.h",
|
|
|
|
"src/type_determiner.cc",
|
|
|
|
"src/type_determiner.h",
|
|
|
|
"src/type_manager.cc",
|
|
|
|
"src/type_manager.h",
|
|
|
|
"src/validator.cc",
|
|
|
|
"src/validator.h",
|
|
|
|
"src/validator_impl.cc",
|
|
|
|
"src/validator_impl.h",
|
|
|
|
"src/writer/writer.cc",
|
|
|
|
"src/writer/writer.h",
|
|
|
|
]
|
|
|
|
|
2020-04-09 18:52:06 +00:00
|
|
|
configs += [ ":tint_common_config" ]
|
|
|
|
|
2020-04-08 20:40:25 +00:00
|
|
|
if (build_with_chromium) {
|
|
|
|
configs -= [ "//build/config/compiler:chromium_code" ]
|
|
|
|
configs += [ "//build/config/compiler:no_chromium_code" ]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-17 13:18:20 +00:00
|
|
|
config("libtint_spv_config") {
|
2020-04-15 20:35:38 +00:00
|
|
|
include_dirs = [
|
|
|
|
"${tint_spirv_tools_dir}/",
|
|
|
|
"${tint_spirv_tools_dir}/include",
|
|
|
|
"${target_gen_dir}/${tint_spirv_tools_gen}",
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
2020-04-17 13:18:20 +00:00
|
|
|
source_set("libtint_spv_reader_src") {
|
2020-04-15 20:35:38 +00:00
|
|
|
sources = [
|
|
|
|
"src/reader/spirv/enum_converter.cc",
|
|
|
|
"src/reader/spirv/enum_converter.h",
|
|
|
|
"src/reader/spirv/fail_stream.h",
|
|
|
|
"src/reader/spirv/function.cc",
|
|
|
|
"src/reader/spirv/function.h",
|
|
|
|
"src/reader/spirv/namer.cc",
|
|
|
|
"src/reader/spirv/namer.h",
|
|
|
|
"src/reader/spirv/parser.cc",
|
|
|
|
"src/reader/spirv/parser.h",
|
|
|
|
"src/reader/spirv/parser_impl.cc",
|
|
|
|
"src/reader/spirv/parser_impl.h",
|
|
|
|
]
|
|
|
|
|
|
|
|
deps = [
|
|
|
|
"${tint_spirv_headers_dir}/:spv_headers",
|
|
|
|
"${tint_spirv_tools_dir}/:spvtools_opt",
|
|
|
|
"${tint_spirv_tools_dir}/:spvtools_val",
|
|
|
|
]
|
|
|
|
|
2020-04-17 13:18:20 +00:00
|
|
|
configs += [
|
|
|
|
":tint_common_config",
|
|
|
|
":libtint_spv_config",
|
|
|
|
]
|
2020-04-15 20:35:38 +00:00
|
|
|
|
|
|
|
if (build_with_chromium) {
|
|
|
|
configs -= [ "//build/config/compiler:chromium_code" ]
|
|
|
|
configs += [ "//build/config/compiler:no_chromium_code" ]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-17 13:18:20 +00:00
|
|
|
source_set("libtint_spv_writer_src") {
|
2020-04-15 20:37:02 +00:00
|
|
|
sources = [
|
|
|
|
"src/writer/spirv/binary_writer.cc",
|
|
|
|
"src/writer/spirv/binary_writer.h",
|
|
|
|
"src/writer/spirv/builder.cc",
|
|
|
|
"src/writer/spirv/builder.h",
|
|
|
|
"src/writer/spirv/function.cc",
|
|
|
|
"src/writer/spirv/function.h",
|
|
|
|
"src/writer/spirv/generator.cc",
|
|
|
|
"src/writer/spirv/generator.h",
|
|
|
|
"src/writer/spirv/instruction.cc",
|
|
|
|
"src/writer/spirv/instruction.h",
|
|
|
|
"src/writer/spirv/operand.cc",
|
|
|
|
"src/writer/spirv/operand.h",
|
|
|
|
]
|
|
|
|
|
|
|
|
deps = [ "${tint_spirv_headers_dir}/:spv_headers" ]
|
|
|
|
|
2020-04-17 13:18:20 +00:00
|
|
|
configs += [
|
|
|
|
":tint_common_config",
|
|
|
|
":libtint_spv_config",
|
|
|
|
]
|
2020-04-15 20:37:02 +00:00
|
|
|
|
|
|
|
if (build_with_chromium) {
|
|
|
|
configs -= [ "//build/config/compiler:chromium_code" ]
|
|
|
|
configs += [ "//build/config/compiler:no_chromium_code" ]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-17 13:18:20 +00:00
|
|
|
source_set("libtint_wgsl_reader_src") {
|
2020-04-15 20:47:55 +00:00
|
|
|
sources = [
|
|
|
|
"src/reader/wgsl/lexer.cc",
|
|
|
|
"src/reader/wgsl/lexer.h",
|
|
|
|
"src/reader/wgsl/parser.cc",
|
|
|
|
"src/reader/wgsl/parser.h",
|
|
|
|
"src/reader/wgsl/parser_impl.cc",
|
|
|
|
"src/reader/wgsl/parser_impl.h",
|
|
|
|
"src/reader/wgsl/token.cc",
|
|
|
|
"src/reader/wgsl/token.h",
|
|
|
|
]
|
|
|
|
|
|
|
|
configs += [ ":tint_common_config" ]
|
|
|
|
|
|
|
|
if (build_with_chromium) {
|
|
|
|
configs -= [ "//build/config/compiler:chromium_code" ]
|
|
|
|
configs += [ "//build/config/compiler:no_chromium_code" ]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-17 13:18:20 +00:00
|
|
|
source_set("libtint_wgsl_writer_src") {
|
2020-04-15 20:54:10 +00:00
|
|
|
sources = [
|
|
|
|
"src/writer/wgsl/generator.cc",
|
|
|
|
"src/writer/wgsl/generator.h",
|
|
|
|
"src/writer/wgsl/generator_impl.cc",
|
|
|
|
"src/writer/wgsl/generator_impl.h",
|
|
|
|
]
|
|
|
|
|
|
|
|
configs += [ ":tint_common_config" ]
|
|
|
|
|
|
|
|
if (build_with_chromium) {
|
|
|
|
configs -= [ "//build/config/compiler:chromium_code" ]
|
|
|
|
configs += [ "//build/config/compiler:no_chromium_code" ]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-15 20:35:38 +00:00
|
|
|
source_set("libtint") {
|
2020-04-17 13:18:20 +00:00
|
|
|
deps = [ ":libtint_core_src" ]
|
2020-04-15 20:47:55 +00:00
|
|
|
|
2020-04-15 20:35:38 +00:00
|
|
|
if (tint_build_spv_reader) {
|
2020-04-17 13:18:20 +00:00
|
|
|
deps += [ ":libtint_spv_reader_src" ]
|
2020-04-15 20:35:38 +00:00
|
|
|
}
|
|
|
|
|
2020-04-15 20:37:02 +00:00
|
|
|
if (tint_build_spv_writer) {
|
2020-04-17 13:18:20 +00:00
|
|
|
deps += [ ":libtint_spv_writer_src" ]
|
2020-04-15 20:37:02 +00:00
|
|
|
}
|
|
|
|
|
2020-04-15 20:47:55 +00:00
|
|
|
if (tint_build_wgsl_reader) {
|
2020-04-17 13:18:20 +00:00
|
|
|
deps += [ ":libtint_wgsl_reader_src" ]
|
2020-04-15 20:47:55 +00:00
|
|
|
}
|
|
|
|
|
2020-04-15 20:54:10 +00:00
|
|
|
if (tint_build_wgsl_writer) {
|
2020-04-17 13:18:20 +00:00
|
|
|
deps += [ ":libtint_wgsl_writer_src" ]
|
2020-04-15 20:54:10 +00:00
|
|
|
}
|
|
|
|
|
2020-04-15 20:35:38 +00:00
|
|
|
configs += [ ":tint_common_config" ]
|
|
|
|
|
|
|
|
if (build_with_chromium) {
|
|
|
|
configs -= [ "//build/config/compiler:chromium_code" ]
|
|
|
|
configs += [ "//build/config/compiler:no_chromium_code" ]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-17 13:18:20 +00:00
|
|
|
###############################################################################
|
|
|
|
# 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",
|
|
|
|
"${tint_googletest_dir}/googlemock/src/gmock_main.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",
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
# Tests - For libtint core and optional modules
|
|
|
|
###############################################################################
|
|
|
|
config("tint_unittests_config") {
|
|
|
|
include_dirs = [
|
|
|
|
"${tint_googletest_dir}/googlemock/include",
|
|
|
|
"${tint_googletest_dir}/googletest/include",
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
source_set("tint_unittests_core_src") {
|
|
|
|
sources = [
|
|
|
|
"src/ast/array_accessor_expression_test.cc",
|
|
|
|
"src/ast/as_expression_test.cc",
|
|
|
|
"src/ast/assignment_statement_test.cc",
|
|
|
|
"src/ast/binary_expression_test.cc",
|
|
|
|
"src/ast/binding_decoration_test.cc",
|
|
|
|
"src/ast/bool_literal_test.cc",
|
|
|
|
"src/ast/break_statement_test.cc",
|
|
|
|
"src/ast/builtin_decoration_test.cc",
|
|
|
|
"src/ast/call_expression_test.cc",
|
|
|
|
"src/ast/case_statement_test.cc",
|
|
|
|
"src/ast/cast_expression_test.cc",
|
|
|
|
"src/ast/continue_statement_test.cc",
|
|
|
|
"src/ast/decorated_variable_test.cc",
|
|
|
|
"src/ast/else_statement_test.cc",
|
|
|
|
"src/ast/entry_point_test.cc",
|
|
|
|
"src/ast/fallthrough_statement_test.cc",
|
|
|
|
"src/ast/float_literal_test.cc",
|
|
|
|
"src/ast/function_test.cc",
|
|
|
|
"src/ast/identifier_expression_test.cc",
|
|
|
|
"src/ast/if_statement_test.cc",
|
|
|
|
"src/ast/import_test.cc",
|
|
|
|
"src/ast/int_literal_test.cc",
|
|
|
|
"src/ast/kill_statement_test.cc",
|
|
|
|
"src/ast/location_decoration_test.cc",
|
|
|
|
"src/ast/loop_statement_test.cc",
|
|
|
|
"src/ast/member_accessor_expression_test.cc",
|
|
|
|
"src/ast/module_test.cc",
|
|
|
|
"src/ast/nop_statement_test.cc",
|
|
|
|
"src/ast/return_statement_test.cc",
|
|
|
|
"src/ast/scalar_constructor_expression_test.cc",
|
|
|
|
"src/ast/set_decoration_test.cc",
|
|
|
|
"src/ast/struct_member_offset_decoration_test.cc",
|
|
|
|
"src/ast/struct_member_test.cc",
|
|
|
|
"src/ast/struct_test.cc",
|
|
|
|
"src/ast/switch_statement_test.cc",
|
|
|
|
"src/ast/type/alias_type_test.cc",
|
|
|
|
"src/ast/type/array_type_test.cc",
|
|
|
|
"src/ast/type/bool_type_test.cc",
|
|
|
|
"src/ast/type/f32_type_test.cc",
|
|
|
|
"src/ast/type/i32_type_test.cc",
|
|
|
|
"src/ast/type/matrix_type_test.cc",
|
|
|
|
"src/ast/type/pointer_type_test.cc",
|
|
|
|
"src/ast/type/struct_type_test.cc",
|
|
|
|
"src/ast/type/u32_type_test.cc",
|
|
|
|
"src/ast/type/vector_type_test.cc",
|
|
|
|
"src/ast/type_constructor_expression_test.cc",
|
|
|
|
"src/ast/uint_literal_test.cc",
|
|
|
|
"src/ast/unary_derivative_expression_test.cc",
|
|
|
|
"src/ast/unary_method_expression_test.cc",
|
|
|
|
"src/ast/unary_op_expression_test.cc",
|
|
|
|
"src/ast/unless_statement_test.cc",
|
|
|
|
"src/ast/variable_decl_statement_test.cc",
|
|
|
|
"src/ast/variable_test.cc",
|
|
|
|
"src/scope_stack_test.cc",
|
|
|
|
"src/type_determiner_test.cc",
|
|
|
|
"src/type_manager_test.cc",
|
|
|
|
"src/validator_impl_import_test.cc",
|
|
|
|
]
|
|
|
|
|
|
|
|
configs += [
|
|
|
|
":tint_common_config",
|
|
|
|
":tint_unittests_config",
|
|
|
|
]
|
|
|
|
|
|
|
|
if (build_with_chromium) {
|
|
|
|
configs -= [ "//build/config/compiler:chromium_code" ]
|
|
|
|
configs += [ "//build/config/compiler:no_chromium_code" ]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
source_set("tint_unittests_spv_reader_src") {
|
|
|
|
sources = [
|
|
|
|
"src/reader/spirv/enum_converter_test.cc",
|
|
|
|
"src/reader/spirv/fail_stream_test.cc",
|
|
|
|
"src/reader/spirv/function_arithmetic_test.cc",
|
|
|
|
"src/reader/spirv/function_decl_test.cc",
|
|
|
|
"src/reader/spirv/function_logical_test.cc",
|
|
|
|
"src/reader/spirv/function_memory_test.cc",
|
|
|
|
"src/reader/spirv/function_var_test.cc",
|
|
|
|
"src/reader/spirv/namer_test.cc",
|
|
|
|
"src/reader/spirv/parser_impl_convert_member_decoration_test.cc",
|
|
|
|
"src/reader/spirv/parser_impl_convert_type_test.cc",
|
|
|
|
"src/reader/spirv/parser_impl_entry_point_test.cc",
|
|
|
|
"src/reader/spirv/parser_impl_function_decl_test.cc",
|
|
|
|
"src/reader/spirv/parser_impl_get_decorations_test.cc",
|
|
|
|
"src/reader/spirv/parser_impl_import_test.cc",
|
|
|
|
"src/reader/spirv/parser_impl_module_var_test.cc",
|
|
|
|
"src/reader/spirv/parser_impl_named_types_test.cc",
|
|
|
|
"src/reader/spirv/parser_impl_test.cc",
|
|
|
|
"src/reader/spirv/parser_impl_user_name_test.cc",
|
|
|
|
"src/reader/spirv/parser_test.cc",
|
|
|
|
"src/reader/spirv/spirv_tools_helpers_test.cc",
|
|
|
|
"src/reader/spirv/spirv_tools_helpers_test.h",
|
|
|
|
]
|
|
|
|
|
|
|
|
deps = [ "${tint_spirv_headers_dir}/:spv_headers" ]
|
|
|
|
|
|
|
|
configs += [
|
|
|
|
":libtint_spv_config",
|
|
|
|
":tint_common_config",
|
|
|
|
":tint_unittests_config",
|
|
|
|
]
|
|
|
|
|
|
|
|
if (build_with_chromium) {
|
|
|
|
configs -= [ "//build/config/compiler:chromium_code" ]
|
|
|
|
configs += [ "//build/config/compiler:no_chromium_code" ]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
source_set("tint_unittests_spv_writer_src") {
|
|
|
|
sources = [
|
|
|
|
"src/writer/spirv/binary_writer_test.cc",
|
|
|
|
"src/writer/spirv/builder_assign_test.cc",
|
|
|
|
"src/writer/spirv/builder_binary_expression_test.cc",
|
|
|
|
"src/writer/spirv/builder_constructor_expression_test.cc",
|
|
|
|
"src/writer/spirv/builder_entry_point_test.cc",
|
|
|
|
"src/writer/spirv/builder_function_test.cc",
|
|
|
|
"src/writer/spirv/builder_function_variable_test.cc",
|
|
|
|
"src/writer/spirv/builder_global_variable_test.cc",
|
|
|
|
"src/writer/spirv/builder_ident_expression_test.cc",
|
|
|
|
"src/writer/spirv/builder_if_test.cc",
|
|
|
|
"src/writer/spirv/builder_literal_test.cc",
|
|
|
|
"src/writer/spirv/builder_return_test.cc",
|
|
|
|
"src/writer/spirv/builder_test.cc",
|
|
|
|
"src/writer/spirv/builder_type_test.cc",
|
|
|
|
"src/writer/spirv/instruction_test.cc",
|
|
|
|
"src/writer/spirv/operand_test.cc",
|
|
|
|
"src/writer/spirv/spv_dump.cc",
|
|
|
|
"src/writer/spirv/spv_dump.h",
|
|
|
|
]
|
|
|
|
deps = [ "${tint_spirv_headers_dir}/:spv_headers" ]
|
|
|
|
|
|
|
|
configs += [
|
|
|
|
":libtint_spv_config",
|
|
|
|
":tint_common_config",
|
|
|
|
":tint_unittests_config",
|
|
|
|
]
|
|
|
|
|
|
|
|
if (build_with_chromium) {
|
|
|
|
configs -= [ "//build/config/compiler:chromium_code" ]
|
|
|
|
configs += [ "//build/config/compiler:no_chromium_code" ]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
source_set("tint_unittests_wgsl_reader_src") {
|
|
|
|
sources = [
|
|
|
|
"src/reader/wgsl/lexer_test.cc",
|
|
|
|
"src/reader/wgsl/parser_impl_additive_expression_test.cc",
|
|
|
|
"src/reader/wgsl/parser_impl_and_expression_test.cc",
|
|
|
|
"src/reader/wgsl/parser_impl_argument_expression_list_test.cc",
|
|
|
|
"src/reader/wgsl/parser_impl_assignment_stmt_test.cc",
|
|
|
|
"src/reader/wgsl/parser_impl_body_stmt_test.cc",
|
|
|
|
"src/reader/wgsl/parser_impl_break_stmt_test.cc",
|
|
|
|
"src/reader/wgsl/parser_impl_builtin_decoration_test.cc",
|
|
|
|
"src/reader/wgsl/parser_impl_case_body_test.cc",
|
|
|
|
"src/reader/wgsl/parser_impl_const_expr_test.cc",
|
|
|
|
"src/reader/wgsl/parser_impl_const_literal_test.cc",
|
|
|
|
"src/reader/wgsl/parser_impl_continue_stmt_test.cc",
|
|
|
|
"src/reader/wgsl/parser_impl_continuing_stmt_test.cc",
|
|
|
|
"src/reader/wgsl/parser_impl_derivative_modifier_test.cc",
|
|
|
|
"src/reader/wgsl/parser_impl_else_stmt_test.cc",
|
|
|
|
"src/reader/wgsl/parser_impl_elseif_stmt_test.cc",
|
|
|
|
"src/reader/wgsl/parser_impl_entry_point_decl_test.cc",
|
|
|
|
"src/reader/wgsl/parser_impl_equality_expression_test.cc",
|
|
|
|
"src/reader/wgsl/parser_impl_exclusive_or_expression_test.cc",
|
|
|
|
"src/reader/wgsl/parser_impl_function_decl_test.cc",
|
|
|
|
"src/reader/wgsl/parser_impl_function_header_test.cc",
|
|
|
|
"src/reader/wgsl/parser_impl_function_type_decl_test.cc",
|
|
|
|
"src/reader/wgsl/parser_impl_global_constant_decl_test.cc",
|
|
|
|
"src/reader/wgsl/parser_impl_global_decl_test.cc",
|
|
|
|
"src/reader/wgsl/parser_impl_global_variable_decl_test.cc",
|
|
|
|
"src/reader/wgsl/parser_impl_if_stmt_test.cc",
|
|
|
|
"src/reader/wgsl/parser_impl_import_decl_test.cc",
|
|
|
|
"src/reader/wgsl/parser_impl_inclusive_or_expression_test.cc",
|
|
|
|
"src/reader/wgsl/parser_impl_logical_and_expression_test.cc",
|
|
|
|
"src/reader/wgsl/parser_impl_logical_or_expression_test.cc",
|
|
|
|
"src/reader/wgsl/parser_impl_loop_stmt_test.cc",
|
|
|
|
"src/reader/wgsl/parser_impl_multiplicative_expression_test.cc",
|
|
|
|
"src/reader/wgsl/parser_impl_param_list_test.cc",
|
|
|
|
"src/reader/wgsl/parser_impl_paren_rhs_stmt_test.cc",
|
|
|
|
"src/reader/wgsl/parser_impl_pipeline_stage_test.cc",
|
|
|
|
"src/reader/wgsl/parser_impl_postfix_expression_test.cc",
|
|
|
|
"src/reader/wgsl/parser_impl_primary_expression_test.cc",
|
|
|
|
"src/reader/wgsl/parser_impl_relational_expression_test.cc",
|
|
|
|
"src/reader/wgsl/parser_impl_shift_expression_test.cc",
|
|
|
|
"src/reader/wgsl/parser_impl_statement_test.cc",
|
|
|
|
"src/reader/wgsl/parser_impl_statements_test.cc",
|
|
|
|
"src/reader/wgsl/parser_impl_storage_class_test.cc",
|
|
|
|
"src/reader/wgsl/parser_impl_struct_body_decl_test.cc",
|
|
|
|
"src/reader/wgsl/parser_impl_struct_decl_test.cc",
|
|
|
|
"src/reader/wgsl/parser_impl_struct_decoration_decl_test.cc",
|
|
|
|
"src/reader/wgsl/parser_impl_struct_decoration_test.cc",
|
|
|
|
"src/reader/wgsl/parser_impl_struct_member_decoration_decl_test.cc",
|
|
|
|
"src/reader/wgsl/parser_impl_struct_member_decoration_test.cc",
|
|
|
|
"src/reader/wgsl/parser_impl_struct_member_test.cc",
|
|
|
|
"src/reader/wgsl/parser_impl_switch_body_test.cc",
|
|
|
|
"src/reader/wgsl/parser_impl_switch_stmt_test.cc",
|
|
|
|
"src/reader/wgsl/parser_impl_test.cc",
|
|
|
|
"src/reader/wgsl/parser_impl_test_helper.cc",
|
|
|
|
"src/reader/wgsl/parser_impl_test_helper.h",
|
|
|
|
"src/reader/wgsl/parser_impl_type_alias_test.cc",
|
|
|
|
"src/reader/wgsl/parser_impl_type_decl_test.cc",
|
|
|
|
"src/reader/wgsl/parser_impl_unary_expression_test.cc",
|
|
|
|
"src/reader/wgsl/parser_impl_unless_stmt_test.cc",
|
|
|
|
"src/reader/wgsl/parser_impl_variable_decl_test.cc",
|
|
|
|
"src/reader/wgsl/parser_impl_variable_decoration_list_test.cc",
|
|
|
|
"src/reader/wgsl/parser_impl_variable_decoration_test.cc",
|
|
|
|
"src/reader/wgsl/parser_impl_variable_ident_decl_test.cc",
|
|
|
|
"src/reader/wgsl/parser_impl_variable_stmt_test.cc",
|
|
|
|
"src/reader/wgsl/parser_impl_variable_storage_decoration_test.cc",
|
|
|
|
"src/reader/wgsl/parser_test.cc",
|
|
|
|
"src/reader/wgsl/token_test.cc",
|
|
|
|
]
|
|
|
|
|
|
|
|
configs += [
|
|
|
|
":tint_common_config",
|
|
|
|
":tint_unittests_config",
|
|
|
|
]
|
|
|
|
|
|
|
|
if (build_with_chromium) {
|
|
|
|
configs -= [ "//build/config/compiler:chromium_code" ]
|
|
|
|
configs += [ "//build/config/compiler:no_chromium_code" ]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
source_set("tint_unittests_wgsl_writer_src") {
|
|
|
|
sources = [
|
|
|
|
"src/writer/wgsl/generator_impl_alias_type_test.cc",
|
|
|
|
"src/writer/wgsl/generator_impl_array_accessor_test.cc",
|
|
|
|
"src/writer/wgsl/generator_impl_as_test.cc",
|
|
|
|
"src/writer/wgsl/generator_impl_assign_test.cc",
|
|
|
|
"src/writer/wgsl/generator_impl_break_test.cc",
|
|
|
|
"src/writer/wgsl/generator_impl_call_test.cc",
|
|
|
|
"src/writer/wgsl/generator_impl_case_test.cc",
|
|
|
|
"src/writer/wgsl/generator_impl_cast_test.cc",
|
|
|
|
"src/writer/wgsl/generator_impl_constructor_test.cc",
|
|
|
|
"src/writer/wgsl/generator_impl_continue_test.cc",
|
|
|
|
"src/writer/wgsl/generator_impl_else_test.cc",
|
|
|
|
"src/writer/wgsl/generator_impl_entry_point_test.cc",
|
|
|
|
"src/writer/wgsl/generator_impl_fallthrough_test.cc",
|
|
|
|
"src/writer/wgsl/generator_impl_function_test.cc",
|
|
|
|
"src/writer/wgsl/generator_impl_identifier_test.cc",
|
|
|
|
"src/writer/wgsl/generator_impl_if_test.cc",
|
|
|
|
"src/writer/wgsl/generator_impl_import_test.cc",
|
|
|
|
"src/writer/wgsl/generator_impl_kill_test.cc",
|
|
|
|
"src/writer/wgsl/generator_impl_loop_test.cc",
|
|
|
|
"src/writer/wgsl/generator_impl_member_accessor_test.cc",
|
|
|
|
"src/writer/wgsl/generator_impl_nop_test.cc",
|
|
|
|
"src/writer/wgsl/generator_impl_relational_test.cc",
|
|
|
|
"src/writer/wgsl/generator_impl_return_test.cc",
|
|
|
|
"src/writer/wgsl/generator_impl_switch_test.cc",
|
|
|
|
"src/writer/wgsl/generator_impl_test.cc",
|
|
|
|
"src/writer/wgsl/generator_impl_type_test.cc",
|
|
|
|
"src/writer/wgsl/generator_impl_unary_derivative_test.cc",
|
|
|
|
"src/writer/wgsl/generator_impl_unary_method_test.cc",
|
|
|
|
"src/writer/wgsl/generator_impl_unary_op_test.cc",
|
|
|
|
"src/writer/wgsl/generator_impl_unless_test.cc",
|
|
|
|
"src/writer/wgsl/generator_impl_variable_decl_statement_test.cc",
|
|
|
|
"src/writer/wgsl/generator_impl_variable_test.cc",
|
|
|
|
]
|
|
|
|
|
|
|
|
configs += [
|
|
|
|
":tint_common_config",
|
|
|
|
":tint_unittests_config",
|
|
|
|
]
|
|
|
|
|
|
|
|
if (build_with_chromium) {
|
|
|
|
configs -= [ "//build/config/compiler:chromium_code" ]
|
|
|
|
configs += [ "//build/config/compiler:no_chromium_code" ]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
source_set("tint_unittests_src") {
|
|
|
|
deps = [ ":tint_unittests_core_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" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
configs += [
|
|
|
|
":tint_common_config",
|
|
|
|
":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",
|
|
|
|
":libtint",
|
|
|
|
":tint_unittests_src",
|
|
|
|
]
|
|
|
|
|
|
|
|
# TODO(rharrison): Use main() from chromium for chromium tree builds. This
|
|
|
|
# requires adding a file to //gpu like Dawn has done.
|
|
|
|
|
|
|
|
configs += [
|
|
|
|
":tint_common_config",
|
|
|
|
":tint_unittests_config",
|
|
|
|
]
|
|
|
|
|
|
|
|
if (build_with_chromium) {
|
|
|
|
configs -= [ "//build/config/compiler:chromium_code" ]
|
|
|
|
configs += [ "//build/config/compiler:no_chromium_code" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
testonly = true
|
|
|
|
}
|
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
# Samples - Executables exposing command line functionality
|
|
|
|
###############################################################################
|
|
|
|
|
2020-04-15 20:47:55 +00:00
|
|
|
config("tint_exe_config") {
|
|
|
|
include_dirs = []
|
|
|
|
if (tint_build_spv_reader || tint_build_spv_writer) {
|
|
|
|
include_dirs = [ "${tint_spirv_tools_dir}/include/" ]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
executable("tint_exe") {
|
2020-04-09 18:52:06 +00:00
|
|
|
sources = [ "samples/main.cc" ]
|
|
|
|
deps = [ ":libtint" ]
|
|
|
|
|
2020-04-15 20:47:55 +00:00
|
|
|
if (tint_build_spv_reader || tint_build_spv_writer) {
|
2020-04-17 13:18:20 +00:00
|
|
|
deps += [ "${tint_spirv_headers_dir}/:spv_headers" ]
|
2020-04-15 20:47:55 +00:00
|
|
|
}
|
|
|
|
|
2020-04-09 18:52:06 +00:00
|
|
|
configs += [ ":tint_common_config" ]
|
2020-04-15 20:47:55 +00:00
|
|
|
configs += [ ":tint_exe_config" ]
|
2020-04-08 20:40:25 +00:00
|
|
|
|
|
|
|
if (build_with_chromium) {
|
|
|
|
configs -= [ "//build/config/compiler:chromium_code" ]
|
|
|
|
configs += [ "//build/config/compiler:no_chromium_code" ]
|
|
|
|
}
|
|
|
|
}
|