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 = |
| 85 | content_shared_components + [ "//content/public/app:both_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") { |
| 89 | set_sources_assignment_filter([]) |
| 90 | sources = [ |
Tom Sepez | 903f7f1 | 2017-10-26 17:34:02 | [diff] [blame] | 91 | "//services/service_manager/sandbox/linux/sandbox_seccomp_bpf_linux.cc", |
Tom Sepez | c09f5d4 | 2017-10-16 19:10:00 | [diff] [blame] | 92 | "common/sandbox_init_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 | ] |
| 96 | set_sources_assignment_filter(sources_assignment_filter) |
phosek | 636bceb3 | 2015-10-27 03:36:48 | [diff] [blame] | 97 | deps = [ |
| 98 | "//base", |
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", |
Tom Sepez | 15d4e52 | 2017-09-27 23:59:05 | [diff] [blame] | 102 | "//services/service_manager/sandbox", |
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 | |
brettw@chromium.org | 189add5 | 2014-05-28 16:51:44 | [diff] [blame] | 111 | grit("resources") { |
| 112 | source = "content_resources.grd" |
Dirk Pranke | a3727f9 | 2017-07-17 17:30:33 | [diff] [blame] | 113 | |
| 114 | # The .grd contains references to generated files. |
| 115 | source_is_generated = true |
| 116 | |
brettw@chromium.org | b89c5384 | 2014-07-23 16:32:32 | [diff] [blame] | 117 | outputs = [ |
| 118 | "grit/content_resources.h", |
| 119 | "content_resources.pak", |
brettw@chromium.org | b89c5384 | 2014-07-23 16:32:32 | [diff] [blame] | 120 | ] |
rockot | 00668f9 | 2016-04-07 18:56:23 | [diff] [blame] | 121 | grit_flags = [ |
| 122 | "-E", |
rockot | 0a386b5d9 | 2017-01-25 00:14:34 | [diff] [blame] | 123 | "root_gen_dir=" + rebase_path(root_gen_dir, root_build_dir), |
rockot | 00668f9 | 2016-04-07 18:56:23 | [diff] [blame] | 124 | ] |
| 125 | deps = [ |
Nasko Oskov | 3e19fbd | 2018-06-13 00:13:29 | [diff] [blame] | 126 | "//content/browser/process_internals:mojo_bindings_js", |
rockot | 00668f9 | 2016-04-07 18:56:23 | [diff] [blame] | 127 | ] |
brettw@chromium.org | 189add5 | 2014-05-28 16:51:44 | [diff] [blame] | 128 | } |
| 129 | |
brettw@chromium.org | dab154ee | 2014-06-13 23:48:50 | [diff] [blame] | 130 | # This target exists to "hold" the content_export header so we can do proper |
| 131 | # inclusion testing of it. |
| 132 | source_set("export") { |
brettw | b78fc9e | 2016-03-25 21:02:51 | [diff] [blame] | 133 | # Must only be used inside of content. |
brettw | 9af4262 | 2014-09-06 21:21:02 | [diff] [blame] | 134 | visibility = [ "//content/*" ] |
brettw@chromium.org | dab154ee | 2014-06-13 23:48:50 | [diff] [blame] | 135 | sources = [ |
tfarina | 9568fc6 | 2015-07-22 23:35:38 | [diff] [blame] | 136 | "common/content_export.h", |
brettw@chromium.org | dab154ee | 2014-06-13 23:48:50 | [diff] [blame] | 137 | ] |
| 138 | } |
dpranke | db5527d7 | 2015-03-08 04:22:47 | [diff] [blame] | 139 | |
brettw | 4f56c598 | 2015-05-04 22:12:39 | [diff] [blame] | 140 | # In the GYP build, this file is listed in several targets. In GN just have |
| 141 | # those targets depend on this one. This can be depended on for any |
| 142 | # platform for simplicity, and is a no-op on non-Windows. |
pmonette | 18d3ed3 | 2015-10-16 21:06:06 | [diff] [blame] | 143 | source_set("sandbox_helper_win") { |
brettw | 4f56c598 | 2015-05-04 22:12:39 | [diff] [blame] | 144 | if (is_win) { |
dpranke | db5527d7 | 2015-03-08 04:22:47 | [diff] [blame] | 145 | sources = [ |
pmonette | 18d3ed3 | 2015-10-16 21:06:06 | [diff] [blame] | 146 | "app/sandbox_helper_win.cc", |
| 147 | "public/app/sandbox_helper_win.h", |
dpranke | db5527d7 | 2015-03-08 04:22:47 | [diff] [blame] | 148 | ] |
Tom Sepez | 9b460f4 | 2017-08-10 19:58:10 | [diff] [blame] | 149 | |
dpranke | db5527d7 | 2015-03-08 04:22:47 | [diff] [blame] | 150 | deps = [ |
dpranke | db5527d7 | 2015-03-08 04:22:47 | [diff] [blame] | 151 | "//sandbox", |
| 152 | ] |
| 153 | } |
| 154 | } |