One-time migration of NPAPI Flash to PPAPI Flash.
[chromium-blink-merge.git] / chrome / common / BUILD.gn
blob21ab88e05e8ebbaa9554d545aaf77b3e15b44339
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.
5 import("//tools/grit/grit_rule.gni")
6 import("//third_party/mojo/src/mojo/public/tools/bindings/mojom.gni")
8 gypi_values = exec_script("//build/gypi_to_gn.py",
9                           [ rebase_path("../chrome_common.gypi") ],
10                           "scope",
11                           [ "../chrome_common.gypi" ])
13 # GYP version: chrome/chrome_resources.gyp:chrome_resources
14 #              (generate_common_resources action)
15 grit("resources") {
16   source = "common_resources.grd"
17   output_dir = "$root_gen_dir/chrome"
18   output_name = "common_resources"
19   outputs = [
20     "grit/common_resources.h",
21     "common_resources.pak",
22   ]
25 # GYP version: chrome/chrome_resources.gyp:chrome_resources
26 #              (generate_extensions_api_resources action)
27 if (enable_extensions) {
28   grit("extensions_api_resources") {
29     source = "extensions_api_resources.grd"
30     output_dir = "$root_gen_dir/chrome"
31     outputs = [
32       "grit/extensions_api_resources.h",
33       "extensions_api_resources.pak",
34     ]
35   }
38 # GYP version: chrome/chrome_common.gyp:common
39 static_library("common") {
40   sources = rebase_path(gypi_values.chrome_common_sources, ".", "//chrome")
41   defines = []
43   configs += [
44     "//build/config:precompiled_headers",
45     "//build/config/compiler:wexit_time_destructors",
46   ]
48   public_deps = [
49     "//chrome/common:constants",
50     "//chrome/common/net",
51     "//chrome/common/safe_browsing:proto",
52   ]
53   deps = [
54     ":version",
55     "//base:base",
56     "//base:i18n",
57     "//base:prefs",
58     "//base:base_static",
59     "//chrome:resources",
60     "//chrome:strings",
61     "//chrome/app/theme:theme_resources",
62     "//chrome/common/variations:fieldtrial_testing_config",
63     "//chrome/installer/util",
64     "//components/cloud_devices/common",
65     "//components/component_updater",
66     "//components/content_settings/core/common",
67     "//components/favicon_base",
68     "//components/gcm_driver/common",
69     "//components/json_schema",
70     "//components/metrics",
71     "//components/omnibox/common",
72     "//components/policy:policy_component_common",
73     "//components/translate/core/common",
74     "//components/variations",
75     "//content/public/common",
76     "//crypto",
77     "//extensions/common:common_constants",
78     "//net",
79     "//skia",
80     "//third_party/icu",
81     "//third_party/zlib:zip",
82     "//ui/resources:resources",
83     "//url",
84   ]
86   if (is_ios) {
87     sources += [
88       # Use this Mac file that was filtered out.
89       "chrome_version_info_mac.mm",
90     ]
91     sources -= [
92       "resource_usage_reporter_type_converters.cc",
93       "resource_usage_reporter_type_converters.h",
94     ]
95   } else {
96     # Non-iOS.
97     deps += [
98       ":mojo_bindings",
99       "//components/visitedlink/common",
100       "//components/autofill/content/common",
101       "//components/autofill/core/common",
102       "//components/password_manager/content/common",
103       "//components/password_manager/core/common",
104       "//components/signin/core/common",
105       "//components/translate/content/common",
106       "//ipc",
107       "//third_party/re2",
108       "//third_party/widevine/cdm:version_h",
109     ]
110     public_deps += [ "//third_party/mojo/src/mojo/public/cpp/bindings" ]
111   }
113   if (enable_extensions) {
114     sources += rebase_path(gypi_values.chrome_common_extensions_sources,
115                            ".",
116                            "//chrome")
117     deps += [
118       "//device/usb",
119       "//chrome/common/extensions/api",
120       "//extensions/common",
121       "//extensions/common/api",
122       "//extensions:extensions_resources",
123       "//extensions/strings",
124       "//media/cast:net",
125     ]
126     if (is_chromeos) {
127       sources +=
128           rebase_path(gypi_values.chrome_common_extensions_chromeos_sources,
129                       ".",
130                       "//chrome")
131     }
132   }
134   if (is_win || is_mac) {
135     sources +=
136         rebase_path(gypi_values.chrome_common_win_mac_sources, ".", "//chrome")
137     deps += [ "//breakpad:client" ]
138   }
139   if (is_win || is_mac || is_chromeos) {
140     if (use_openssl) {
141       sources += rebase_path(
142               gypi_values.chrome_common_networking_private_sources_openssl,
143               ".",
144               "//chrome")
146       # networking_private_crypto_openssl.cc depends on boringssl.
147       deps += [ "//third_party/boringssl" ]
148     } else {
149       sources +=
150           rebase_path(gypi_values.chrome_common_networking_private_sources_nss,
151                       ".",
152                       "//chrome")
153     }
154   }
155   if (is_mac) {
156     sources +=
157         rebase_path(gypi_values.chrome_common_mac_sources, ".", "//chrome")
158     deps += [ ":app_mode_app_support" ]
159   }
161   if (enable_nacl) {
162     deps += [ "//components/nacl:nacl_common" ]
163   }
165   # Printing.
166   if (enable_basic_printing || enable_print_preview) {
167     deps += [
168       "//components/printing/common:printing_common",
169       "//printing",
170     ]
171     if (enable_print_preview) {
172       # Full printing support.
173       sources += rebase_path(gypi_values.chrome_common_service_process_sources,
174                              ".",
175                              "//chrome")
176     }
177   }
179   if (enable_service_discovery) {
180     sources += [
181       "local_discovery/service_discovery_client.cc",
182       "local_discovery/service_discovery_client.h",
183     ]
184   }
185   if (enable_mdns) {
186     sources += [
187       "local_discovery/service_discovery_client_impl.cc",
188       "local_discovery/service_discovery_client_impl.h",
189     ]
190   }
192   if (is_android) {
193     sources -= [
194       "badge_util.cc",
195       "chrome_version_info_posix.cc",
196       "icon_with_badge_image_source.cc",
197       "media_galleries/metadata_types.h",
198     ]
199   } else {
200     # Non-Android.
201     sources +=
202         rebase_path(gypi_values.chrome_common_importer_sources, ".", "//chrome")
203   }
205   if (is_chromeos) {
206     sources -= [ "chrome_version_info_posix.cc" ]
207   }
209   if (is_win) {
210     deps += [
211       "//components/dom_distiller/core",  # Needed by chrome_content_client.cc.
212       "//third_party/wtl",
213     ]
214   }
216   if (enable_mdns) {
217     sources += [ "local_discovery/local_discovery_messages.h" ]
218   }
220   if (is_mac) {
221     sources -= [ "chrome_version_info_posix.cc" ]
222     deps += [
223       "//third_party/mach_override",
224       "//third_party/google_toolbox_for_mac",
225     ]
226   }
228   if (enable_plugins) {
229     sources += [
230       "pepper_flash.cc",
231       "pepper_flash.h",
232       "ppapi_utils.cc",
233       "ppapi_utils.h",
234     ]
235     deps += [ "//third_party/adobe/flash:flapper_version_h" ]
236   }
237   if (enable_plugins && enable_extensions) {
238     sources += [
239       "pepper_permission_util.cc",
240       "pepper_permission_util.h",
241     ]
242   }
243   if (!enable_webrtc) {
244     sources -= [ "media/webrtc_logging_messages.h" ]
245   }
246   if (enable_configuration_policy) {
247     deps += [ "//components/policy" ]
248   }
250   if (safe_browsing_mode == 1) {
251     sources += rebase_path(gypi_values.chrome_common_full_safe_browsing_sources,
252                            ".",
253                            "//chrome")
254   }
257 # This target allows other targets to depend on result_codes.h which is a
258 # header-only dependency, without bringing in all of content.
259 source_set("result_codes") {
260   sources = [
261     "chrome_result_codes.h",
262   ]
265 import("//chrome/version.gni")
266 process_version("version") {
267   visibility = [ ":common" ]
268   template_file = "chrome_version_info_values.h.version"
269   output = "$target_gen_dir/chrome_version_info_values.h"
272 process_version("make_chrome_version") {
273   template_file = "chrome_version.cc.version"
274   output = "$target_gen_dir/chrome_version.cc"
277 # GN version: chrome/common_constants.gyp:common_constants
278 static_library("constants") {
279   sources = [
280     "chrome_constants.cc",
281     "chrome_constants.h",
282     "chrome_icon_resources_win.cc",
283     "chrome_icon_resources_win.h",
284     "chrome_paths.cc",
285     "chrome_paths.h",
286     "chrome_paths_android.cc",
287     "chrome_paths_internal.h",
288     "chrome_paths_linux.cc",
289     "chrome_paths_mac.mm",
290     "chrome_paths_win.cc",
291     "chrome_switches.cc",
292     "chrome_switches.h",
293     "env_vars.cc",
294     "env_vars.h",
295     "net/test_server_locations.cc",
296     "net/test_server_locations.h",
297     "pref_font_script_names-inl.h",
298     "pref_font_webkit_names.h",
299     "pref_names.cc",
300     "pref_names.h",
301     "widevine_cdm_constants.cc",
302     "widevine_cdm_constants.h",
303   ]
305   deps = [
306     ":make_chrome_version",
307     "//base",
308     "//base/third_party/dynamic_annotations",
309     "//components/bookmarks/common",
310     "//third_party/widevine/cdm:version_h",
311   ]
313   if (enable_nacl) {
314     deps += [ "//components/nacl:nacl_switches" ]
315   }
318 source_set("test_support") {
319   testonly = true
320   visibility = [ "//chrome/test:test_support" ]
322   sources = []
324   deps = [
325     ":common",
326     "//base",
327     "//testing/gtest",
328   ]
330   if (is_win || is_mac) {
331     sources += [
332       "media_galleries/picasa_test_util.cc",
333       "media_galleries/picasa_test_util.h",
334       "media_galleries/pmp_test_util.cc",
335       "media_galleries/pmp_test_util.h",
336     ]
337   }
339   configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
341   if (enable_extensions) {
342     sources += [
343       "extensions/extension_test_util.cc",
344       "extensions/extension_test_util.h",
345     ]
346   }
349 # GN version: chrome/chrome.gyp:app_mode_app_support
350 static_library("app_mode_app_support") {
351   sources = [
352     "mac/app_mode_chrome_locator.h",
353     "mac/app_mode_chrome_locator.mm",
354     "mac/app_mode_common.h",
355     "mac/app_mode_common.mm",
356   ]
358   deps = [
359     ":constants",
360     "//base",
361   ]
364 mojom("mojo_bindings") {
365   sources = [
366     "resource_usage_reporter.mojom",
367   ]