BUILD.gn 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. # Copyright 2014 The Chromium Authors
  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/config/nacl/config.gni")
  5. import("//ppapi/buildflags/buildflags.gni")
  6. import("//tools/grit/grit_rule.gni")
  7. # Applied by targets internal to content.
  8. config("content_implementation") {
  9. defines = [ "CONTENT_IMPLEMENTATION" ]
  10. configs = [ "//build/config/compiler:wexit_time_destructors" ]
  11. }
  12. assert(!is_ios, "Chromium/iOS shouldn't use anything in //content")
  13. # When targets depend on, e.g. //content/public/browser, what happens? To
  14. # facilitate the complexity here, the "public" targets are groups that forward
  15. # to the right thing depending on the build mode. Say for additional
  16. # illustration, the public browser sources also depend on the public common
  17. # ones.
  18. #
  19. # The non-component build is easy:
  20. # foo ->
  21. # //content/public/browser (group) ->
  22. # //content/public/browser:browser_sources (source set) ->
  23. # //content/browser (source set, this is the non-public browser target)
  24. # //content/public/common:common_sources (source set)
  25. #
  26. # The component build is more complicated because we want everybody to depend on
  27. # one content shared library regardless of which public target they depend on:
  28. # foo ->
  29. # //content/public/browser (group) ->
  30. # //content (shared library) ->
  31. # //content/public/browser:browser_sources (source set) ->
  32. # //content/browser (source set; this is the non-public browser target)
  33. # //content/public/common:common_sources (source set)
  34. #
  35. # That the internal content dependencies must depend on the *_sources targets
  36. # to avoid dependency cycles, and external dependencies must depend on the
  37. # //content/public/browser and similar targets to avoid double-linking (these
  38. # targets make sure the dependency goes through the content shared library
  39. # when doing a component build).
  40. #
  41. # TESTS
  42. # -----
  43. # Tests are a challenge. The content tests need to access internals of
  44. # content/browser, for example, but the tests themselves are outside of the
  45. # content component (which is a shared library in the component build). To
  46. # prevent external-to-content targets from depending on private headers,
  47. # the non-public content/browser target is not a public dep of the content
  48. # component. But this means there is also no public path for the content
  49. # tests and no way to restrict that just to //content/test/* if we added one.
  50. #
  51. # As a result, we check deps for //content/test/* only in non-component builds
  52. # (which should verify the dependencies are correct for both component and
  53. # non-component cases equally). There are targets like
  54. # //content/browser:for_content_tests that allow content/test to depend on the
  55. # //content/browser target only in non-component builds (when there are no
  56. # linking problems) for when check is enabled.
  57. content_shared_components = [
  58. "//content/nw:nw_base",
  59. "//content/gpu:gpu_sources",
  60. "//content/public/browser:browser_sources",
  61. "//content/public/child:child_sources",
  62. "//content/public/common:common_sources",
  63. "//content/public/gpu:gpu_sources",
  64. "//content/public/renderer:renderer_sources",
  65. "//content/public/utility:utility_sources",
  66. ]
  67. if (enable_ppapi) {
  68. content_shared_components += [ "//content/ppapi_plugin:ppapi_plugin_sources" ]
  69. }
  70. if (is_component_build) {
  71. component("content") {
  72. public_deps =
  73. content_shared_components + [ "//content/public/app:app_sources" ]
  74. deps = [
  75. "//content/nw:nw_content",
  76. ]
  77. }
  78. } else {
  79. group("content") {
  80. public_deps = content_shared_components
  81. }
  82. }
  83. grit("content_resources") {
  84. source = "content_resources.grd"
  85. outputs = [
  86. "grit/content_resources.h",
  87. "grit/content_resources_map.cc",
  88. "grit/content_resources_map.h",
  89. "content_resources.pak",
  90. ]
  91. deps = [
  92. "//components/ukm/debug:build_ts",
  93. "//content/browser/resources/histograms:build_ts",
  94. "//gpu/ipc/common:vulkan_interface_webui_js",
  95. "//ui/base/mojom:mojom_js",
  96. "//ui/gfx/geometry/mojom:mojom_js",
  97. "//ui/gfx/image/mojom:mojom_js",
  98. "//ui/gfx/range/mojom:mojom_js",
  99. "//url/mojom:url_mojom_origin_js",
  100. "//url/mojom:url_mojom_origin_webui_js",
  101. ]
  102. }
  103. grit("dev_ui_content_resources") {
  104. source = "dev_ui_content_resources.grd"
  105. outputs = [
  106. "grit/dev_ui_content_resources.h",
  107. "dev_ui_content_resources.pak",
  108. ]
  109. deps = [
  110. "//content/browser/aggregation_service:mojo_bindings_webui_js",
  111. "//content/browser/attribution_reporting:mojo_bindings_webui_js",
  112. "//content/browser/preloading/prerender:mojo_bindings_webui_js",
  113. "//content/browser/resources/aggregation_service:build_ts",
  114. "//content/browser/resources/attribution_reporting:build_ts",
  115. "//content/browser/resources/gpu:html_wrapper_files",
  116. "//content/browser/resources/process:build_ts",
  117. "//storage/browser/quota:mojo_bindings_webui_js",
  118. ]
  119. }
  120. # This target exists to "hold" the content_export header so we can do proper
  121. # inclusion testing of it.
  122. source_set("export") {
  123. # Must only be used inside of content.
  124. visibility = [ "//content/*" ]
  125. sources = [ "common/content_export.h" ]
  126. }
  127. # In the GYP build, this file is listed in several targets. In GN just have
  128. # those targets depend on this one. This can be depended on for any
  129. # platform for simplicity, and is a no-op on non-Windows.
  130. source_set("sandbox_helper_win") {
  131. if (is_win) {
  132. sources = [
  133. "app/sandbox_helper_win.cc",
  134. "public/app/sandbox_helper_win.h",
  135. ]
  136. deps = [ "//sandbox" ]
  137. }
  138. }