Add ENABLE_MEDIA_ROUTER define to builds other than Android and iOS.
[chromium-blink-merge.git] / chrome / common / BUILD.gn
blobb287530709ab7b80d327de21d20e2b9fbea99e2b
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")
7 gypi_values = exec_script("//build/gypi_to_gn.py",
8                           [ rebase_path("../chrome_common.gypi") ],
9                           "scope",
10                           [ "../chrome_common.gypi" ])
12 # GYP version: chrome/chrome_resources.gyp:chrome_resources
13 #              (generate_common_resources action)
14 grit("resources") {
15   source = "common_resources.grd"
16   output_dir = "$root_gen_dir/chrome"
17   output_name = "common_resources"
18   outputs = [
19     "grit/common_resources.h",
20     "common_resources.pak",
21   ]
24 # GYP version: chrome/chrome_resources.gyp:chrome_resources
25 #              (generate_extensions_api_resources action)
26 if (enable_extensions) {
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   }
37 # GYP version: chrome/chrome_common.gyp:common
38 static_library("common") {
39   sources = rebase_path(gypi_values.chrome_common_sources, ".", "//chrome")
40   defines = []
42   configs += [ "//build/config/compiler:wexit_time_destructors" ]
44   deps = [
45     ":version",
46     "//base:base",
47     "//base:i18n",
48     "//base:prefs",
49     "//base:base_static",
50     "//chrome:resources",
51     "//chrome:strings",
52     "//chrome/app/theme:theme_resources",
53     "//chrome/common:constants",
54     "//chrome/common/net",
55     "//chrome/common/safe_browsing:proto",
56     "//chrome/installer/util",
57     "//components/cloud_devices/common",
58     "//components/content_settings/core/common",
59     "//components/favicon_base",
60     "//components/json_schema",
61     "//components/metrics",
62     "//components/policy:policy_component_common",
63     "//components/translate/core/common",
64     "//components/variations",
65     "//content/public/common",
66     "//crypto",
67     "//extensions/common:common_constants",
68     "//net",
69     "//skia",
70     "//third_party/icu",
71     "//third_party/libxml",
72     "//third_party/sqlite",
73     "//third_party/zlib:zip",
74     "//ui/resources:resources",
75     "//url",
76   ]
78   if (is_ios) {
79     sources += [
80       # Use this Mac file that was filtered out.
81       "chrome_version_info_mac.mm",
82     ]
83   } else {
84     # Non-iOS.
85     deps += [
86       "//components/visitedlink/common",
87       "//components/autofill/content/common",
88       "//components/autofill/core/common",
89       "//components/password_manager/content/common",
90       "//components/password_manager/core/common",
91       "//components/signin/core/common",
92       "//components/translate/content/common",
93       "//ipc",
94       "//third_party/re2",
95       "//third_party/widevine/cdm:version_h",
96     ]
97   }
99   if (enable_extensions) {
100     sources += rebase_path(gypi_values.chrome_common_extensions_sources,
101                            ".",
102                            "//chrome")
103     deps += [
104       "//device/usb",
105       "//chrome/common/extensions/api",
106       "//extensions/common",
107       "//extensions/common/api",
108       "//extensions:extensions_resources",
109       "//extensions/strings",
110       "//media/cast:net",
111     ]
112   }
114   if (is_win || is_mac) {
115     sources +=
116         rebase_path(gypi_values.chrome_common_win_mac_sources, ".", "//chrome")
117     deps += [ "//breakpad:client" ]
118   }
119   if (is_win || is_mac || is_chromeos) {
120     if (use_openssl) {
121       sources += rebase_path(
122               gypi_values.chrome_common_networking_private_sources_openssl,
123               ".",
124               "//chrome")
126       # networking_private_crypto_openssl.cc depends on boringssl.
127       deps += [ "//third_party/boringssl" ]
128     } else {
129       sources +=
130           rebase_path(gypi_values.chrome_common_networking_private_sources_nss,
131                       ".",
132                       "//chrome")
133     }
134   }
135   if (is_mac) {
136     sources +=
137         rebase_path(gypi_values.chrome_common_mac_sources, ".", "//chrome")
138     deps += [ ":app_mode_app_support" ]
139   }
141   if (enable_nacl) {
142     deps += [ "//components/nacl:nacl_common" ]
143   }
145   # Printing.
146   if (enable_basic_printing || enable_print_preview) {
147     deps += [
148       "//components/printing/common:printing_common",
149       "//printing",
150     ]
151     if (enable_print_preview) {
152       # Full printing support.
153       sources += rebase_path(gypi_values.chrome_common_service_process_sources,
154                              ".",
155                              "//chrome")
156     }
157   }
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   }
172   if (is_android) {
173     sources -= [
174       "badge_util.cc",
175       "chrome_version_info_posix.cc",
176       "icon_with_badge_image_source.cc",
177       "media_galleries/metadata_types.h",
178       "spellcheck_common.cc",
179     ]
180   } else {
181     # Non-Android.
182     sources +=
183         rebase_path(gypi_values.chrome_common_importer_sources, ".", "//chrome")
184   }
186   if (is_chromeos) {
187     sources -= [ "chrome_version_info_posix.cc" ]
188   }
190   if (is_win) {
191     deps += [ "//third_party/wtl" ]
192   }
194   if (enable_mdns) {
195     sources += [ "local_discovery/local_discovery_messages.h" ]
196   }
198   if (is_mac) {
199     sources -= [ "chrome_version_info_posix.cc" ]
200     deps += [
201       "//third_party/mach_override",
202       "//third_party/google_toolbox_for_mac",
203     ]
204   }
206   if (enable_plugins) {
207     sources += [
208       "pepper_flash.cc",
209       "pepper_flash.h",
210       "ppapi_utils.cc",
211       "ppapi_utils.h",
212     ]
213     deps += [ "//third_party/adobe/flash:flapper_version_h" ]
214   }
215   if (enable_plugins && enable_extensions) {
216     sources += [
217       "pepper_permission_util.cc",
218       "pepper_permission_util.h",
219     ]
220   }
221   if (!enable_webrtc) {
222     sources -= [ "media/webrtc_logging_messages.h" ]
223   }
224   if (enable_configuration_policy) {
225     deps += [ "//components/policy" ]
226   }
228   if (safe_browsing_mode == 1) {
229     defines += [ "FULL_SAFE_BROWSING" ]
230     sources += rebase_path(gypi_values.chrome_common_full_safe_browsing_sources,
231                            ".",
232                            "//chrome")
233   }
234   if (safe_browsing_mode == 2) {
235     defines += [ "MOBILE_SAFE_BROWSING" ]
236   }
239 import("//chrome/version.gni")
240 process_version("version") {
241   visibility = [ ":common" ]
242   template_file = "chrome_version_info_values.h.version"
243   output = "$target_gen_dir/chrome_version_info_values.h"
246 process_version("make_chrome_version") {
247   template_file = "chrome_version.cc.version"
248   output = "$target_gen_dir/chrome_version.cc"
251 # GN version: chrome/common_constants.gyp:common_constants
252 static_library("constants") {
253   sources = [
254     "chrome_constants.cc",
255     "chrome_constants.h",
256     "chrome_icon_resources_win.cc",
257     "chrome_icon_resources_win.h",
258     "chrome_paths.cc",
259     "chrome_paths.h",
260     "chrome_paths_android.cc",
261     "chrome_paths_internal.h",
262     "chrome_paths_linux.cc",
263     "chrome_paths_mac.mm",
264     "chrome_paths_win.cc",
265     "chrome_switches.cc",
266     "chrome_switches.h",
267     "env_vars.cc",
268     "env_vars.h",
269     "net/test_server_locations.cc",
270     "net/test_server_locations.h",
271     "pref_font_script_names-inl.h",
272     "pref_font_webkit_names.h",
273     "pref_names.cc",
274     "pref_names.h",
275     "widevine_cdm_constants.cc",
276     "widevine_cdm_constants.h",
277   ]
278   sources += get_target_outputs(":make_chrome_version")
280   deps = [
281     ":make_chrome_version",
282     "//base",
283     "//base/third_party/dynamic_annotations",
284     "//components/bookmarks/common",
285     "//third_party/widevine/cdm:version_h",
286   ]
288   if (enable_nacl) {
289     deps += [ "//components/nacl:nacl_switches" ]
290   }
293 source_set("test_support") {
294   testonly = true
295   visibility = [ "//chrome/test:test_support" ]
297   sources = []
299   deps = [
300     ":common",
301     "//base",
302     "//testing/gtest",
303   ]
305   if (is_win || is_mac) {
306     sources += [
307       "media_galleries/picasa_test_util.cc",
308       "media_galleries/picasa_test_util.h",
309       "media_galleries/pmp_test_util.cc",
310       "media_galleries/pmp_test_util.h",
311     ]
312   }
314   configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
316   if (enable_extensions) {
317     sources += [
318       "extensions/extension_test_util.cc",
319       "extensions/extension_test_util.h",
320     ]
321   }
324 # GN version: chrome/chrome.gyp:app_mode_app_support
325 static_library("app_mode_app_support") {
326   sources = [
327     "mac/app_mode_chrome_locator.h",
328     "mac/app_mode_chrome_locator.mm",
329     "mac/app_mode_common.h",
330     "mac/app_mode_common.mm",
331   ]
333   deps = [
334     ":constants",
335     "//base",
336   ]