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

# This file contains Tint-related build flags.

declare_args() {
  # Path to tint checkout
  if (!defined(tint_root_dir)) {
    tint_root_dir = "//"
  }

  # Path to spirv-tools checkout
  if (!defined(tint_spirv_tools_dir)) {
    tint_spirv_tools_dir = "//third_party/vulkan-deps/spirv-tools/src"
  }

  # Path to glslang checkout
  if (!defined(tint_glslang_dir)) {
    tint_glslang_dir = "//third_party/vulkan-deps/glslang/src"
  }

  # Path to googletest checkout
  if (!defined(tint_googletest_dir)) {
    tint_googletest_dir = "//third_party/googletest"
  }

  # Path to spirv-headers checkout
  if (!defined(tint_spirv_headers_dir)) {
    tint_spirv_headers_dir = "//third_party/vulkan-deps/spirv-headers/src"
  }

  # Build the SPIR-V input reader
  if (!defined(tint_build_spv_reader)) {
    tint_build_spv_reader = true
  }

  # Build the SPIR-V output writer
  if (!defined(tint_build_spv_writer)) {
    tint_build_spv_writer = true
  }

  # Build the WGSL input reader
  if (!defined(tint_build_wgsl_reader)) {
    tint_build_wgsl_reader = true
  }

  # Build the WGSL output writer
  if (!defined(tint_build_wgsl_writer)) {
    tint_build_wgsl_writer = true
  }

  # Build the MSL output writer
  if (!defined(tint_build_msl_writer)) {
    tint_build_msl_writer = true
  }

  # Build the HLSL output writer
  if (!defined(tint_build_hlsl_writer)) {
    tint_build_hlsl_writer = true
  }

  # Build the GLSL output writer
  if (!defined(tint_build_glsl_writer)) {
    tint_build_glsl_writer = true
  }

  # Build the Syntax Tree writer
  if (!defined(tint_build_syntax_tree_writer)) {
    tint_build_syntax_tree_writer = false
  }

  # Build the Tint IR
  if (!defined(tint_build_ir)) {
    tint_build_ir = true
  }

  # Build unittests
  if (!defined(tint_build_unittests)) {
    tint_build_unittests = true
  }
}

declare_args() {
  # Directory holding tint source
  if (!defined(tint_src_dir)) {
    tint_src_dir = "${tint_root_dir}/src/tint"
  }
}
