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