Add ICU message format support
[chromium-blink-merge.git] / chrome / common / BUILD.gn
blob382bd643d049da04bd8dd1b63e39c3322177abd7
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")
7 import("//chrome/version.gni")
9 gypi_values = exec_script("//build/gypi_to_gn.py",
10                           [ rebase_path("../chrome_common.gypi") ],
11                           "scope",
12                           [ "../chrome_common.gypi" ])
14 # GYP version: chrome/chrome_resources.gyp:chrome_resources
15 #              (generate_common_resources action)
16 grit("resources") {
17   source = "common_resources.grd"
18   output_dir = "$root_gen_dir/chrome"
19   output_name = "common_resources"
20   outputs = [
21     "grit/common_resources.h",
22     "common_resources.pak",
23   ]
26 # GYP version: chrome/chrome_resources.gyp:chrome_resources
27 #              (generate_extensions_api_resources action)
28 if (enable_extensions) {
29   grit("extensions_api_resources") {
30     source = "extensions_api_resources.grd"
31     output_dir = "$root_gen_dir/chrome"
32     outputs = [
33       "grit/extensions_api_resources.h",
34       "extensions_api_resources.pak",
35     ]
36   }
39 # GYP version: chrome/chrome_common.gyp:common
40 static_library("common") {
41   sources = rebase_path(gypi_values.chrome_common_sources, ".", "//chrome")
42   defines = []
44   configs += [
45     "//build/config:precompiled_headers",
46     "//build/config/compiler:wexit_time_destructors",
47   ]
49   public_deps = [
50     "//chrome/common:constants",
51     "//chrome/common/net",
52     "//chrome/common/safe_browsing:proto",
53   ]
54   deps = [
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     "//components/version_info",
76     "//content/public/common",
77     "//crypto",
78     "//extensions/common:common_constants",
79     "//net",
80     "//skia",
81     "//third_party/icu",
82     "//third_party/zlib:zip",
83     "//ui/resources:resources",
84     "//url",
85   ]
87   if (is_ios) {
88     sources += [
89       # Use this Mac file that was filtered out.
90       "channel_info_mac.mm",
91     ]
92     sources -= [
93       "resource_usage_reporter_type_converters.cc",
94       "resource_usage_reporter_type_converters.h",
95     ]
96   } else {
97     # Non-iOS.
98     deps += [
99       ":mojo_bindings",
100       "//components/visitedlink/common",
101       "//components/autofill/content/common",
102       "//components/autofill/core/common",
103       "//components/password_manager/content/common",
104       "//components/password_manager/core/common",
105       "//components/signin/core/common",
106       "//components/translate/content/common",
107       "//ipc",
108       "//third_party/re2",
109       "//third_party/widevine/cdm:version_h",
110     ]
111     public_deps += [ "//third_party/mojo/src/mojo/public/cpp/bindings" ]
112   }
114   if (enable_extensions) {
115     sources += rebase_path(gypi_values.chrome_common_extensions_sources,
116                            ".",
117                            "//chrome")
118     deps += [
119       "//device/usb",
120       "//chrome/common/extensions/api",
121       "//extensions/common",
122       "//extensions/common/api",
123       "//extensions:extensions_resources",
124       "//extensions/strings",
125       "//media/cast:net",
126     ]
127     if (is_chromeos) {
128       sources +=
129           rebase_path(gypi_values.chrome_common_extensions_chromeos_sources,
130                       ".",
131                       "//chrome")
132     }
133   }
135   if (is_win || is_mac) {
136     sources +=
137         rebase_path(gypi_values.chrome_common_win_mac_sources, ".", "//chrome")
138     deps += [ "//breakpad:client" ]
139   }
140   if (is_win || is_mac || is_chromeos) {
141     if (use_openssl) {
142       sources += rebase_path(
143               gypi_values.chrome_common_networking_private_sources_openssl,
144               ".",
145               "//chrome")
147       # networking_private_crypto_openssl.cc depends on boringssl.
148       deps += [ "//third_party/boringssl" ]
149     } else {
150       sources +=
151           rebase_path(gypi_values.chrome_common_networking_private_sources_nss,
152                       ".",
153                       "//chrome")
154     }
155   }
156   if (is_mac) {
157     sources +=
158         rebase_path(gypi_values.chrome_common_mac_sources, ".", "//chrome")
159     deps += [ ":app_mode_app_support" ]
160   }
162   if (enable_nacl) {
163     deps += [ "//components/nacl:nacl_common" ]
164   }
166   # Printing.
167   if (enable_basic_printing || enable_print_preview) {
168     deps += [
169       "//components/printing/common:printing_common",
170       "//printing",
171     ]
172     if (enable_print_preview) {
173       # Full printing support.
174       sources += rebase_path(gypi_values.chrome_common_service_process_sources,
175                              ".",
176                              "//chrome")
177     }
178   }
180   if (enable_service_discovery) {
181     sources += [
182       "local_discovery/service_discovery_client.cc",
183       "local_discovery/service_discovery_client.h",
184     ]
185   }
186   if (enable_mdns) {
187     sources += [
188       "local_discovery/service_discovery_client_impl.cc",
189       "local_discovery/service_discovery_client_impl.h",
190     ]
191   }
193   if (is_android) {
194     sources -= [
195       "badge_util.cc",
196       "channel_info_posix.cc",
197       "icon_with_badge_image_source.cc",
198       "media_galleries/metadata_types.h",
199     ]
200   } else {
201     # Non-Android.
202     sources +=
203         rebase_path(gypi_values.chrome_common_importer_sources, ".", "//chrome")
204   }
206   if (is_chromeos) {
207     sources -= [ "channel_info_posix.cc" ]
208   }
210   if (is_win) {
211     deps += [
212       "//components/dom_distiller/core",  # Needed by chrome_content_client.cc.
213       "//third_party/wtl",
214     ]
215   }
217   if (enable_mdns) {
218     sources += [ "local_discovery/local_discovery_messages.h" ]
219   }
221   if (is_mac) {
222     sources -= [ "channel_info_posix.cc" ]
223     deps += [
224       "//third_party/mach_override",
225       "//third_party/google_toolbox_for_mac",
226     ]
227   }
229   if (enable_plugins) {
230     sources += [
231       "pepper_flash.cc",
232       "pepper_flash.h",
233       "ppapi_utils.cc",
234       "ppapi_utils.h",
235     ]
236     deps += [ "//third_party/adobe/flash:flapper_version_h" ]
237   }
238   if (enable_plugins && enable_extensions) {
239     sources += [
240       "pepper_permission_util.cc",
241       "pepper_permission_util.h",
242     ]
243   }
244   if (!enable_webrtc) {
245     sources -= [ "media/webrtc_logging_messages.h" ]
246   }
247   if (enable_configuration_policy) {
248     deps += [ "//components/policy" ]
249   }
251   if (safe_browsing_mode == 1) {
252     sources += rebase_path(gypi_values.chrome_common_full_safe_browsing_sources,
253                            ".",
254                            "//chrome")
255   }
258 # This target allows other targets to depend on result_codes.h which is a
259 # header-only dependency, without bringing in all of content.
260 source_set("result_codes") {
261   sources = [
262     "chrome_result_codes.h",
263   ]
266 process_version("make_chrome_version") {
267   template_file = "chrome_version.cc.version"
268   output = "$target_gen_dir/chrome_version.cc"
271 # GN version: chrome/common_constants.gyp:common_constants
272 static_library("constants") {
273   sources = [
274     "chrome_constants.cc",
275     "chrome_constants.h",
276     "chrome_icon_resources_win.cc",
277     "chrome_icon_resources_win.h",
278     "chrome_paths.cc",
279     "chrome_paths.h",
280     "chrome_paths_android.cc",
281     "chrome_paths_internal.h",
282     "chrome_paths_linux.cc",
283     "chrome_paths_mac.mm",
284     "chrome_paths_win.cc",
285     "chrome_switches.cc",
286     "chrome_switches.h",
287     "env_vars.cc",
288     "env_vars.h",
289     "net/test_server_locations.cc",
290     "net/test_server_locations.h",
291     "pref_font_script_names-inl.h",
292     "pref_font_webkit_names.h",
293     "pref_names.cc",
294     "pref_names.h",
295     "widevine_cdm_constants.cc",
296     "widevine_cdm_constants.h",
297   ]
299   deps = [
300     ":make_chrome_version",
301     "//base",
302     "//base/third_party/dynamic_annotations",
303     "//components/bookmarks/common",
304     "//third_party/widevine/cdm:version_h",
305   ]
307   if (enable_nacl) {
308     deps += [ "//components/nacl:nacl_switches" ]
309   }
312 source_set("test_support") {
313   testonly = true
314   visibility = [ "//chrome/test:test_support" ]
316   sources = []
318   deps = [
319     ":common",
320     "//base",
321     "//testing/gtest",
322   ]
324   if (is_win || is_mac) {
325     sources += [
326       "media_galleries/picasa_test_util.cc",
327       "media_galleries/picasa_test_util.h",
328       "media_galleries/pmp_test_util.cc",
329       "media_galleries/pmp_test_util.h",
330     ]
331   }
333   configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
335   if (enable_extensions) {
336     sources += [
337       "extensions/extension_test_util.cc",
338       "extensions/extension_test_util.h",
339     ]
340   }
343 # GN version: chrome/chrome.gyp:app_mode_app_support
344 static_library("app_mode_app_support") {
345   sources = [
346     "mac/app_mode_chrome_locator.h",
347     "mac/app_mode_chrome_locator.mm",
348     "mac/app_mode_common.h",
349     "mac/app_mode_common.mm",
350   ]
352   deps = [
353     ":constants",
354     "//base",
355   ]
358 mojom("mojo_bindings") {
359   sources = [
360     "resource_usage_reporter.mojom",
361   ]