# Copyright 2018 The Dawn 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.

# This files imports the overrides for Dawn but sets the defaults so that
# projects including Dawn don't have to set dirs if they happen to use the
# same.
# It takes advantage of GN's variable scoping rules to define global variables
# inside if constructs.

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

if (!defined(dawn_standalone)) {
  dawn_standalone = false
}

if (!defined(dawn_has_build)) {
  dawn_has_build = true
}

dawn_has_fuzzers = dawn_has_build

if (!defined(dawn_root)) {
  dawn_root = get_path_info("..", "abspath")
}
dawn_gen_root = get_path_info("${dawn_root}", "gen_dir")

if (!defined(dawn_jinja2_dir)) {
  dawn_jinja2_dir = "//third_party/jinja2"
}

if (!defined(dawn_glfw_dir)) {
  dawn_glfw_dir = "//third_party/glfw"
}

if (!defined(dawn_googletest_dir)) {
  dawn_googletest_dir = "//third_party/googletest"
}

if (!defined(dawn_spirv_tools_dir)) {
  dawn_spirv_tools_dir = "//third_party/vulkan-deps/spirv-tools/src"
}

if (!defined(dawn_swiftshader_dir)) {
  # Default to swiftshader not being available.
  dawn_swiftshader_dir = ""
}

if (!defined(dawn_vulkan_deps_dir)) {
  dawn_vulkan_deps_dir = "//third_party/vulkan-deps"
  if (dawn_standalone) {
    dawn_vulkan_deps_dir = "${dawn_root}/third_party/vulkan-deps"
  }
}

if (!defined(dawn_vulkan_headers_dir)) {
  dawn_vulkan_headers_dir = "${dawn_vulkan_deps_dir}/vulkan-headers/src"
}

if (!defined(dawn_vulkan_loader_dir)) {
  # Default to the Vulkan loader not being available except in standalone.
  dawn_vulkan_loader_dir = ""
  if (dawn_standalone) {
    dawn_vulkan_loader_dir = "//third_party/vulkan-deps/vulkan-loader/src"
  }
}

if (!defined(dawn_vulkan_utility_libraries_dir)) {
  dawn_vulkan_utility_libraries_dir =
      "${dawn_vulkan_deps_dir}/vulkan-utility-libraries/src"
}

if (!defined(dawn_vulkan_validation_layers_dir)) {
  # Default to VVLs not being available.
  dawn_vulkan_validation_layers_dir = ""
}

if (!defined(dawn_abseil_dir)) {
  dawn_abseil_dir = "//third_party/abseil-cpp"
}

if (!defined(dawn_dxc_dir)) {
  dawn_dxc_dir = "//third_party/dxc"
}

if (!defined(dawn_dxheaders_dir)) {
  dawn_dxheaders_dir = "//third_party/dxheaders"
}

if (!defined(dawn_version_file)) {
  dawn_version_file = ""
}

if (!defined(dawn_opengl_registry_dir)) {
  dawn_opengl_registry_dir = "${dawn_root}/third_party/khronos/OpenGL-Registry"
}

if (!defined(dawn_egl_registry_dir)) {
  dawn_egl_registry_dir = "${dawn_root}/third_party/khronos/EGL-Registry"
}
