# 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("${chip_root}/build/chip/tools.gni")
import("${chip_root}/src/lib/lib.gni")

assert(chip_build_tools)

declare_args() {
  chip_casting_simplified = false
}

executable("chip-tv-casting-app") {
  if (chip_casting_simplified) {
    sources = [
      "${chip_root}/examples/tv-casting-app/tv-casting-common/include/CHIPProjectAppConfig.h",
      "simple-app-helper.cpp",
      "simple-app-helper.h",
      "simple-app.cpp",
    ]
  } else {
    sources = [
      "${chip_root}/examples/tv-casting-app/tv-casting-common/include/CHIPProjectAppConfig.h",
      "CastingUtils.cpp",
      "CastingUtils.h",
      "main.cpp",
    ]
  }

  deps = [
    "${chip_root}/examples/common/tracing:commandline",
    "${chip_root}/examples/platform/linux:app-main",
    "${chip_root}/examples/tv-casting-app/tv-casting-common",
    "${chip_root}/src/credentials:default_attestation_verifier",
    "${chip_root}/src/lib",
    "${chip_root}/third_party/inipp",
    "${chip_root}/third_party/jsoncpp",
  ]

  defines = []
  include_dirs =
      [ "${chip_root}/examples/tv-casting-app/tv-casting-common/include" ]

  cflags = [ "-Wconversion" ]

  if (chip_build_libshell) {
    defines += [ "ENABLE_CHIP_SHELL" ]
    if (!chip_casting_simplified) {
      sources += [
        "CastingShellCommands.cpp",
        "CastingShellCommands.h",
      ]
    }
  }

  output_dir = root_out_dir
}

group("linux") {
  deps = [ ":chip-tv-casting-app" ]
}

group("default") {
  deps = [ ":linux" ]
}
