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
5# App different than the regular content subcomponents (see comments in
6# //content/BUILD.gn) because it has to support the browser/child process split
7# (the "both" target include both browser and child process files and is used
8# for testing).
9#
10# In non-component mode, browser, child, and both all follow the same structure:
11# foo ->
12#   //content/public/app:child (group) ->
13#     //content/public/app:child_sources (source set) ->
14#       //content/app:child (source set)
15
16# In component mode, content is linked as one big turd so there is only one
17# app target containing sources ("both") and the other ones forward to it:
18# foo ->
19#   //content/public/app:child (group; "browser" and "both" ones look the same)
20#     //content (shared library) ->
21#       //content/public/app:both_sources (source set)
22
23public_app_shared_sources = [
24  "android_library_loader_hooks.h",
25  "content_main.h",
26  "content_main_delegate.cc",
27  "content_main_delegate.h",
28  "content_main_runner.h",
29  "startup_helper_win.h",
30]
31
32public_app_shared_deps = [
33  "//base",
34  "//base:i18n",
35  "//content:export",
36  "//content/public/common:common_sources",
37]
38
39if (is_component_build) {
40
41  source_set("both_sources") {
42    # Only the main content shared library can pull this in.
43    visibility = [ "//content:content" ]
44
45    sources = public_app_shared_sources
46
47    configs += [ "//content:content_implementation" ]
48
49    deps = public_app_shared_deps + [
50      "//content/app:both",
51      "//content/public/browser:browser_sources",
52    ]
53  }
54
55  # These all just forward to content, which in turn depends on "both_sources".
56  group("browser") {
57    deps = [ "//content" ]
58  }
59  group("child") {
60    deps = [ "//content" ]
61  }
62  group("both") {
63    deps = [ "//content" ]
64  }
65
66} else {
67
68  # content_main_delegate.cc conditionally includes content_browser_client.h
69  # from //content/public/browser when it's not the child build. However,
70  # the header checker doesn't know this doesn't apply and throws an error.
71  # So all of these targets set check_includes = false.
72  #
73  # TODO(brettw) either teach the header checker to understand simple
74  # ifdefs or split the file apart so we can enable header checking here.
75  # Furthermore, since this file exists in more than one target, they all
76  # have to opt-out of header checking (a file is checked once for all
77  # targets using a source file).
78
79  source_set("both") {
80    check_includes = false  # See comment above.
81
82    sources = public_app_shared_sources
83    configs += [ "//content:content_implementation" ]
84    deps = public_app_shared_deps + [
85      "//content/app:both",
86      "//content/public/browser",
87      "//content/public/common",
88    ]
89  }
90
91  # TODO(GYP) enable chrome_multiple_dll support
92  is_chrome_multiple_dll = false
93
94  if (is_chrome_multiple_dll) {
95    source_set("browser") {
96      check_includes = false  # See comment above.
97
98      sources = public_app_shared_sources
99
100      defines = [ "CHROME_MULTIPLE_DLL_BROWSER" ]
101      configs += [ "//content:content_implementation" ]
102
103      deps = public_app_shared_deps + [
104        "//content/app:browser",
105        "//content/public/browser",
106        "//content/public/common",
107      ]
108    }
109
110    source_set("child") {
111      check_includes = false  # See comment above.
112
113      sources = public_app_shared_sources
114
115      defines = [ "CHROME_MULTIPLE_DLL_CHILD" ]
116      configs += [ "//content:content_implementation" ]
117
118      deps = public_app_shared_deps + [
119        "//content/app:child",
120        "//content/public/common",
121      ]
122    }
123  } else {
124    # When the multi-DLL build is disabled, there is only one type of the
125    # "app" target, and "browser" and "child" are the same as "both".
126    group("browser") {
127      deps = [ ":both" ]
128    }
129    group("child") {
130      deps = [ ":both" ]
131    }
132  }
133
134}
135