# Copyright(c) 2021 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/build.gni")
import("//build_overrides/chip.gni")
import("//build_overrides/openthread.gni")
import("//build_overrides/qpg_sdk.gni")

import("${build_root}/config/defaults.gni")
import("${chip_root}/src/platform/device.gni")
import("${qpg_sdk_build_root}/qpg_executable.gni")
import("${qpg_sdk_build_root}/qpg_sdk.gni")

# declares chip_build_libshell = false
import("${chip_root}/src/lib/lib.gni")

# declares chip_enable_pw_rpc = false
import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni")
if (chip_enable_pw_rpc) {
  import("//build_overrides/pigweed.gni")
  import("$dir_pw_build/target_types.gni")
}

assert(current_os == "freertos")

qpg_project_dir = "${chip_root}/examples/lighting-app/qpg"
examples_plat_dir = "${chip_root}/examples/platform/qpg"

qpg_sdk("sdk") {
  include_dirs = [
    "${chip_root}/src/platform/qpg",
    "${examples_plat_dir}",
    "${qpg_project_dir}/include",
  ]

  if (chip_enable_pw_rpc) {
    defines = [ "PW_RPC_ENABLED" ]
  }
}

qpg_executable("lighting_app") {
  output_name = "chip-${qpg_target_ic}-lighting-example.out"

  sources = [
    "${chip_root}/src/app/clusters/general-diagnostics-server/GenericFaultTestEventTriggerDelegate.cpp",
    "${examples_plat_dir}/app/main.cpp",
    "${examples_plat_dir}/ota/ota.cpp",
    "${examples_plat_dir}/powercycle_counting.c",
    "include/LightingManager.h",
    "src/AppTask.cpp",
    "src/LightingManager.cpp",
    "src/ZclCallbacks.cpp",
  ]

  deps = [
    ":sdk",
    "${chip_root}/examples/lighting-app/lighting-common:color-format",
    "${chip_root}/examples/lighting-app/qpg/zap/",
    "${chip_root}/examples/providers:device_info_provider",
    "${chip_root}/src/lib",
    "${chip_root}/src/setup_payload",
    "${chip_root}/third_party/openthread/platforms:libopenthread-platform",
    "${chip_root}/third_party/openthread/platforms:libopenthread-platform-utils",
    "${chip_root}/third_party/qpg_sdk:qpg_light_factorydata_lib",
    "${chip_root}/third_party/qpg_sdk:qpg_light_factorydata_lib",
    "${chip_root}/third_party/qpg_sdk:qpg_light_firmwaredata_lib",
  ]

  if (chip_openthread_ftd) {
    deps += [ "${chip_root}/third_party/openthread/repo:libopenthread-ftd" ]
  } else {
    deps += [ "${chip_root}/third_party/openthread/repo:libopenthread-mtd" ]
  }

  include_dirs = [
    "include",
    "${examples_plat_dir}/ota",
  ]

  defines = [ "GP_APP_DIVERSITY_POWERCYCLECOUNTING" ]

  if (chip_enable_pw_rpc) {
    defines += [
      "PW_RPC_ENABLED",
      "PW_RPC_ATTRIBUTE_SERVICE=1",
      "PW_RPC_BUTTON_SERVICE=1",
      "PW_RPC_DEVICE_SERVICE=1",
      "PW_RPC_LIGHTING_SERVICE=1",
    ]

    sources += [
      "${chip_root}/examples/common/pigweed/RpcService.cpp",
      "${chip_root}/examples/common/pigweed/qpg/PigweedLoggerMutex.cpp",
      "${examples_plat_dir}/PigweedLogger.cpp",
      "${examples_plat_dir}/Rpc.cpp",
      "${examples_plat_dir}/uart.c",
    ]

    deps += [
      "$dir_pw_hdlc:rpc_channel_output",
      "$dir_pw_stream:sys_io_stream",
      "${chip_root}/config/qpg/lib/pw_rpc:pw_rpc",
      "${chip_root}/examples/common/pigweed:attributes_service.nanopb_rpc",
      "${chip_root}/examples/common/pigweed:button_service.nanopb_rpc",
      "${chip_root}/examples/common/pigweed:device_service.nanopb_rpc",
      "${chip_root}/examples/common/pigweed:lighting_service.nanopb_rpc",
      "${examples_plat_dir}/pw_sys_io:pw_sys_io_qpg",
    ]

    deps += pw_build_LINK_DEPS

    include_dirs += [
      "${chip_root}/examples/common",
      "${chip_root}/examples/common/pigweed/qpg",
    ]
  } else {
    # The below gives compiler erros in pigweed, therefore it is only enabled
    # when rpc is not
    cflags = [ "-Wconversion" ]
  }

  if (chip_build_libshell) {
    deps += [ "${examples_plat_dir}:qpg-matter-shell" ]
  } else {
    if (chip_openthread_ftd) {
      deps +=
          [ "${chip_root}/third_party/openthread/repo:libopenthread-cli-ftd" ]
    } else {
      deps +=
          [ "${chip_root}/third_party/openthread/repo:libopenthread-cli-mtd" ]
    }
  }

  ldscript = "${qpg_sdk_root}/Libraries/Qorvo/QorvoStack/gen/QorvoStack_${qpg_target_ic}/QorvoStack_${qpg_target_ic}.ld"

  inputs = [ ldscript ]

  ldflags = [ "-T" + rebase_path(ldscript, root_build_dir) ]

  output_dir = root_out_dir
}

group("qpg") {
  deps = [ ":lighting_app" ]
}

group("default") {
  deps = [ ":qpg" ]
}
