# 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/tint_overrides_with_defaults.gni")

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

if (tint_build_unittests || tint_build_benchmarks) {
  import("//testing/test.gni")
}

libtint_source_set("wgsl") {
  sources = [
    "builtin_fn.cc",
    "builtin_fn.h",
    "diagnostic_rule.cc",
    "diagnostic_rule.h",
    "diagnostic_severity.cc",
    "diagnostic_severity.h",
    "extension.cc",
    "extension.h",
  ]
  deps = [
    "${tint_src_dir}/utils/containers",
    "${tint_src_dir}/utils/diagnostic",
    "${tint_src_dir}/utils/ice",
    "${tint_src_dir}/utils/macros",
    "${tint_src_dir}/utils/math",
    "${tint_src_dir}/utils/memory",
    "${tint_src_dir}/utils/rtti",
    "${tint_src_dir}/utils/text",
    "${tint_src_dir}/utils/traits",
  ]
}
if (tint_build_unittests) {
  tint_unittests_source_set("unittests") {
    sources = [
      "diagnostic_rule_test.cc",
      "diagnostic_severity_test.cc",
      "extension_test.cc",
      "language_feature_status_test.cc",
      "language_feature_test.cc",
      "wgsl_test.cc",
    ]
    deps = [
      "${tint_src_dir}:gmock_and_gtest",
      "${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}/lang/wgsl/writer/ir_to_program",
      "${tint_src_dir}/lang/wgsl/writer/raise",
      "${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",
        "${tint_src_dir}/lang/wgsl/reader/program_to_ir",
      ]
    }

    if (tint_build_wgsl_reader && tint_build_wgsl_writer) {
      sources += [ "ir_roundtrip_test.cc" ]
    }

    if (tint_build_wgsl_writer) {
      deps += [ "${tint_src_dir}/lang/wgsl/writer" ]
    }
  }
}
if (tint_build_benchmarks) {
  tint_unittests_source_set("bench") {
    sources = [
      "diagnostic_rule_bench.cc",
      "diagnostic_severity_bench.cc",
      "extension_bench.cc",
    ]
    deps = [
      "${tint_src_dir}:google_benchmark",
      "${tint_src_dir}/lang/wgsl",
      "${tint_src_dir}/utils/containers",
      "${tint_src_dir}/utils/diagnostic",
      "${tint_src_dir}/utils/ice",
      "${tint_src_dir}/utils/macros",
      "${tint_src_dir}/utils/math",
      "${tint_src_dir}/utils/memory",
      "${tint_src_dir}/utils/rtti",
      "${tint_src_dir}/utils/text",
      "${tint_src_dir}/utils/traits",
    ]
  }
}

tint_fuzz_source_set("fuzz") {
  sources = []
  deps = [
    "${tint_src_dir}/api/common",
    "${tint_src_dir}/cmd/fuzz/ir:fuzz",
    "${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/reader/lower",
    "${tint_src_dir}/lang/wgsl/resolver",
    "${tint_src_dir}/lang/wgsl/sem",
    "${tint_src_dir}/lang/wgsl/writer/ir_to_program",
    "${tint_src_dir}/lang/wgsl/writer/raise",
    "${tint_src_dir}/utils/bytes",
    "${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/parser",
      "${tint_src_dir}/lang/wgsl/reader/program_to_ir",
    ]
  }

  if (tint_build_wgsl_reader && tint_build_wgsl_writer) {
    sources += [ "ir_roundtrip_fuzz.cc" ]
  }

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