summaryrefslogtreecommitdiffstats
path: root/content/BUILD.gn
blob: 1d32ad24a201bd4f5ef13729755950ad2a915404 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//tools/grit/grit_rule.gni")
import("//build/config/nacl/config.gni")

# Applied by targets internal to content.
config("content_implementation") {
  defines = [ "CONTENT_IMPLEMENTATION" ]
}

# When targets depend on, e.g. //content/public/browser, what happens? To
# facilitate the complexity here, the "public" targets are groups that forward
# to the right thing depending on the build mode. Say for additional
# illustration, the public browser sources also depend on the public common
# ones.
#
# The non-component build is easy:
# foo ->
#   //content/public/browser (group) ->
#     //content/public/browser:browser_sources (source set) ->
#       //content/browser (source set, this is the non-public browser target)
#       //content/public/common:common_sources (source set)
#
# The component build is more complicated because we want everybody to depend on
# one content shared library regardless of which public target they depend on:
# foo ->
#   //content/public/browser (group) ->
#     //content (shared library) ->
#       //content/public/browser:browser_sources (source set) ->
#         //content/browser (source set; this is the non-public browser target)
#         //content/public/common:common_sources (source set)
#
# That the internal content dependencies must depend on the *_sources targets
# to avoid dependency cycles, and external dependencies must depend on the
# //content/public/browser and similar targets to avoid double-linking (these
# targets make sure the dependency goes through the content shared library
# when doing a component build).

if (!is_nacl_nonsfi) {
  content_shared_components = [
    "//content/gpu:gpu_sources",
    "//content/public/browser:browser_sources",
    "//content/public/child:child_sources",
    "//content/public/gpu:gpu_sources",
    "//content/public/common:common_sources",
    "//content/public/plugin:plugin_sources",
    "//content/public/renderer:renderer_sources",
    "//content/public/utility:utility_sources",
  ]

  if (enable_plugins) {
    content_shared_components +=
        [ "//content/ppapi_plugin:ppapi_plugin_sources" ]
  }
}

if (is_component_build) {
  component("content") {
    public_deps =
        content_shared_components + [ "//content/public/app:both_sources" ]
    deps = [
      "//build/config/sanitizers:deps",
    ]
  }
} else if (is_nacl_nonsfi) {
  source_set("content") {
    set_sources_assignment_filter([])
    sources = [
      "common/sandbox_linux/sandbox_init_linux.cc",
      "common/sandbox_linux/sandbox_seccomp_bpf_linux.cc",
      "common/send_zygote_child_ping_linux.cc",
      "public/common/content_switches.cc",
    ]
    set_sources_assignment_filter(sources_assignment_filter)

    defines = [ "USE_SECCOMP_BPF=1" ]

    deps = [
      "//base",
    ]
  }
} else {
  group("content") {
    public_deps = content_shared_components
  }
}

grit("resources") {
  source = "content_resources.grd"
  use_qualified_include = true
  outputs = [
    "grit/content_resources.h",
    "content_resources.pak",
  ]
}

# This target exists to "hold" the content_export header so we can do proper
# inclusion testing of it.
source_set("export") {
  visibility = [ "//content/*" ]
  sources = [
    "common/content_export.h",
  ]
}

# In the GYP build, this file is listed in several targets. In GN just have
# those targets depend on this one. This can be depended on for any
# platform for simplicity, and is a no-op on non-Windows.
source_set("sandbox_helper_win") {
  if (is_win) {
    sources = [
      "app/sandbox_helper_win.cc",
      "public/app/sandbox_helper_win.h",
    ]

    deps = [
      "//sandbox",
    ]
  }
}