# 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-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/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" ]
}
