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

source_set("chip-all-clusters-common") {
  sources = [
    "${chip_root}/examples/all-clusters-app/all-clusters-common/src/binding-handler.cpp",
    "${chip_root}/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp",
    "${chip_root}/examples/all-clusters-app/all-clusters-common/src/fan-stub.cpp",
    "${chip_root}/examples/all-clusters-app/all-clusters-common/src/operational-state-delegate-impl.cpp",
    "${chip_root}/examples/all-clusters-app/all-clusters-common/src/operational-state-delegates.cpp",
    "${chip_root}/examples/all-clusters-app/all-clusters-common/src/smco-stub.cpp",
    "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp",
    "AllClustersCommandDelegate.cpp",
    "AppOptions.cpp",
    "WindowCoveringManager.cpp",
    "include/tv-callbacks.cpp",
    "include/tv-callbacks.h",
    "main-common.cpp",
  ]

  deps = [
    "${chip_root}/examples/all-clusters-app/all-clusters-common",
    "${chip_root}/examples/platform/linux:app-main",
    "${chip_root}/src/app/tests/suites/credentials:dac_provider",
    "${chip_root}/src/lib",
    "${chip_root}/third_party/jsoncpp",
  ]

  include_dirs =
      [ "${chip_root}/examples/all-clusters-app/all-clusters-common/include" ]

  cflags = [ "-Wconversion" ]

  if (chip_build_libshell) {
    defines = [ "ENABLE_CHIP_SHELL" ]
  }
}

source_set("chip-lock-app-common") {
  sources = [
    "${chip_root}/examples/lock-app/lock-common/include/LockEndpoint.h",
    "${chip_root}/examples/lock-app/lock-common/include/LockManager.h",
    "${chip_root}/examples/lock-app/lock-common/src/LockEndpoint.cpp",
    "${chip_root}/examples/lock-app/lock-common/src/LockManager.cpp",
    "${chip_root}/examples/lock-app/lock-common/src/ZCLDoorLockCallbacks.cpp",
  ]

  deps = [ "${chip_root}/examples/all-clusters-app/all-clusters-common" ]

  include_dirs = [ "${chip_root}/examples/lock-app/lock-common/include" ]

  cflags = [ "-Wconversion" ]
}

if (is_libfuzzer) {
  executable("chip-all-clusters-app-fuzzing") {
    sources = [ "fuzzing-main.cpp" ]

    deps = [
      ":chip-all-clusters-common",
      ":chip-lock-app-common",
      "${chip_root}/examples/platform/linux:app-main",
    ]

    cflags = [ "-Wconversion" ]

    output_dir = root_out_dir
  }
} else {
  executable("chip-all-clusters-app") {
    sources = [ "main.cpp" ]

    deps = [
      ":chip-all-clusters-common",
      ":chip-lock-app-common",
      "${chip_root}/examples/platform/linux:app-main",
    ]

    cflags = [ "-Wconversion" ]

    include_dirs =
        [ "${chip_root}/examples/all-clusters-app/all-clusters-common/include" ]

    output_dir = root_out_dir
  }

  if (chip_device_platform == "darwin") {
    action("codesign") {
      script = "entitlements/codesign.py"
      public_deps = [ ":chip-all-clusters-app" ]

      args = [
        "--target_path",
        rebase_path("${root_build_dir}/chip-all-clusters-app", root_build_dir),
        "--log_path",
        rebase_path("${root_build_dir}/codesign_log.txt", root_build_dir),
      ]

      output_name = "codesign_log.txt"
      outputs = [ "${root_build_dir}/${output_name}" ]
    }
  }
}

group("linux") {
  deps = []
  if (is_libfuzzer) {
    deps += [ ":chip-all-clusters-app-fuzzing" ]
  } else {
    deps += [ ":chip-all-clusters-app" ]
  }
}

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