blob: 1ece4f97f491eb1ca10ff27a65a350fc71b3bcc1 [file] [log] [blame]
[email protected]7e4c33142014-05-21 22:01:321# 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
[email protected]189add52014-05-28 16:51:445import("//tools/grit/grit_rule.gni")
phosek636bceb32015-10-27 03:36:486import("//build/config/nacl/config.gni")
[email protected]189add52014-05-28 16:51:447
8# Applied by targets internal to content.
9config("content_implementation") {
10 defines = [ "CONTENT_IMPLEMENTATION" ]
11}
12
Brett Wilson8f1323042014-09-11 16:58:5613# 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).
brettwb78fc9e2016-03-25 21:02:5140#
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.
Brett Wilson8f1323042014-09-11 16:58:5657
phosek636bceb32015-10-27 03:36:4858if (!is_nacl_nonsfi) {
59 content_shared_components = [
60 "//content/gpu:gpu_sources",
61 "//content/public/browser:browser_sources",
62 "//content/public/child:child_sources",
kcwu08377ad2016-02-18 19:12:4263 "//content/public/gpu:gpu_sources",
phosek636bceb32015-10-27 03:36:4864 "//content/public/common:common_sources",
65 "//content/public/plugin:plugin_sources",
66 "//content/public/renderer:renderer_sources",
67 "//content/public/utility:utility_sources",
68 ]
[email protected]dab154ee2014-06-13 23:48:5069
phosek636bceb32015-10-27 03:36:4870 if (enable_plugins) {
71 content_shared_components +=
72 [ "//content/ppapi_plugin:ppapi_plugin_sources" ]
73 }
jamesr50081742014-09-09 07:52:2274}
75
[email protected]dab154ee2014-06-13 23:48:5076if (is_component_build) {
agrieve3f532322016-01-05 03:23:1577 component("content") {
scottmg7afc4092014-12-03 19:22:4278 public_deps =
79 content_shared_components + [ "//content/public/app:both_sources" ]
brettwba7a73d2015-08-31 22:17:3980 deps = [
81 "//build/config/sanitizers:deps",
82 ]
[email protected]dab154ee2014-06-13 23:48:5083 }
phosek636bceb32015-10-27 03:36:4884} else if (is_nacl_nonsfi) {
85 source_set("content") {
86 set_sources_assignment_filter([])
87 sources = [
88 "common/sandbox_linux/sandbox_init_linux.cc",
89 "common/sandbox_linux/sandbox_seccomp_bpf_linux.cc",
90 "common/send_zygote_child_ping_linux.cc",
91 "public/common/content_switches.cc",
92 ]
93 set_sources_assignment_filter(sources_assignment_filter)
94
95 defines = [ "USE_SECCOMP_BPF=1" ]
96
97 deps = [
98 "//base",
99 ]
100 }
[email protected]dab154ee2014-06-13 23:48:50101} else {
102 group("content") {
brettwb7f2c302015-12-08 01:29:21103 public_deps = content_shared_components
[email protected]dab154ee2014-06-13 23:48:50104 }
105}
106
[email protected]189add52014-05-28 16:51:44107grit("resources") {
108 source = "content_resources.grd"
[email protected]ae8d08982014-08-20 19:42:29109 use_qualified_include = true
[email protected]b89c53842014-07-23 16:32:32110 outputs = [
111 "grit/content_resources.h",
112 "content_resources.pak",
[email protected]b89c53842014-07-23 16:32:32113 ]
[email protected]189add52014-05-28 16:51:44114}
115
[email protected]dab154ee2014-06-13 23:48:50116# This target exists to "hold" the content_export header so we can do proper
117# inclusion testing of it.
118source_set("export") {
brettwb78fc9e2016-03-25 21:02:51119 # Must only be used inside of content.
brettw9af42622014-09-06 21:21:02120 visibility = [ "//content/*" ]
[email protected]dab154ee2014-06-13 23:48:50121 sources = [
tfarina9568fc62015-07-22 23:35:38122 "common/content_export.h",
[email protected]dab154ee2014-06-13 23:48:50123 ]
124}
dprankedb5527d72015-03-08 04:22:47125
brettw4f56c5982015-05-04 22:12:39126# In the GYP build, this file is listed in several targets. In GN just have
127# those targets depend on this one. This can be depended on for any
128# platform for simplicity, and is a no-op on non-Windows.
pmonette18d3ed32015-10-16 21:06:06129source_set("sandbox_helper_win") {
brettw4f56c5982015-05-04 22:12:39130 if (is_win) {
dprankedb5527d72015-03-08 04:22:47131 sources = [
pmonette18d3ed32015-10-16 21:06:06132 "app/sandbox_helper_win.cc",
133 "public/app/sandbox_helper_win.h",
dprankedb5527d72015-03-08 04:22:47134 ]
135
136 deps = [
dprankedb5527d72015-03-08 04:22:47137 "//sandbox",
138 ]
139 }
140}