BUILD.gn 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. # Copyright 2020 The Chromium Authors. All rights reserved.
  2. # Use of this source code is governed by a BSD-style license that can be
  3. # found in the LICENSE file.
  4. import("//build/buildflag_header.gni")
  5. import("//build/config/features.gni")
  6. import("//testing/test.gni")
  7. declare_args() {
  8. # If true, forces cast_api_bindings::CreatePlatformMessagePortPair to use
  9. # cast_message_port::CreateMessagePortPair as its implementation. Otherwise,
  10. # uses one of the other types based on platform.
  11. use_message_port_core = false
  12. }
  13. buildflag_header("message_port_buildflags") {
  14. header = "message_port_buildflags.h"
  15. flags = [ "USE_MESSAGE_PORT_CORE=$use_message_port_core" ]
  16. }
  17. source_set("message_port") {
  18. public = [ "platform_message_port.h" ]
  19. sources = [ "platform_message_port.cc" ]
  20. public_deps = [ ":public" ]
  21. deps = [
  22. ":message_port_buildflags",
  23. "//base",
  24. ]
  25. if (use_message_port_core) {
  26. public_deps += [ ":message_port_core" ]
  27. } else if (is_fuchsia) {
  28. public_deps += [ ":message_port_fuchsia" ]
  29. } else {
  30. public_deps += [ ":message_port_cast" ]
  31. }
  32. }
  33. source_set("blink_message_port_adapter") {
  34. public = [ "blink_message_port_adapter.h" ]
  35. sources = [ "blink_message_port_adapter.cc" ]
  36. public_deps = [
  37. ":message_port",
  38. "//third_party/blink/public/common",
  39. ]
  40. deps = [
  41. ":message_port_cast",
  42. "//base",
  43. ]
  44. }
  45. source_set("public") {
  46. sources = [
  47. "message_port.cc",
  48. "message_port.h",
  49. ]
  50. deps = [
  51. "//base",
  52. "//components/cast:export",
  53. ]
  54. defines = [ "CAST_COMPONENT_IMPLEMENTATION" ]
  55. }
  56. if (is_fuchsia) {
  57. source_set("message_port_fuchsia") {
  58. public = [
  59. "fuchsia/create_web_message.h",
  60. "fuchsia/message_port_fuchsia.h",
  61. ]
  62. sources = [
  63. "fuchsia/create_web_message.cc",
  64. "fuchsia/message_port_fuchsia.cc",
  65. ]
  66. public_deps = [
  67. ":public",
  68. "//base",
  69. "//third_party/abseil-cpp:absl",
  70. "//third_party/fuchsia-sdk/sdk/fidl/fuchsia.web",
  71. ]
  72. deps = [ "//third_party/fuchsia-sdk/sdk/pkg/fit-promise" ]
  73. }
  74. }
  75. source_set("message_port_cast") {
  76. public = [ "cast/message_port_cast.h" ]
  77. sources = [ "cast/message_port_cast.cc" ]
  78. public_deps = [
  79. ":public",
  80. "//third_party/blink/public/common",
  81. ]
  82. deps = [
  83. ":public",
  84. "//base",
  85. "//third_party/blink/public/common",
  86. ]
  87. }
  88. source_set("message_port_core") {
  89. public = [
  90. "cast_core/create_message_port_core.h",
  91. "cast_core/message_connector.h",
  92. "cast_core/message_port_core.h",
  93. "cast_core/message_port_core_with_task_runner.h",
  94. ]
  95. sources = [
  96. "cast_core/create_message_port_core.cc",
  97. "cast_core/message_connector.cc",
  98. "cast_core/message_port_core.cc",
  99. "cast_core/message_port_core_with_task_runner.cc",
  100. ]
  101. public_deps = [ ":public" ]
  102. deps = [
  103. ":public",
  104. "//base",
  105. ]
  106. }
  107. source_set("message_port_unittest") {
  108. testonly = true
  109. sources = [ "message_port_unittest.cc" ]
  110. deps = [
  111. ":blink_message_port_adapter",
  112. ":message_port",
  113. ":message_port_buildflags",
  114. ":message_port_cast",
  115. ":message_port_core",
  116. ":test_message_port_receiver",
  117. "//base/test:test_support",
  118. "//testing/gtest",
  119. ]
  120. if (is_fuchsia) {
  121. deps += [ ":message_port_fuchsia" ]
  122. }
  123. }
  124. source_set("test_message_port_receiver") {
  125. testonly = true
  126. sources = [
  127. "test_message_port_receiver.cc",
  128. "test_message_port_receiver.h",
  129. ]
  130. deps = [
  131. ":public",
  132. "//base",
  133. ]
  134. }