BUILD.gn 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. # Copyright (c) 2020 Project CHIP Authors
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. import("//build_overrides/chip.gni")
  15. import("//build_overrides/openthread.gni")
  16. import("${chip_root}/src/platform/device.gni")
  17. declare_args() {
  18. # Enable server command only on linux for now.
  19. chip_shell_cmd_server = current_os == "linux" || current_os == "mac"
  20. }
  21. config("shell_common_config") {
  22. include_dirs = [
  23. ".",
  24. "include",
  25. "${chip_root}/src/lib/shell",
  26. ]
  27. defines = [
  28. "ENABLE_CHIP_SHELL",
  29. "OPENTHREAD_CONFIG_CLI_TRANSPORT=OT_CLI_TRANSPORT_CONSOLE",
  30. "CHIP_SHELL_ENABLE_CMD_SERVER=${chip_shell_cmd_server}",
  31. ]
  32. }
  33. static_library("shell_common") {
  34. sources = [
  35. "cmd_misc.cpp",
  36. "cmd_otcli.cpp",
  37. "globals.cpp",
  38. ]
  39. public_deps = [
  40. "${chip_root}/src/lib/shell",
  41. "${chip_root}/src/lib/support",
  42. "${chip_root}/src/platform",
  43. "${chip_root}/src/protocols",
  44. ]
  45. if (chip_enable_openthread &&
  46. (current_os == "freertos" || current_os == "zephyr")) {
  47. public_deps += [
  48. "${chip_root}/third_party/openthread:openthread",
  49. "${chip_root}/third_party/openthread:openthread_cli",
  50. ]
  51. }
  52. if (chip_shell_cmd_server) {
  53. sources += [ "cmd_server.cpp" ]
  54. import("${chip_root}/src/app/chip_data_model.gni")
  55. sources += [
  56. "${chip_root}/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp",
  57. "${chip_root}/examples/all-clusters-app/all-clusters-common/src/smco-stub.cpp",
  58. "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp",
  59. "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-temperature-levels.cpp",
  60. ]
  61. include_dirs =
  62. [ "${chip_root}/examples/all-clusters-app/all-clusters-common/include" ]
  63. public_deps +=
  64. [ "${chip_root}/examples/all-clusters-app/all-clusters-common" ]
  65. }
  66. public_configs = [ ":shell_common_config" ]
  67. cflags = [ "-Wconversion" ]
  68. }