# 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/temperature-control/static-supported-temperature-levels.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" ]
}
