# Copyright 2021 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.

# GEN_BUILD:DO_NOT_GENERATE - Don't regenerate this file with `./tools run gen`

import("//build_overrides/build.gni")

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

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

import("tint.gni")

###############################################################################
# Common - Configs, etc. shared across targets
###############################################################################

# tint_gen_dir is the relative path of tint_root_dir to '//', under root_gen_dir
tint_gen_dir = "${root_gen_dir}/" + rebase_path("${tint_root_dir}", "//")

config("tint_common_config") {
  include_dirs = [
    "${tint_root_dir}",
    "${tint_gen_dir}",
  ]

  # Some versions of MSVC ignores the [[noreturn]] on ~InternalCompilerError(),
  # triggering a warning if it is the last statement on a function that has a
  # return value.
  if (!is_clang && is_win) {
    cflags = [ "/wd4715" ]
  }
}

config("tint_public_config") {
  defines = []
  if (tint_build_spv_reader) {
    defines += [ "TINT_BUILD_SPV_READER=1" ]
  } else {
    defines += [ "TINT_BUILD_SPV_READER=0" ]
  }

  if (tint_build_spv_writer) {
    defines += [ "TINT_BUILD_SPV_WRITER=1" ]
  } else {
    defines += [ "TINT_BUILD_SPV_WRITER=0" ]
  }

  if (tint_build_wgsl_reader) {
    defines += [ "TINT_BUILD_WGSL_READER=1" ]
  } else {
    defines += [ "TINT_BUILD_WGSL_READER=0" ]
  }

  if (tint_build_wgsl_writer) {
    defines += [ "TINT_BUILD_WGSL_WRITER=1" ]
  } else {
    defines += [ "TINT_BUILD_WGSL_WRITER=0" ]
  }

  if (tint_build_msl_writer) {
    defines += [ "TINT_BUILD_MSL_WRITER=1" ]
  } else {
    defines += [ "TINT_BUILD_MSL_WRITER=0" ]
  }

  if (tint_build_hlsl_writer) {
    defines += [ "TINT_BUILD_HLSL_WRITER=1" ]
  } else {
    defines += [ "TINT_BUILD_HLSL_WRITER=0" ]
  }

  if (tint_build_glsl_writer) {
    defines += [ "TINT_BUILD_GLSL_WRITER=1" ]
  } else {
    defines += [ "TINT_BUILD_GLSL_WRITER=0" ]
  }

  if (tint_build_glsl_validator) {
    defines += [ "TINT_BUILD_GLSL_VALIDATOR=1" ]
  } else {
    defines += [ "TINT_BUILD_GLSL_VALIDATOR=0" ]
  }

  if (tint_build_syntax_tree_writer) {
    defines += [ "TINT_BUILD_SYNTAX_TREE_WRITER=1" ]
  } else {
    defines += [ "TINT_BUILD_SYNTAX_TREE_WRITER=0" ]
  }

  if (tint_build_ir_binary) {
    defines += [ "TINT_BUILD_IR_BINARY=1" ]
  } else {
    defines += [ "TINT_BUILD_IR_BINARY=0" ]
  }

  if (tint_build_ir_fuzzer) {
    defines += [ "TINT_BUILD_IR_FUZZER=1" ]
  } else {
    defines += [ "TINT_BUILD_IR_FUZZER=0" ]
  }

  if (tint_build_is_win) {
    defines += [ "TINT_BUILD_IS_WIN=1" ]
  } else {
    defines += [ "TINT_BUILD_IS_WIN=0" ]
  }

  if (tint_build_is_mac) {
    defines += [ "TINT_BUILD_IS_MAC=1" ]
  } else {
    defines += [ "TINT_BUILD_IS_MAC=0" ]
  }

  if (tint_build_is_linux) {
    defines += [ "TINT_BUILD_IS_LINUX=1" ]
  } else {
    defines += [ "TINT_BUILD_IS_LINUX=0" ]
  }

  include_dirs = [
    "${tint_root_dir}/",
    "${tint_root_dir}/include/",
  ]
}

config("tint_config") {
  include_dirs = []
  if (tint_build_spv_reader || tint_build_spv_writer) {
    include_dirs += [ "${tint_spirv_tools_dir}/include/" ]
  }
}

source_set("dl") {
  # GN doesn't appear to need to depend on any dl libraries.
}

source_set("thread") {
  # GN doesn't appear to need to depend on any thread libraries.
}

source_set("metal") {
  frameworks = [
    "CoreGraphics.framework",
    "Foundation.framework",
    "Metal.framework",
  ]
}

config("tint_unittests_config") {
  include_dirs = [
    "${tint_googletest_dir}/googlemock/include",
    "${tint_googletest_dir}/googletest/include",
  ]

  configs = [
    ":tint_common_config",
    ":tint_public_config",
  ]

  if (is_win && is_debug) {
    # TODO(crbug.com/tint/1749): both msvc and clang builds stack overflow on debug builds.
    # Increase the initial stack size to 4 MB (default is 1MB).
    ldflags = [ "/STACK:4194304" ]
  }
}

if (tint_build_unittests) {
  ###############################################################################
  # 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 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",
        "//third_party/googletest:gmock",
      ]
    }
  } else {
    # 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" ]
      public_configs = [ ":gmock_config" ]
    }

    group("gmock_and_gtest") {
      testonly = true
      public_deps = [
        ":gmock",
        ":gtest",
      ]
    }
  }
}

if (tint_build_benchmarks) {
  group("google_benchmark") {
    testonly = true
    public_deps = [ "//third_party/google_benchmark" ]
  }
}

group("abseil") {
  # When building within Chromium or ANGLE we need to include "//third_party/abseil-cpp:absl" while
  # it's beneficial to be more specific with standalone Dawn, especially when it comes to
  # including it as a dependency in other projects (such as Skia).
  if (build_with_chromium || build_with_angle) {
    public_deps = [ "$dawn_abseil_dir:absl" ]
  } else {
    public_deps = [ "${dawn_root}/third_party/gn/abseil-cpp:strings" ]
  }
}

source_set("winsock") {
  libs = [ "ws2_32.lib" ]
}

config("dxc-include-config") {
  include_dirs = [ "${dawn_dxc_dir}/include" ]
}
source_set("dxc-include") {
  public_configs = [ ":dxc-include-config" ]
}

source_set("dxcompiler-for-fuzzer") {
  if (defined(use_libfuzzer) && use_libfuzzer &&
      (is_win || is_linux || is_mac) && target_cpu != "x86") {
    public_deps = [ "${dawn_dxc_dir}/../gn/dxc:dxcompiler" ]
  }
}

###############################################################################
# Fuzzers
###############################################################################
if (tint_has_fuzzers) {
  action("tint_generate_wgsl_corpus") {
    script = "${tint_src_dir}/cmd/fuzz/wgsl/generate_wgsl_corpus.py"
    sources = [ "${script}" ]
    args = [
      "--stamp=" + rebase_path(fuzzer_corpus_wgsl_stamp, root_build_dir),
      rebase_path("${tint_root_dir}/test", root_build_dir),
      rebase_path(fuzzer_corpus_wgsl_dir, root_build_dir),
    ]
    outputs = [ fuzzer_corpus_wgsl_stamp ]
  }

  if (tint_build_ir_fuzzer) {
    if (tint_build_cmds && tint_build_wgsl_reader && tint_build_ir_binary) {
      action("tint_generate_ir_corpus") {
        script = "${tint_src_dir}/cmd/fuzz/wgsl/generate_ir_corpus.py"
        sources = [ "${script}" ]
        deps = [ "${tint_src_dir}/cmd/fuzz/ir/as" ]
        args = [
          "--stamp=" + rebase_path(fuzzer_corpus_ir_stamp, root_build_dir),
          rebase_path("${root_build_dir}/ir_fuzz_as", root_build_dir),
          rebase_path("${tint_root_dir}/test", root_build_dir),
          rebase_path(fuzzer_corpus_ir_dir, root_build_dir),
        ]
        outputs = [ fuzzer_corpus_ir_stamp ]
      }
    }
  }
}

###############################################################################
# Groups
###############################################################################
group("libs") {
  deps = [ "${tint_src_dir}/api" ]
}

group("cmds") {
  deps = []
  if (tint_build_cmds) {
    deps += [
      "${tint_src_dir}/cmd/info",
      "${tint_src_dir}/cmd/remote_compile",
      "${tint_src_dir}/cmd/tint",
    ]
  }
  if (tint_build_tintd) {
    deps += [ "${tint_src_dir}/cmd/tintd" ]
  }
}

group("fuzzers") {
  testonly = true
  deps = []
  if (tint_has_fuzzers) {
    deps += [ "${tint_src_dir}/cmd/fuzz/wgsl" ]
  }

  if (tint_build_ir_fuzzer && (!is_asan || build_with_chromium)) {
    deps += [ "${tint_src_dir}/cmd/fuzz/ir" ]
  }
}

group("tests") {
  testonly = true
  deps = []
  if (tint_build_unittests) {
    deps += [ "${tint_src_dir}/cmd/test:test_cmd" ]
  }
}

group("benchmarks") {
  testonly = true
  deps = []
  if (tint_build_benchmarks) {
    deps += [ "${tint_src_dir}/cmd/bench:bench_cmd" ]
  }
}

###############################################################################
# Aliases
###############################################################################
group("tint_unittests") {
  testonly = true
  public_deps = [ ":tests" ]
}
