OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import("//build/config/chrome_build.gni") | 5 import("//build/config/chrome_build.gni") |
6 import("//build/config/features.gni") | 6 import("//build/config/features.gni") |
7 | 7 |
8 content_app_sources = [ | 8 # Implements "content_main" given the defines and visibility. On Windows this |
9 "android/app_jni_registrar.cc", | 9 # is compiled with a different define for browser and child, but all code needs |
10 "android/app_jni_registrar.h", | 10 # to be shared. |
11 "android/child_process_service_impl.cc", | 11 template("implement_content_app") { |
12 "android/child_process_service_impl.h", | 12 runner_target_name = "content_main_runner_" + target_name |
13 "android/content_jni_onload.cc", | 13 main_target_name = target_name |
14 "android/content_main.cc", | |
15 "android/content_main.h", | |
16 "android/download_main.cc", | |
17 "android/library_loader_hooks.cc", | |
18 "android/library_loader_hooks.h", | |
19 "content_main.cc", | |
20 "content_main_runner.cc", | |
21 "mac/mac_init.mm", | |
22 "mac/mac_init.h", | |
23 "mojo/mojo_init.cc", | |
24 "mojo/mojo_init.h", | |
25 ] | |
26 | 14 |
27 content_app_deps = [ | 15 extra_configs = [ |
28 "//base", | 16 "//build/config/compiler:wexit_time_destructors", |
29 "//base:i18n", | 17 "//content:content_implementation", |
30 "//content:export", | 18 "//content/public/common:mojo_shell_client", |
31 "//content:sandbox_helper_win", | 19 "//v8:external_startup_data", |
32 "//content/public/common:common_sources", | 20 ] |
33 "//crypto", | |
34 "//services/shell/public/interfaces", | |
35 "//mojo/edk/system", | |
36 "//third_party/WebKit/public:mojo_bindings", | |
37 "//ui/base", | |
38 "//ui/gfx", | |
39 "//ui/gfx/geometry", | |
40 ] | |
41 | 21 |
42 if (is_win) { | 22 content_app_deps = [ |
43 content_app_deps += [ "//sandbox" ] | 23 "//base", |
44 } else if (is_android) { | 24 "//base:i18n", |
45 content_app_sources -= [ "content_main.cc" ] | 25 "//components/tracing:startup_tracing", |
46 content_app_deps += [ | 26 "//content:export", |
47 "//content/public/android:jni", | 27 "//content:sandbox_helper_win", |
48 "//device/usb", | 28 "//content/public/common:common_sources", |
49 "//device/vibration", | 29 "//crypto", |
50 "//skia", | 30 "//services/shell/public/interfaces", |
51 "//third_party/android_tools:cpu_features", | 31 "//mojo/edk/system", |
52 "//ui/android", | 32 "//third_party/WebKit/public:mojo_bindings", |
| 33 "//ui/base", |
| 34 "//ui/gfx", |
| 35 "//ui/gfx/geometry", |
53 ] | 36 ] |
54 } | |
55 | 37 |
56 if (is_linux && enable_plugins) { | 38 if (is_win) { |
57 content_app_deps += [ "//content/ppapi_plugin:ppapi_plugin_sources" ] | 39 content_app_deps += [ "//sandbox" ] |
58 } | 40 } else if (is_android) { |
| 41 # Android doesn't use the browser/child split and in the component build |
| 42 # all symbols are exported from the .so, so the Android-specific files |
| 43 # can include headers from both places. Many of these are required for |
| 44 # JNI registration. |
| 45 content_app_deps += [ |
| 46 "//content/browser", |
| 47 "//content/child", |
| 48 "//content/public/android:jni", |
| 49 "//content/browser", |
| 50 "//content/child", |
| 51 "//device/bluetooth", |
| 52 "//device/power_save_blocker", |
| 53 "//device/usb", |
| 54 "//device/vibration", |
| 55 "//gpu", |
| 56 "//media", |
| 57 "//media/capture", |
| 58 "//media/midi", |
| 59 "//net", |
| 60 "//skia", |
| 61 "//third_party/android_tools:cpu_features", |
| 62 "//ui/android", |
| 63 "//ui/events", |
| 64 "//ui/shell_dialogs", |
| 65 ] |
| 66 } |
59 | 67 |
60 content_app_extra_configs = [ | 68 if (is_linux && enable_plugins) { |
61 "//build/config/compiler:wexit_time_destructors", | 69 content_app_deps += [ "//content/ppapi_plugin:ppapi_plugin_sources" ] |
62 "//content:content_implementation", | 70 } |
63 "//content/public/common:mojo_shell_client", | |
64 "//v8:external_startup_data", | |
65 ] | |
66 | 71 |
67 if (!is_multi_dll_chrome) { | 72 if (!is_multi_dll_chrome) { |
68 content_app_deps += [ "//content/gpu:gpu_sources" ] | 73 content_app_deps += [ "//content/gpu:gpu_sources" ] |
| 74 } |
| 75 |
| 76 # Compile content_main_runner.cc in a separate target to exempt from GN |
| 77 # header checking without exempting any other source file. This file includes |
| 78 # headers of all process types and varies significantly per platform in |
| 79 # between browser and child. Otherwise it would require many "nogncheck" |
| 80 # annotations that would both be useless and add noise. |
| 81 # |
| 82 # This will generate :content_main_runner_both, :content_main_runner_browser, |
| 83 # and :content_main_runner_child. |
| 84 source_set(runner_target_name) { |
| 85 visibility = [ ":$main_target_name" ] |
| 86 check_includes = false |
| 87 |
| 88 sources = [ |
| 89 "content_main_runner.cc", |
| 90 ] |
| 91 |
| 92 configs += extra_configs |
| 93 deps = content_app_deps |
| 94 |
| 95 forward_variables_from(invoker, [ "defines" ]) |
| 96 } |
| 97 |
| 98 source_set(main_target_name) { |
| 99 sources = [ |
| 100 "mac/mac_init.h", |
| 101 "mac/mac_init.mm", |
| 102 "mojo/mojo_init.cc", |
| 103 "mojo/mojo_init.h", |
| 104 ] |
| 105 |
| 106 if (is_android) { |
| 107 sources += [ |
| 108 "android/app_jni_registrar.cc", |
| 109 "android/app_jni_registrar.h", |
| 110 "android/child_process_service_impl.cc", |
| 111 "android/child_process_service_impl.h", |
| 112 "android/content_jni_onload.cc", |
| 113 "android/content_main.cc", |
| 114 "android/content_main.h", |
| 115 "android/download_main.cc", |
| 116 "android/library_loader_hooks.cc", |
| 117 "android/library_loader_hooks.h", |
| 118 ] |
| 119 } else { |
| 120 sources += [ "content_main.cc" ] |
| 121 } |
| 122 |
| 123 configs += extra_configs |
| 124 deps = content_app_deps + [ ":$runner_target_name" ] |
| 125 forward_variables_from(invoker, |
| 126 [ |
| 127 "defines", |
| 128 "visibility", |
| 129 ]) |
| 130 } |
69 } | 131 } |
70 | 132 |
71 # This includes the app sources for both the browser and child processes. | 133 # This includes the app sources for both the browser and child processes. |
72 source_set("both") { | 134 implement_content_app("both") { |
73 # Only the public target should depend on this. All other targets (even | 135 # Only the public target should depend on this. All other targets (even |
74 # internal content ones) should depend on the public one. | 136 # internal content ones) should depend on the public one. |
75 visibility = [ | 137 visibility = [ |
76 ":both_for_content_tests", # See top of //content/BUILD.gn for why. | 138 ":both_for_content_tests", # See top of //content/BUILD.gn for why. |
77 "//content/public/app:*", | 139 "//content/public/app:*", |
78 ] | 140 ] |
79 | |
80 sources = content_app_sources | |
81 configs += content_app_extra_configs | |
82 deps = content_app_deps | |
83 } | 141 } |
84 | 142 |
85 # See comment at the top of //content/BUILD.gn for how this works. | 143 # See comment at the top of //content/BUILD.gn for how this works. |
86 group("both_for_content_tests") { | 144 group("both_for_content_tests") { |
87 visibility = [ "//content/test/*" ] | 145 visibility = [ "//content/test/*" ] |
88 if (!is_component_build) { | 146 if (!is_component_build) { |
89 public_deps = [ | 147 public_deps = [ |
90 ":both", | 148 ":both", |
91 ] | 149 ] |
92 } | 150 } |
93 } | 151 } |
94 | 152 |
95 if (is_multi_dll_chrome) { | 153 if (is_multi_dll_chrome) { |
96 # It doesn't make sense to do the browser/child dll split in component mode. | 154 # It doesn't make sense to do the browser/child dll split in component mode. |
97 assert(!is_component_build) | 155 assert(!is_component_build) |
98 | 156 |
99 source_set("browser") { | 157 implement_content_app("browser") { |
100 visibility = [ "//content/public/app:browser" ] | 158 visibility = [ "//content/public/app:browser" ] |
101 | |
102 sources = content_app_sources | |
103 configs += content_app_extra_configs | |
104 deps = content_app_deps | |
105 | |
106 defines = [ "CHROME_MULTIPLE_DLL_BROWSER" ] | 159 defines = [ "CHROME_MULTIPLE_DLL_BROWSER" ] |
107 } | 160 } |
108 | 161 |
109 source_set("child") { | 162 implement_content_app("child") { |
110 visibility = [ "//content/public/app:child" ] | 163 visibility = [ "//content/public/app:child" ] |
111 | |
112 sources = content_app_sources | |
113 configs += content_app_extra_configs | |
114 deps = content_app_deps | |
115 | |
116 defines = [ "CHROME_MULTIPLE_DLL_CHILD" ] | 164 defines = [ "CHROME_MULTIPLE_DLL_CHILD" ] |
117 } | 165 } |
118 } | 166 } |
OLD | NEW |