# Copyright (c) 2020 Project CHIP 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/chip.gni")
import("//build_overrides/mbedtls.gni")
import("//build_overrides/nlassert.gni")
import("//build_overrides/nlio.gni")
import("//build_overrides/nlunit_test.gni")
import("//build_overrides/pigweed.gni")

# This build file should not be used in superproject builds.
assert(chip_root == "//")

import("${chip_root}/build/chip/tests.gni")
import("${chip_root}/build/chip/tools.gni")

if (current_toolchain != "${dir_pw_toolchain}/dummy:dummy") {
  declare_args() {
    chip_enable_python_modules =
        (current_os == "mac" || current_os == "linux") && host_cpu == "x64"
  }

  # This is a real toolchain. Build CHIP.
  group("default") {
    deps = [ ":all" ]
  }

  group("all") {
    deps = [
      "${chip_root}/src/app",
      "${chip_root}/src/ble",
      "${chip_root}/src/controller",
      "${chip_root}/src/crypto",
      "${chip_root}/src/inet",
      "${chip_root}/src/lib",
      "${chip_root}/src/lib/core",
      "${chip_root}/src/lib/shell",
      "${chip_root}/src/lib/support",
      "${chip_root}/src/lwip:all",
      "${chip_root}/src/setup_payload",
      "${chip_root}/src/system",
      "${chip_root}/src/transport",
      "${mbedtls_root}:mbedtls",
      "${nlassert_root}:nlassert",
      "${nlio_root}:nlio",
      "${nlunit_test_root}:nlunit-test",
    ]

    # Temporary until RNG issue sorted out
    if (current_os != "android") {
      deps += [ "${chip_root}/src/lib/message" ]
    }

    if (chip_build_tests) {
      deps += [ "//src:tests" ]
    }

    if (chip_build_tools) {
      deps += [
        "${chip_root}/examples/shell",
        "${chip_root}/src/qrcodetool",
        "${chip_root}/src/setup_payload",
      ]
      if (chip_enable_python_modules) {
        deps += [ "${chip_root}/src/controller/python" ]
      }
    }

    if (current_os == "android") {
      deps += [
        "${chip_root}/src/controller/java",
        "${chip_root}/src/setup_payload/java",
      ]
    }
  }

  group("check") {
    if (chip_link_tests) {
      deps = [ "//src:tests_run" ]
    }
  }
} else {
  # This is the unified build. Configure various real toolchains.
  import("${chip_root}/build/chip/chip_build.gni")
  declare_args() {
    # Set this to false to disable all builds by default.
    enable_default_builds = true

    # Enable building for Android.
    enable_android_builds = false

    # Set this to true to enable nRF5 builds by default.
    enable_nrf5_builds = false

    # Set this to true to enable efr32 builds by default.
    enable_efr32_builds = false

    # Set this to true to enable qpg6100 builds by default.
    enable_qpg6100_builds = false
  }

  declare_args() {
    # Enable building chip with clang.
    enable_host_clang_build = enable_default_builds

    # Enable building chip with gcc.
    enable_host_gcc_build = enable_default_builds

    # Enable building chip with gcc & mbedtls.
    enable_host_gcc_mbedtls_build = enable_default_builds

    # Build the chip-tool example.
    enable_standalone_chip_tool_build = enable_default_builds

    # Build the shell example.
    enable_standalone_shell_build = enable_default_builds

    # Build the nRF5 lock app example.
    enable_nrf5_lock_app_build = enable_nrf5_builds

    # Build the nRF5 lighting app example.
    enable_nrf5_lighting_app_build = enable_nrf5_builds

    # Build the nRF5 pigweed app example.
    enable_nrf5_pigweed_app_build = enable_nrf5_builds

    # Build the efr32 lock app example.
    enable_efr32_lock_app_build = enable_efr32_builds

    # Build the qpg6100 lock app example.
    enable_qpg6100_lock_app_build = enable_qpg6100_builds

    # Build the efr32 lighting app example.
    enable_efr32_lighting_app_build = enable_efr32_builds
  }

  chip_build("host_clang") {
    toolchain = "//build/toolchain/host:${host_os}_${host_cpu}_clang"
  }

  chip_build("host_gcc") {
    toolchain = "//build/toolchain/host:${host_os}_${host_cpu}_gcc"
  }

  chip_build("host_gcc_mbedtls") {
    toolchain = "${chip_root}/config/mbedtls/toolchain:${host_os}_${host_cpu}_gcc_mbedtls"
  }

  if (enable_android_builds) {
    chip_build("android_arm") {
      toolchain = "//build/toolchain/android:android_arm"
    }

    chip_build("android_arm64") {
      toolchain = "//build/toolchain/android:android_arm64"
    }

    chip_build("android_x64") {
      toolchain = "//build/toolchain/android:android_x64"
    }

    chip_build("android_x86") {
      toolchain = "//build/toolchain/android:android_x86"
    }
  }

  standalone_toolchain = "${chip_root}/config/standalone/toolchain:standalone"

  group("standalone_chip_tool") {
    deps = [ "${chip_root}/examples/chip-tool(${standalone_toolchain})" ]
  }

  group("standalone_shell") {
    deps = [ "${chip_root}/examples/shell(${standalone_toolchain})" ]
  }

  if (enable_nrf5_lock_app_build) {
    group("nrf5_lock_app") {
      deps = [ "${chip_root}/examples/lock-app/nrf5(${chip_root}/config/nrf5/toolchain:nrf5_lock_app)" ]
    }
  }

  if (enable_nrf5_lighting_app_build) {
    group("nrf5_lighting_app") {
      deps = [ "${chip_root}/examples/lighting-app/nrf5(${chip_root}/config/nrf5/toolchain:nrf5_lighting_app)" ]
    }
  }

  if (enable_nrf5_pigweed_app_build) {
    group("nrf5_pigweed_app") {
      deps = [ "${chip_root}/examples/pigweed-app/nrf5(${chip_root}/config/nrf5/toolchain:nrf5_pigweed_app)" ]
    }
  }

  if (enable_efr32_lock_app_build) {
    group("efr32_lock_app") {
      deps = [ "${chip_root}/examples/lock-app/efr32(${chip_root}/config/efr32/toolchain:efr32_lock_app)" ]
    }
  }

  if (enable_qpg6100_lock_app_build) {
    group("qpg6100_lock_app") {
      deps = [ "${chip_root}/examples/lock-app/qpg6100(${chip_root}/config/qpg6100/toolchain:qpg6100_lock_app)" ]
    }
  }

  if (enable_efr32_lighting_app_build) {
    group("efr32_lighting_app") {
      deps = [ "${chip_root}/examples/lighting-app/efr32(${chip_root}/config/efr32/toolchain:efr32_lighting_app)" ]
    }
  }

  group("default") {
    deps = []
    if (enable_host_clang_build) {
      deps += [ ":all_host_clang" ]
    }
    if (enable_host_gcc_build) {
      deps += [ ":all_host_gcc" ]
    }
    if (enable_host_gcc_mbedtls_build) {
      deps += [ ":all_host_gcc_mbedtls" ]
    }
    if (enable_android_builds) {
      deps += [
        ":all_android_arm",
        ":all_android_arm64",
        ":all_android_x64",
        ":all_android_x86",
      ]
    }
    if (enable_standalone_chip_tool_build) {
      deps += [ ":standalone_chip_tool" ]
    }
    if (enable_standalone_shell_build) {
      deps += [ ":standalone_shell" ]
    }
    if (enable_nrf5_lock_app_build) {
      deps += [ ":nrf5_lock_app" ]
    }
    if (enable_nrf5_lighting_app_build) {
      deps += [ ":nrf5_lighting_app" ]
    }
    if (enable_nrf5_pigweed_app_build) {
      deps += [ ":nrf5_pigweed_app" ]
    }
    if (enable_efr32_lock_app_build) {
      deps += [ ":efr32_lock_app" ]
    }
  }

  group("check") {
    deps = []
    if (enable_host_clang_build) {
      deps += [ ":check_host_clang" ]
    }
    if (enable_host_gcc_build) {
      deps += [ ":check_host_gcc" ]
    }
    if (enable_host_gcc_mbedtls_build) {
      deps += [ ":check_host_gcc_mbedtls" ]
    }
  }
}
