# 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-dishwasher-alarm-delegate-impl.cpp",
    "${project_dir}/common/chef-dishwasher-mode-delegate-impl.cpp",
    "${project_dir}/common/chef-fan-control-manager.cpp",
    "${project_dir}/common/chef-laundry-washer-controls-delegate-impl.cpp",
    "${project_dir}/common/chef-laundry-washer-mode.cpp",
    "${project_dir}/common/chef-operational-state-delegate-impl.cpp",
    "${project_dir}/common/chef-rpc-actions-worker.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/refrigerator-and-temperature-controlled-cabinet-mode/tcc-mode.cpp",
    "${project_dir}/common/clusters/resource-monitoring/chef-resource-monitoring-delegates.cpp",
    "${project_dir}/common/clusters/switch/SwitchEventHandler.cpp",
    "${project_dir}/common/clusters/switch/SwitchManager.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_ACTIONS_SERVICE=1",
      "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:actions_service.nanopb_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" ]
}
