Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / chrome / common / BUILD.gn
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 import("//tools/grit/grit_rule.gni")
6
7 gypi_values = exec_script(
8     "//build/gypi_to_gn.py",
9     [ rebase_path("../chrome_common.gypi") ],
10     "scope",
11     [ "../chrome_common.gypi" ])
12
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   ]
23 }
24
25 # GYP version: chrome/chrome_resources.gyp:chrome_resources
26 #              (generate_extensions_api_resources action)
27 grit("extensions_api_resources") {
28   source = "extensions_api_resources.grd"
29   output_dir = "$root_gen_dir/chrome"
30   outputs = [
31     "grit/extensions_api_resources.h",
32     "extensions_api_resources.pak",
33   ]
34 }
35
36 # GYP version: chrome/chrome_common.gyp:common
37 static_library("common") {
38   sources = rebase_path(gypi_values.chrome_common_sources, ".", "//chrome")
39   defines = []
40
41   configs += [ "//build/config/compiler:wexit_time_destructors" ]
42
43   deps = [
44     ":version",
45     "//base:base",
46     "//base:i18n",
47     "//base:prefs",
48     "//base:base_static",
49     "//chrome:resources",
50     "//chrome:strings",
51     "//chrome/app/theme:theme_resources",
52     "//chrome/common:constants",
53     "//chrome/common/net",
54     "//chrome/common/safe_browsing:proto",
55     "//chrome/installer/util",
56     "//components/cloud_devices/common",
57     "//components/content_settings/core/common",
58     "//components/json_schema",
59     "//components/metrics",
60     "//components/policy:policy_component_common",
61     "//components/translate/core/common",
62     "//components/variations",
63     "//content/public/common",
64     "//crypto",
65     "//media/cast:net",
66     "//net",
67     "//skia",
68     "//third_party/icu",
69     "//third_party/libxml",
70     "//third_party/sqlite",
71     "//third_party/zlib:zip",
72     "//ui/resources:resources",
73     "//url",
74   ]
75
76   if (is_ios) {
77     sources += [
78       # Use this Mac file that was filtered out.
79       "chrome_version_info_mac.mm",
80     ]
81   } else {
82     # Non-iOS.
83     deps += [
84       "//components/visitedlink/common",
85       "//components/autofill/content/common",
86       "//components/autofill/core/common",
87       "//components/password_manager/content/common",
88       "//components/password_manager/core/common",
89       "//components/signin/core/common",
90       "//components/translate/content/common",
91       "//ipc",
92       "//third_party/re2",
93       "//third_party/widevine/cdm:version_h",
94     ]
95   }
96
97   if (enable_extensions) {
98     sources += rebase_path(
99         gypi_values.chrome_common_extensions_sources,
100         ".", "//chrome")
101     deps += [
102       "//device/bluetooth",  # TODO(thestig) Still needed? Not in gyp version.
103       "//device/usb",
104       "//chrome/common/extensions/api",
105       "//extensions/common",
106       "//extensions/common/api",
107       "//extensions/strings",
108       "//extensions:extensions_resources",
109     ]
110   }
111
112   if (is_win || is_mac) {
113     sources += rebase_path(
114         gypi_values.chrome_common_win_mac_sources,
115         ".", "//chrome")
116     if (use_openssl) {
117       sources -= [
118         "extensions/api/networking_private/networking_private_crypto_nss.cc",
119       ]
120       # networking_private_crypto_openssl.cc depends on boringssl.
121       deps += [
122         "//third_party/boringssl",
123       ]
124     } else {
125       sources -= [
126         "extensions/api/networking_private/networking_private_crypto_openssl.cc",
127       ]
128     }
129     deps += [ "//breakpad:client" ]
130   }
131   if (is_mac) {
132     sources += rebase_path(
133         gypi_values.chrome_common_mac_sources,
134         ".", "//chrome")
135   }
136
137   if (enable_nacl) {
138     deps += [
139       #'<(DEPTH)/components/nacl.gyp:nacl_common',  TODO(GYP)
140     ]
141   }
142
143   # Printing.
144   if (printing_mode == 0) {
145     sources -= [
146       "print_messages.cc",
147       "print_messages.h",
148     ]
149   } else {
150     deps += [ "//printing" ]
151     if (printing_mode == 1) {
152       # Full printing support.
153       sources += rebase_path(
154           gypi_values.chrome_common_service_process_sources,
155           ".", "//chrome")
156     }
157   }
158
159   if (enable_service_discovery) {
160     sources += [
161       "local_discovery/service_discovery_client.cc",
162       "local_discovery/service_discovery_client.h",
163     ]
164   }
165   if (enable_mdns) {
166     sources += [
167       "local_discovery/service_discovery_client_impl.cc",
168       "local_discovery/service_discovery_client_impl.h",
169     ]
170   }
171
172   if (is_android) {
173     sources -= [
174       "badge_util.cc",
175       "chrome_version_info_posix.cc",
176       "extensions/manifest_handlers/minimum_chrome_version_checker.cc",
177       "icon_with_badge_image_source.cc",
178       "media_galleries/metadata_types.h",
179       "spellcheck_common.cc",
180     ]
181   } else {
182     # Non-Android.
183     sources += rebase_path(
184         gypi_values.chrome_common_importer_sources,
185         ".", "//chrome")
186   }
187
188   if (is_win) {
189     deps += [ "//third_party/wtl" ]
190   }
191
192   if (enable_mdns) {
193     sources += [ "local_discovery/local_discovery_messages.h" ]
194   }
195
196   if (is_mac) {
197     sources -= [
198       "chrome_version_info_posix.cc",
199     ]
200     deps += [
201       "//third_party/mach_override",
202       "//third_party/google_toolbox_for_mac",
203     ]
204   }
205
206   if (enable_remoting) {
207     deps += [ "//remoting/client/plugin" ]
208   }
209   if (enable_plugins) {
210     sources += [
211       "pepper_flash.cc",
212       "pepper_flash.h",
213       "pepper_permission_util.cc",
214       "pepper_permission_util.h",
215     ]
216     deps += [
217       "//third_party/adobe/flash:flapper_version_h",
218     ]
219   }
220   if (!enable_webrtc) {
221     sources -= [ "media/webrtc_logging_messages.h" ]
222   }
223   if (enable_configuration_policy) {
224     deps += [ "//components/policy" ]
225   }
226
227   if (safe_browsing_mode == 1) {
228     defines += [ "FULL_SAFE_BROWSING" ]
229     sources += rebase_path(
230         gypi_values.chrome_common_full_safe_browsing_sources,
231         ".", "//chrome")
232   }
233   if (safe_browsing_mode == 2) {
234     defines += [ "MOBILE_SAFE_BROWSING" ]
235   }
236 }
237
238 if (is_linux || is_android) {
239   # TODO(brettw) this duplicates "//chrome/common:version" which applies to
240   # Windows.
241   import("//chrome/version.gni")
242   process_version("version") {
243     visibility = [ ":common" ]
244     source = "chrome_version_info_posix.h.version"
245     output = "$target_gen_dir/chrome_version_info_posix.h"
246   }
247 } else {
248   # Other platforms have a different way to do versioning.
249   group("version") {
250   }
251 }
252
253 # GN version: chrome/common_constants.gyp:common_constants
254 static_library("constants") {
255   sources = [
256     "chrome_constants.cc",
257     "chrome_constants.h",
258     "chrome_icon_resources_win.cc",
259     "chrome_icon_resources_win.h",
260     "chrome_paths.cc",
261     "chrome_paths.h",
262     "chrome_paths_android.cc",
263     "chrome_paths_internal.h",
264     "chrome_paths_linux.cc",
265     "chrome_paths_mac.mm",
266     "chrome_paths_win.cc",
267     "chrome_switches.cc",
268     "chrome_switches.h",
269     "env_vars.cc",
270     "env_vars.h",
271     "net/test_server_locations.cc",
272     "net/test_server_locations.h",
273     "pref_font_script_names-inl.h",
274     "pref_font_webkit_names.h",
275     "pref_names.cc",
276     "pref_names.h",
277     "widevine_cdm_constants.cc",
278     "widevine_cdm_constants.h",
279   ]
280
281   deps = [
282     "//base",
283     "//base/third_party/dynamic_annotations",
284     "//components/bookmarks/common",
285     "//third_party/widevine/cdm:version_h",
286   ]
287
288   if (enable_nacl) {
289     deps += [
290       #'../components/nacl.gyp:nacl_switches',  TODO(GYP)
291     ]
292   }
293 }
294
295 source_set("test_support") {
296   testonly = true
297   visibility = [ "//chrome/test:test_support" ]
298
299   sources = [
300     "extensions/extension_test_util.cc",
301     "extensions/extension_test_util.h",
302   ]
303
304   deps = [
305     ":common",
306     "//base",
307     "//testing/gtest",
308   ]
309
310   if (is_win || is_mac) {
311     sources += [
312       "media_galleries/picasa_test_util.cc",
313       "media_galleries/picasa_test_util.h",
314       "media_galleries/pmp_test_util.cc",
315       "media_galleries/pmp_test_util.h",
316     ]
317   }
318
319 }