# Copyright (c) 2024 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/chip.gni")

import("${chip_root}/build/chip/tools.gni")

import("//with_pw_rpc.gni")

assert(chip_build_tools)

declare_args() {
  bridge_enable_pw_rpc = false
}

if (bridge_enable_pw_rpc) {
  import("//build_overrides/pigweed.gni")
  import("$dir_pw_build/target_types.gni")
  import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni")
}

executable("fabric-bridge-app") {
  sources = [
    "${chip_root}/examples/fabric-bridge-app/fabric-bridge-common/include/CHIPProjectAppConfig.h",
    "CommissionerControl.cpp",
    "main.cpp",
  ]

  deps = [
    "${chip_root}/examples/fabric-bridge-app/fabric-bridge-common",
    "${chip_root}/examples/fabric-bridge-app/fabric-bridge-common:fabric-bridge-lib",
    "${chip_root}/examples/platform/linux:app-main",
    "${chip_root}/src/lib",
  ]

  include_dirs = [ "include" ]

  if (bridge_enable_pw_rpc) {
    defines = [
      "PW_RPC_FABRIC_ADMIN_SERVICE=1",
      "PW_RPC_FABRIC_BRIDGE_SERVICE=1",
    ]

    sources += [
      "${chip_root}/examples/platform/linux/RpcClientProcessor.cpp",
      "${chip_root}/examples/platform/linux/RpcClientProcessor.h",
      "${chip_root}/examples/platform/linux/system_rpc_server.cc",
      "RpcClient.cpp",
      "RpcServer.cpp",
      "include/RpcClient.h",
      "include/RpcServer.h",
    ]

    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_rpc/system_server:socket",
      "$dir_pw_stream:socket_stream",
      "$dir_pw_sync:mutex",
      "${chip_root}/config/linux/lib/pw_rpc:pw_rpc",
      "${chip_root}/examples/common/pigweed:fabric_admin_service.nanopb_rpc",
      "${chip_root}/examples/common/pigweed:fabric_bridge_service.nanopb_rpc",
      "${chip_root}/examples/common/pigweed:rpc_services",
    ]

    deps += pw_build_LINK_DEPS

    include_dirs += [
      "${chip_root}/examples/common",
      "${chip_root}/examples/platform/linux",
    ]
  } 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("linux") {
  deps = [ ":fabric-bridge-app" ]
}

group("default") {
  deps = [ ":fabric-bridge-app" ]
}
