| # 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_LOCAL_STORAGE=${config_use_local_storage}", | 
 |     "CONFIG_USE_SEPARATE_EVENTLOOP=${config_use_separate_eventloop}", | 
 |     "CONFIG_USE_INTERACTIVE_MODE=${config_use_interactive_mode}", | 
 |     "CONFIG_ENABLE_YAML_TESTS=${config_enable_yaml_tests}", | 
 |   ] | 
 |  | 
 |   cflags = [ "-Wconversion" ] | 
 | } | 
 |  | 
 | static_library("chip-tool-utils") { | 
 |   sources = [ | 
 |     "${chip_root}/src/app/tests/suites/include/ConstraintsChecker.h", | 
 |     "${chip_root}/src/app/tests/suites/include/ValueChecker.h", | 
 |     "${chip_root}/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp", | 
 |     "${chip_root}/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp", | 
 |     "commands/clusters/ModelCommand.cpp", | 
 |     "commands/clusters/ModelCommand.h", | 
 |     "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/pairing/PairingCommand.cpp", | 
 |  | 
 |     # TODO - enable CommissionedListCommand once DNS Cache is implemented | 
 |     #    "commands/pairing/CommissionedListCommand.cpp", | 
 |     #    "commands/pairing/CommissionedListCommand.h", | 
 |     "${chip_root}/src/controller/ExamplePersistentStorage.cpp", | 
 |     "${chip_root}/src/controller/ExamplePersistentStorage.h", | 
 |     "commands/pairing/CloseSessionCommand.cpp", | 
 |     "commands/pairing/CloseSessionCommand.h", | 
 |     "commands/pairing/OpenCommissioningWindowCommand.cpp", | 
 |     "commands/pairing/OpenCommissioningWindowCommand.h", | 
 |     "commands/payload/AdditionalDataParseCommand.cpp", | 
 |     "commands/payload/SetupPayloadGenerateCommand.cpp", | 
 |     "commands/payload/SetupPayloadParseCommand.cpp", | 
 |     "commands/payload/SetupPayloadVerhoeff.cpp", | 
 |     "commands/storage/StorageManagementCommand.cpp", | 
 |   ] | 
 |  | 
 |   deps = [] | 
 |  | 
 |   if (config_use_interactive_mode) { | 
 |     sources += [ "commands/interactive/InteractiveCommands.cpp" ] | 
 |     deps += [ | 
 |       "${chip_root}/examples/common/websocket-server", | 
 |       "${editline_root}:editline", | 
 |     ] | 
 |   } | 
 |  | 
 |   if (config_enable_yaml_tests) { | 
 |     sources += [ "commands/tests/TestCommand.cpp" ] | 
 |   } | 
 |  | 
 |   public_deps = [ | 
 |     "${chip_root}/src/app/server", | 
 |     "${chip_root}/src/app/tests/suites/commands/commissioner", | 
 |     "${chip_root}/src/app/tests/suites/commands/delay", | 
 |     "${chip_root}/src/app/tests/suites/commands/discovery", | 
 |     "${chip_root}/src/app/tests/suites/commands/interaction_model", | 
 |     "${chip_root}/src/app/tests/suites/commands/log", | 
 |     "${chip_root}/src/app/tests/suites/commands/system", | 
 |     "${chip_root}/src/app/tests/suites/pics", | 
 |     "${chip_root}/src/controller/data_model", | 
 |     "${chip_root}/src/credentials:file_attestation_trust_store", | 
 |     "${chip_root}/src/lib", | 
 |     "${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:force_stdio", | 
 |   ] | 
 |  | 
 |   output_dir = root_out_dir | 
 | } | 
 |  | 
 | group("default") { | 
 |   deps = [ ":chip-tool" ] | 
 | } |