# 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/build.gni")
import("//build_overrides/chip.gni")

import("${build_root}/config/compiler/compiler.gni")
import("${chip_root}/build/chip/tools.gni")
import("${chip_root}/src/app/chip_data_model.gni")
import("${chip_root}/src/app/common_flags.gni")

assert(chip_build_tools)

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")
}

import("sample.gni")

project_dir = "./.."

chip_data_model("chef-data-model") {
  zap_file = "${project_dir}/devices/${sample_zap_file}"
  is_server = true
}

executable("${sample_name}") {
  sources = [
    "${project_dir}/common/chef-air-quality.cpp",
    "${project_dir}/common/chef-concentration-measurement.cpp",
    "${project_dir}/common/chef-fan-control-manager.cpp",
    "${project_dir}/common/chef-operational-state-delegate-impl.cpp",
    "${project_dir}/common/chef-resource-monitoring-delegates.cpp",
    "${project_dir}/common/chef-rvc-mode-delegate.cpp",
    "${project_dir}/common/chef-rvc-operational-state-delegate.cpp",
    "${project_dir}/common/clusters/audio-output/AudioOutputManager.cpp",
    "${project_dir}/common/clusters/channel/ChannelManager.cpp",
    "${project_dir}/common/clusters/door-lock/chef-doorlock-stubs.cpp",
    "${project_dir}/common/clusters/door-lock/chef-lock-endpoint.cpp",
    "${project_dir}/common/clusters/door-lock/chef-lock-manager.cpp",
    "${project_dir}/common/clusters/keypad-input/KeypadInputManager.cpp",
    "${project_dir}/common/clusters/low-power/LowPowerManager.cpp",
    "${project_dir}/common/clusters/media-input/MediaInputManager.cpp",
    "${project_dir}/common/clusters/media-playback/MediaPlaybackManager.cpp",
    "${project_dir}/common/clusters/target-navigator/TargetNavigatorManager.cpp",
    "${project_dir}/common/clusters/wake-on-lan/WakeOnLanManager.cpp",
    "${project_dir}/common/stubs.cpp",
    "${project_dir}/linux/main.cpp",
  ]

  deps = [
    ":chef-data-model",
    "${chip_root}/examples/platform/linux:app-main",
    "${chip_root}/src/lib",
    "${project_dir}/shell_common:shell_common",
  ]

  include_dirs = [
    "include",
    "${project_dir}/common",
    "${project_dir}/common/clusters",
  ]

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

    sources += [
      "${chip_root}/examples/platform/linux/Rpc.cpp",
      "${chip_root}/examples/platform/linux/system_rpc_server.cc",
    ]

    deps += [
      "$dir_pw_hdlc:default_addresses",
      "$dir_pw_hdlc:rpc_channel_output",
      "$dir_pw_log",
      "$dir_pw_rpc:server",
      "$dir_pw_rpc/system_server:facade",
      "$dir_pw_stream:socket_stream",
      "$dir_pw_stream:sys_io_stream",
      "$dir_pw_sync:mutex",
      "$dir_pw_trace",
      "$dir_pw_trace_tokenized",
      "$dir_pw_trace_tokenized:trace_rpc_service",
      "${chip_root}/config/linux/lib/pw_rpc:pw_rpc",
      "${chip_root}/examples/common/pigweed:attributes_service.nanopb_rpc",
      "${chip_root}/examples/common/pigweed:boolean_state_service.nanopb_rpc",
      "${chip_root}/examples/common/pigweed:button_service.nanopb_rpc",
      "${chip_root}/examples/common/pigweed:descriptor_service.nanopb_rpc",
      "${chip_root}/examples/common/pigweed:device_service.nanopb_rpc",
      "${chip_root}/examples/common/pigweed:lighting_service.nanopb_rpc",
      "${chip_root}/examples/common/pigweed:rpc_services",
    ]

    deps += pw_build_LINK_DEPS

    cflags = []
    if (is_clang) {
      cflags += [ "-Wno-gnu-designator" ]
    }

    include_dirs += [ "${chip_root}/examples/common" ]
  } else {
    # The system_rpc_server.cc file is in pigweed and doesn't compile with
    # -Wconversion, remove check for RPC build only.
    cflags = [ "-Wconversion" ]
  }

  output_dir = root_out_dir
}

group("chef") {
  deps = [ ":${sample_name}" ]
}

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