# Copyright 2023 The Dawn & Tint Authors
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
#    list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice,
#    this list of conditions and the following disclaimer in the documentation
#    and/or other materials provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its
#    contributors may be used to endorse or promote products derived from
#    this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

################################################################################
# File generated by 'tools/src/cmd/gen' using the template:
#   tools/src/cmd/gen/build/BUILD.gn.tmpl
#
# To regenerate run: './tools/run gen'
#
#                       Do not modify this file directly
################################################################################

import("../../../../scripts/dawn_overrides_with_defaults.gni")
import("../../../../scripts/tint_overrides_with_defaults.gni")

import("${tint_src_dir}/tint.gni")

if (tint_build_unittests || tint_build_benchmarks) {
  import("//testing/test.gni")
}
if (tint_build_benchmarks) {
  if (tint_build_wgsl_reader) {
    tint_benchmarks_source_set("bench") {
      sources = [
        "bench.cc",
        "bench.h",
      ]
      deps = [
        "${dawn_root}/src/utils:utils",
        "${tint_src_dir}:google_benchmark",
        "${tint_src_dir}/api/common",
        "${tint_src_dir}/lang/core",
        "${tint_src_dir}/lang/core/constant",
        "${tint_src_dir}/lang/core/ir",
        "${tint_src_dir}/lang/core/type",
        "${tint_src_dir}/lang/wgsl",
        "${tint_src_dir}/lang/wgsl/ast",
        "${tint_src_dir}/lang/wgsl/common",
        "${tint_src_dir}/lang/wgsl/features",
        "${tint_src_dir}/lang/wgsl/program",
        "${tint_src_dir}/lang/wgsl/sem",
        "${tint_src_dir}/utils/containers",
        "${tint_src_dir}/utils/diagnostic",
        "${tint_src_dir}/utils/ice",
        "${tint_src_dir}/utils/id",
        "${tint_src_dir}/utils/macros",
        "${tint_src_dir}/utils/math",
        "${tint_src_dir}/utils/memory",
        "${tint_src_dir}/utils/reflection",
        "${tint_src_dir}/utils/result",
        "${tint_src_dir}/utils/rtti",
        "${tint_src_dir}/utils/symbol",
        "${tint_src_dir}/utils/text",
        "${tint_src_dir}/utils/traits",
      ]

      if (tint_build_wgsl_reader) {
        deps += [ "${tint_src_dir}/lang/wgsl/reader" ]
      }
    }
  }
}
if (tint_build_benchmarks) {
  if (tint_build_wgsl_reader) {
    test("bench_cmd") {
      testonly = true
      output_name = "tint_benchmark"
      sources = [ "main_bench.cc" ]
      deps = [
        "${dawn_root}/src/utils:utils",
        "${tint_src_dir}:google_benchmark",
        "${tint_src_dir}/lang/core",
        "${tint_src_dir}/lang/core:bench",
        "${tint_src_dir}/lang/core/constant",
        "${tint_src_dir}/lang/core/type",
        "${tint_src_dir}/lang/wgsl",
        "${tint_src_dir}/lang/wgsl:bench",
        "${tint_src_dir}/lang/wgsl/ast",
        "${tint_src_dir}/lang/wgsl/program",
        "${tint_src_dir}/lang/wgsl/sem",
        "${tint_src_dir}/utils/containers",
        "${tint_src_dir}/utils/diagnostic",
        "${tint_src_dir}/utils/ice",
        "${tint_src_dir}/utils/id",
        "${tint_src_dir}/utils/macros",
        "${tint_src_dir}/utils/math",
        "${tint_src_dir}/utils/memory",
        "${tint_src_dir}/utils/reflection",
        "${tint_src_dir}/utils/result",
        "${tint_src_dir}/utils/rtti",
        "${tint_src_dir}/utils/rtti:bench",
        "${tint_src_dir}/utils/symbol",
        "${tint_src_dir}/utils/text",
        "${tint_src_dir}/utils/traits",
      ]

      if (tint_build_glsl_writer && tint_build_wgsl_reader) {
        deps += [ "${tint_src_dir}/lang/glsl/writer:bench" ]
      }

      if (tint_build_hlsl_writer && tint_build_wgsl_reader) {
        deps += [ "${tint_src_dir}/lang/hlsl/writer:bench" ]
      }

      if (tint_build_msl_writer && tint_build_wgsl_reader) {
        deps += [ "${tint_src_dir}/lang/msl/writer:bench" ]
      }

      if (tint_build_spv_writer && tint_build_wgsl_reader) {
        deps += [ "${tint_src_dir}/lang/spirv/writer:bench" ]
      }

      if (tint_build_wgsl_reader) {
        deps += [
          "${tint_src_dir}/cmd/bench:bench",
          "${tint_src_dir}/lang/core/ir:bench",
          "${tint_src_dir}/lang/wgsl/reader:bench",
        ]
      }

      if (tint_build_wgsl_writer && tint_build_wgsl_reader) {
        deps += [ "${tint_src_dir}/lang/wgsl/writer:bench" ]
      }
    }
  }
}
