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

if (config_use_interactive_mode) {
  import("//build_overrides/editline.gni")
}

assert(chip_build_tools)

config("config") {
  include_dirs = [
    ".",
    "${chip_root}/examples/common",
    "${chip_root}/zzz_generated/app-common/app-common",
    "${chip_root}/zzz_generated/chip-tool",
    "${chip_root}/src/lib",
  ]

  defines = [
    "CONFIG_USE_SEPARATE_EVENTLOOP=${config_use_separate_eventloop}",
    "CONFIG_USE_INTERACTIVE_MODE=${config_use_interactive_mode}",
  ]

  # Note: CONFIG_USE_LOCAL_STORAGE is tested for via #ifdef, not #if.
  if (config_use_local_storage) {
    defines += [ "CONFIG_USE_LOCAL_STORAGE" ]
  }

  cflags = [ "-Wconversion" ]
}

static_library("chip-tool-utils") {
  sources = [
    "${chip_root}/src/controller/ExamplePersistentStorage.cpp",
    "${chip_root}/src/controller/ExamplePersistentStorage.h",
    "${chip_root}/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp",
    "${chip_root}/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp",
    "${chip_root}/zzz_generated/chip-tool/zap-generated/cluster/logging/EntryToText.cpp",
    "commands/clusters/ModelCommand.cpp",
    "commands/clusters/ModelCommand.h",
    "commands/common/BDXDiagnosticLogsServerDelegate.cpp",
    "commands/common/CHIPCommand.cpp",
    "commands/common/CHIPCommand.h",
    "commands/common/Command.cpp",
    "commands/common/Command.h",
    "commands/common/Commands.cpp",
    "commands/common/Commands.h",
    "commands/common/CredentialIssuerCommands.h",
    "commands/common/HexConversion.h",
    "commands/common/RemoteDataModelLogger.cpp",
    "commands/common/RemoteDataModelLogger.h",
    "commands/delay/SleepCommand.cpp",
    "commands/delay/WaitForCommissioneeCommand.cpp",
    "commands/discover/DiscoverCommand.cpp",
    "commands/discover/DiscoverCommissionablesCommand.cpp",
    "commands/discover/DiscoverCommissionersCommand.cpp",
    "commands/icd/ICDCommand.cpp",
    "commands/icd/ICDCommand.h",
    "commands/pairing/OpenCommissioningWindowCommand.cpp",
    "commands/pairing/OpenCommissioningWindowCommand.h",
    "commands/pairing/PairingCommand.cpp",
    "commands/pairing/ToTLVCert.cpp",
    "commands/payload/AdditionalDataParseCommand.cpp",
    "commands/payload/SetupPayloadGenerateCommand.cpp",
    "commands/payload/SetupPayloadParseCommand.cpp",
    "commands/payload/SetupPayloadVerhoeff.cpp",
    "commands/session-management/CloseSessionCommand.cpp",
    "commands/session-management/CloseSessionCommand.h",
    "commands/storage/StorageManagementCommand.cpp",
  ]

  deps = [ "${chip_root}/src/app:events" ]

  if (config_use_interactive_mode) {
    sources += [ "commands/interactive/InteractiveCommands.cpp" ]
    deps += [
      "${chip_root}/examples/common/websocket-server",
      "${chip_root}/src/platform/logging:headers",
      "${editline_root}:editline",
    ]
  }

  if (chip_device_platform == "darwin") {
    sources += [ "commands/common/DeviceScanner.cpp" ]
  }

  public_deps = [
    "${chip_root}/examples/common/tracing:commandline",
    "${chip_root}/src/app/icd/client:handler",
    "${chip_root}/src/app/icd/client:manager",
    "${chip_root}/src/app/server",
    "${chip_root}/src/app/tests/suites/commands/interaction_model",
    "${chip_root}/src/controller/data_model",
    "${chip_root}/src/credentials:file_attestation_trust_store",
    "${chip_root}/src/credentials:test_dac_revocation_delegate",
    "${chip_root}/src/lib",
    "${chip_root}/src/lib/core:types",
    "${chip_root}/src/lib/support/jsontlv",
    "${chip_root}/src/platform",
    "${chip_root}/third_party/inipp",
    "${chip_root}/third_party/jsoncpp",
  ]

  public_configs = [ ":config" ]

  if (chip_enable_transport_trace) {
    public_deps +=
        [ "${chip_root}/examples/common/tracing:trace_handlers_decoder" ]
  }

  output_dir = root_out_dir
}

executable("chip-tool") {
  sources = [ "main.cpp" ]

  deps = [
    ":chip-tool-utils",
    "${chip_root}/src/platform/logging:stdio",
  ]

  output_dir = root_out_dir
}

group("default") {
  deps = [ ":chip-tool" ]
}
