# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

if (is_ohos) {
  import("//build/config/clang/clang.gni")
  import("//build/misc/overrides/build.gni")
  import("abi.gni")

  import("//build/config/ohos/musl.gni")

  default_base_libs_root = ""

  declare_args() {
    base_libs_root = default_base_libs_root
  }

  # Defines the name the ohos build gives to the current host CPU
  # architecture, which is different than the names GN uses.
  if (host_os == "linux") {
    ohos_host_os = "linux"
  } else if (host_os == "mac") {
    ohos_host_os = "darwin"
  } else {
    assert(false, "Need toolchain support for your build OS.")
  }

  if (current_cpu == "arm") {
    abi_target = "arm-linux-ohos"
  } else if (current_cpu == "x86") {
    abi_target = ""
  } else if (current_cpu == "arm64") {
    abi_target = "aarch64-linux-ohos"
  } else if (current_cpu == "x86_64") {
    abi_target = "x86_64-linux-ohos"
  } else if (current_cpu == "riscv64") {
    abi_target = "riscv64-linux-ohos"
  } else if (current_cpu == "riscv32") {
    abi_target = "riscv32-linux-ohos"
  } else if (current_cpu == "mipsel") {
    abi_target = "mipsel-linux-ohos"
  } else if (current_cpu == "loongarch64") {
    abi_target = "loongarch64-linux-ohos"
  } else {
    assert(false, "Architecture not supported")
  }
  if (current_cpu == "arm64") {
    libgwp_asan_file = "${clang_base_path}/lib/clang/${clang_version}/lib/${abi_target}/libclang_rt.gwp_asan.a"
  }
  libclang_rt_file = "${clang_base_path}/lib/clang/${clang_version}/lib/${abi_target}/libclang_rt.builtins.a"
  libcxxabi_file = "${clang_base_path}/lib/${abi_target}/libc++abi.a"
  libcxx_ndk_shared_file =
      "${clang_base_path}/../libcxx-ndk/lib/${abi_target}/libc++_shared.so"
}