brettw@chromium.org | 7e4c3314 | 2014-05-21 22:01:32 | [diff] [blame] | 1 | # Copyright 2014 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 | |
phosek | 636bceb3 | 2015-10-27 03:36:48 | [diff] [blame] | 5 | import("//build/config/nacl/config.gni") |
Scott Violet | 02e38b9 | 2018-03-27 23:42:14 | [diff] [blame] | 6 | import("//ppapi/buildflags/buildflags.gni") |
Ken Rockot | f87b01cf | 2018-12-26 06:52:26 | [diff] [blame] | 7 | import("//tools/grit/grit_rule.gni") |
brettw@chromium.org | 189add5 | 2014-05-28 16:51:44 | [diff] [blame] | 8 | |
| 9 | # Applied by targets internal to content. |
| 10 | config("content_implementation") { |
| 11 | defines = [ "CONTENT_IMPLEMENTATION" ] |
Nico Weber | c0356ab | 2018-09-18 22:32:21 | [diff] [blame] | 12 | configs = [ |
| 13 | "//build/config/compiler:noshadowing", |
| 14 | "//build/config/compiler:wexit_time_destructors", |
| 15 | ] |
brettw@chromium.org | 189add5 | 2014-05-28 16:51:44 | [diff] [blame] | 16 | } |
| 17 | |
Colin Blundell | a6a9688 | 2019-02-13 09:52:32 | [diff] [blame] | 18 | assert(!is_ios, "Chromium/iOS shouldn't use anything in //content") |
| 19 | |
Brett Wilson | 8f132304 | 2014-09-11 16:58:56 | [diff] [blame] | 20 | # When targets depend on, e.g. //content/public/browser, what happens? To |
| 21 | # facilitate the complexity here, the "public" targets are groups that forward |
| 22 | # to the right thing depending on the build mode. Say for additional |
| 23 | # illustration, the public browser sources also depend on the public common |
| 24 | # ones. |
| 25 | # |
| 26 | # The non-component build is easy: |
| 27 | # foo -> |
| 28 | # //content/public/browser (group) -> |
| 29 | # //content/public/browser:browser_sources (source set) -> |
| 30 | # //content/browser (source set, this is the non-public browser target) |
| 31 | # //content/public/common:common_sources (source set) |
| 32 | # |
| 33 | # The component build is more complicated because we want everybody to depend on |
| 34 | # one content shared library regardless of which public target they depend on: |
| 35 | # foo -> |
| 36 | # //content/public/browser (group) -> |
| 37 | # //content (shared library) -> |
| 38 | # //content/public/browser:browser_sources (source set) -> |
| 39 | # //content/browser (source set; this is the non-public browser target) |
| 40 | # //content/public/common:common_sources (source set) |
| 41 | # |
| 42 | # That the internal content dependencies must depend on the *_sources targets |
| 43 | # to avoid dependency cycles, and external dependencies must depend on the |
| 44 | # //content/public/browser and similar targets to avoid double-linking (these |
| 45 | # targets make sure the dependency goes through the content shared library |
| 46 | # when doing a component build). |
brettw | b78fc9e | 2016-03-25 21:02:51 | [diff] [blame] | 47 | # |
| 48 | # TESTS |
| 49 | # ----- |
| 50 | # Tests are a challenge. The content tests need to access internals of |
| 51 | # content/browser, for example, but the tests themselves are outside of the |
| 52 | # content component (which is a shared library in the component build). To |
| 53 | # prevent external-to-content targets from depending on private headers, |
| 54 | # the non-public content/browser target is not a public dep of the content |
| 55 | # component. But this means there is also no public path for the content |
| 56 | # tests and no way to restrict that just to //content/test/* if we added one. |
| 57 | # |
| 58 | # As a result, we check deps for //content/test/* only in non-component builds |
| 59 | # (which should verify the dependencies are correct for both component and |
| 60 | # non-component cases equally). There are targets like |
| 61 | # //content/browser:for_content_tests that allow content/test to depend on the |
| 62 | # //content/browser target only in non-component builds (when there are no |
| 63 | # linking problems) for when check is enabled. |
Brett Wilson | 8f132304 | 2014-09-11 16:58:56 | [diff] [blame] | 64 | |
phosek | 636bceb3 | 2015-10-27 03:36:48 | [diff] [blame] | 65 | if (!is_nacl_nonsfi) { |
| 66 | content_shared_components = [ |
| 67 | "//content/gpu:gpu_sources", |
| 68 | "//content/public/browser:browser_sources", |
| 69 | "//content/public/child:child_sources", |
| 70 | "//content/public/common:common_sources", |
mmenke | f73a512 | 2017-07-13 23:27:39 | [diff] [blame] | 71 | "//content/public/gpu:gpu_sources", |
phosek | 636bceb3 | 2015-10-27 03:36:48 | [diff] [blame] | 72 | "//content/public/renderer:renderer_sources", |
| 73 | "//content/public/utility:utility_sources", |
| 74 | ] |
brettw@chromium.org | dab154ee | 2014-06-13 23:48:50 | [diff] [blame] | 75 | |
phosek | 636bceb3 | 2015-10-27 03:36:48 | [diff] [blame] | 76 | if (enable_plugins) { |
| 77 | content_shared_components += |
| 78 | [ "//content/ppapi_plugin:ppapi_plugin_sources" ] |
| 79 | } |
jamesr | 5008174 | 2014-09-09 07:52:22 | [diff] [blame] | 80 | } |
| 81 | |
brettw@chromium.org | dab154ee | 2014-06-13 23:48:50 | [diff] [blame] | 82 | if (is_component_build) { |
agrieve | 3f53232 | 2016-01-05 03:23:15 | [diff] [blame] | 83 | component("content") { |
scottmg | 7afc409 | 2014-12-03 19:22:42 | [diff] [blame] | 84 | public_deps = |
Nico Weber | 73db2f53 | 2020-04-21 19:40:18 | [diff] [blame] | 85 | content_shared_components + [ "//content/public/app:app_sources" ] |
brettw@chromium.org | dab154ee | 2014-06-13 23:48:50 | [diff] [blame] | 86 | } |
phosek | 636bceb3 | 2015-10-27 03:36:48 | [diff] [blame] | 87 | } else if (is_nacl_nonsfi) { |
| 88 | source_set("content") { |
phosek | 636bceb3 | 2015-10-27 03:36:48 | [diff] [blame] | 89 | sources = [ |
Robert Sesek | 7d0b49b | 2020-07-08 18:31:27 | [diff] [blame] | 90 | "//sandbox/policy/linux/sandbox_seccomp_bpf_linux.cc", |
Tom Sepez | c09f5d4 | 2017-10-16 19:10:00 | [diff] [blame] | 91 | "common/sandbox_init_linux.cc", |
Robert Sesek | 8621aef0 | 2020-06-25 18:17:37 | [diff] [blame] | 92 | "common/zygote/send_zygote_child_ping_linux.cc", |
phosek | 636bceb3 | 2015-10-27 03:36:48 | [diff] [blame] | 93 | "public/common/content_switches.cc", |
blundell | 30c1991 | 2016-12-20 13:21:06 | [diff] [blame] | 94 | "public/common/content_switches.h", |
phosek | 636bceb3 | 2015-10-27 03:36:48 | [diff] [blame] | 95 | ] |
phosek | 636bceb3 | 2015-10-27 03:36:48 | [diff] [blame] | 96 | deps = [ |
| 97 | "//base", |
Yuta Hijikata | 4d46202 | 2020-11-12 10:55:04 | [diff] [blame] | 98 | "//build:chromeos_buildflags", |
Scott Violet | a35f9a4 | 2018-03-22 22:00:44 | [diff] [blame] | 99 | "//media:media_buildflags", |
Scott Violet | 73634e32 | 2018-04-04 21:05:02 | [diff] [blame] | 100 | "//sandbox:sandbox_buildflags", |
brettw | d064ace4e | 2016-07-21 21:38:53 | [diff] [blame] | 101 | "//sandbox/linux:sandbox", |
Robert Sesek | 7d0b49b | 2020-07-08 18:31:27 | [diff] [blame] | 102 | "//sandbox/policy", |
phosek | 636bceb3 | 2015-10-27 03:36:48 | [diff] [blame] | 103 | ] |
| 104 | } |
brettw@chromium.org | dab154ee | 2014-06-13 23:48:50 | [diff] [blame] | 105 | } else { |
| 106 | group("content") { |
brettw | b7f2c30 | 2015-12-08 01:29:21 | [diff] [blame] | 107 | public_deps = content_shared_components |
brettw@chromium.org | dab154ee | 2014-06-13 23:48:50 | [diff] [blame] | 108 | } |
| 109 | } |
| 110 | |
Samuel Huang | d0b0e06 | 2020-01-20 06:32:12 | [diff] [blame] | 111 | grit("content_resources") { |
brettw@chromium.org | 189add5 | 2014-05-28 16:51:44 | [diff] [blame] | 112 | source = "content_resources.grd" |
Dirk Pranke | a3727f9 | 2017-07-17 17:30:33 | [diff] [blame] | 113 | |
brettw@chromium.org | b89c5384 | 2014-07-23 16:32:32 | [diff] [blame] | 114 | outputs = [ |
| 115 | "grit/content_resources.h", |
Kyle Horimoto | a69ab46 | 2019-04-23 00:08:21 | [diff] [blame] | 116 | "grit/content_resources_map.cc", |
| 117 | "grit/content_resources_map.h", |
brettw@chromium.org | b89c5384 | 2014-07-23 16:32:32 | [diff] [blame] | 118 | "content_resources.pak", |
brettw@chromium.org | b89c5384 | 2014-07-23 16:32:32 | [diff] [blame] | 119 | ] |
rockot | 00668f9 | 2016-04-07 18:56:23 | [diff] [blame] | 120 | deps = [ |
Ken Rockot | 4acce46 | 2020-12-01 01:06:00 | [diff] [blame] | 121 | "//gpu/ipc/common:vulkan_interface_webui_js", |
Mounir Lamouri | 32f95a0 | 2019-04-26 22:35:37 | [diff] [blame] | 122 | "//url/mojom:url_mojom_origin_js", |
Ken Rockot | 4acce46 | 2020-12-01 01:06:00 | [diff] [blame] | 123 | "//url/mojom:url_mojom_origin_webui_js", |
rockot | 00668f9 | 2016-04-07 18:56:23 | [diff] [blame] | 124 | ] |
brettw@chromium.org | 189add5 | 2014-05-28 16:51:44 | [diff] [blame] | 125 | } |
| 126 | |
Samuel Huang | d0b0e06 | 2020-01-20 06:32:12 | [diff] [blame] | 127 | grit("dev_ui_content_resources") { |
| 128 | source = "dev_ui_content_resources.grd" |
| 129 | |
Samuel Huang | d0b0e06 | 2020-01-20 06:32:12 | [diff] [blame] | 130 | outputs = [ |
| 131 | "grit/dev_ui_content_resources.h", |
| 132 | "dev_ui_content_resources.pak", |
| 133 | ] |
John Delaney | 99492f4 | 2020-05-05 18:41:22 | [diff] [blame] | 134 | deps = [ |
Ken Rockot | 4acce46 | 2020-12-01 01:06:00 | [diff] [blame] | 135 | "//content/browser/conversions:mojo_bindings_webui_js", |
| 136 | "//content/browser/process_internals:mojo_bindings_webui_js", |
John Delaney | 99492f4 | 2020-05-05 18:41:22 | [diff] [blame] | 137 | ] |
Samuel Huang | d0b0e06 | 2020-01-20 06:32:12 | [diff] [blame] | 138 | } |
| 139 | |
brettw@chromium.org | dab154ee | 2014-06-13 23:48:50 | [diff] [blame] | 140 | # This target exists to "hold" the content_export header so we can do proper |
| 141 | # inclusion testing of it. |
| 142 | source_set("export") { |
brettw | b78fc9e | 2016-03-25 21:02:51 | [diff] [blame] | 143 | # Must only be used inside of content. |
brettw | 9af4262 | 2014-09-06 21:21:02 | [diff] [blame] | 144 | visibility = [ "//content/*" ] |
Nico Weber | c18a0db | 2020-01-14 09:47:59 | [diff] [blame] | 145 | sources = [ "common/content_export.h" ] |
brettw@chromium.org | dab154ee | 2014-06-13 23:48:50 | [diff] [blame] | 146 | } |
dpranke | db5527d7 | 2015-03-08 04:22:47 | [diff] [blame] | 147 | |
brettw | 4f56c598 | 2015-05-04 22:12:39 | [diff] [blame] | 148 | # In the GYP build, this file is listed in several targets. In GN just have |
| 149 | # those targets depend on this one. This can be depended on for any |
| 150 | # platform for simplicity, and is a no-op on non-Windows. |
pmonette | 18d3ed3 | 2015-10-16 21:06:06 | [diff] [blame] | 151 | source_set("sandbox_helper_win") { |
brettw | 4f56c598 | 2015-05-04 22:12:39 | [diff] [blame] | 152 | if (is_win) { |
dpranke | db5527d7 | 2015-03-08 04:22:47 | [diff] [blame] | 153 | sources = [ |
pmonette | 18d3ed3 | 2015-10-16 21:06:06 | [diff] [blame] | 154 | "app/sandbox_helper_win.cc", |
| 155 | "public/app/sandbox_helper_win.h", |
dpranke | db5527d7 | 2015-03-08 04:22:47 | [diff] [blame] | 156 | ] |
Tom Sepez | 9b460f4 | 2017-08-10 19:58:10 | [diff] [blame] | 157 | |
Nico Weber | c18a0db | 2020-01-14 09:47:59 | [diff] [blame] | 158 | deps = [ "//sandbox" ] |
dpranke | db5527d7 | 2015-03-08 04:22:47 | [diff] [blame] | 159 | } |
| 160 | } |