# Copyright 2016 Google Inc.
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

# It's best to keep the names and defaults of is_foo flags consistent with Chrome.

declare_args() {
  is_debug = true
  is_component_build = false
  ndk = ""
}

# Platform detection
if (target_os == "") {
  target_os = host_os
  if (ndk != "") {
    target_os = "android"
  }
}
if (current_os == "") {
  current_os = target_os
}

is_android = current_os == "android"
is_fuchsia = current_os == "fuchsia"
is_ios = current_os == "ios"
is_linux = current_os == "linux"
is_mac = current_os == "mac"
is_win = current_os == "win"

if (target_cpu == "") {
  target_cpu = host_cpu
  if (is_android) {
    target_cpu = "arm64"
  }
}
if (current_cpu == "") {
  current_cpu = target_cpu
}

if (is_android) {
  ndk_host = ""
  ndk_target = ""
  ndk_platform = ""
  ndk_stdlib = ""
  nkd_gccdir = ""

  if (host_os == "linux") {
    ndk_host = "linux-x86_64"
  } else if (host_os == "mac") {
    ndk_host = "darwin-x86_64"
  }

  if (target_cpu == "arm64") {
    ndk_target = "aarch64-linux-android"
    ndk_platform = "android-21/arch-arm64"
    ndk_stdlib = "arm64-v8a"
    ndk_gccdir = ndk_target
  } else if (target_cpu == "arm") {
    ndk_target = "arm-linux-androideabi"
    ndk_platform = "android-18/arch-arm"
    ndk_stdlib = "armeabi-v7a"
    ndk_gccdir = ndk_target
  } else if (target_cpu == "mips64el") {
    ndk_target = "mips64el-linux-android"
    ndk_platform = "android-21/arch-mips64"
    ndk_stdlib = "mips64"
    ndk_gccdir = ndk_target
  } else if (target_cpu == "mipsel") {
    ndk_target = "mipsel-linux-android"
    ndk_platform = "android-18/arch-mips"
    ndk_stdlib = "mips"
    ndk_gccdir = ndk_target
  } else if (target_cpu == "x64") {
    ndk_target = "x86_64-linux-android"
    ndk_platform = "android-21/arch-x86_64"
    ndk_stdlib = "x86_64"
    ndk_gccdir = ndk_stdlib
  } else if (target_cpu == "x86") {
    ndk_target = "i686-linux-android"
    ndk_platform = "android-18/arch-x86"
    ndk_stdlib = "x86"
    ndk_gccdir = ndk_stdlib
  }
}

# A component is either a static or a shared library.
template("component") {
  _component_mode = "static_library"
  if (is_component_build) {
    _component_mode = "shared_library"
  }

  target(_component_mode, target_name) {
    forward_variables_from(invoker, "*")
  }
}

# Default configs
default_configs = [
  "//gn:default",
  "//gn:no_rtti",
]
if (!is_debug) {
  default_configs += [ "//gn:release" ]
}

set_defaults("executable") {
  configs = default_configs + [ "//gn:executable" ]
}

set_defaults("source_set") {
  configs = default_configs
}

set_defaults("static_library") {
  configs = default_configs
}

set_defaults("shared_library") {
  configs = default_configs
}

set_defaults("component") {
  configs = default_configs
  if (!is_component_build) {
    complete_static_lib = true
  }
}

# For now, we support GCC-like toolchains, including Clang.
set_default_toolchain("//gn:gcc_like")
