Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / content / common / BUILD.gn
blobaec360704187d62d045d582b86cd998a775a8904
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("//build/config/features.gni")
6 import("//build/config/ui.gni")
7 import("//content/common/common.gni")
8 import("//third_party/mojo/src/mojo/public/tools/bindings/mojom.gni")
10 if (is_chromeos && current_cpu != "arm") {
11   action("libva_generate_stubs") {
12     extra_header = "gpu/media/va_stub_header.fragment"
14     script = "../../tools/generate_stubs/generate_stubs.py"
15     sources = [
16       "gpu/media/va.sigs",
17     ]
18     inputs = [
19       extra_header,
20     ]
21     if (use_x11) {
22       sources += [ "gpu/media/va_x11.sigs" ]
23     }
24     if (use_ozone) {
25       sources += [ "gpu/media/va_drm.sigs" ]
26     }
27     stubs_filename_root = "va_stubs"
29     outputs = [
30       "$target_gen_dir/gpu/media/$stubs_filename_root.cc",
31       "$target_gen_dir/gpu/media/$stubs_filename_root.h",
32     ]
33     args = [
34       "-i",
35       rebase_path("$target_gen_dir/gpu/media", root_build_dir),
36       "-o",
37       rebase_path("$target_gen_dir/gpu/media", root_build_dir),
38       "-t",
39       "posix_stubs",
40       "-e",
41       rebase_path(extra_header, root_build_dir),
42       "-s",
43       stubs_filename_root,
44       "-p",
45       "content/common/gpu/media",
46     ]
48     args += rebase_path(sources, root_build_dir)
49   }
52 if (is_chromeos && use_v4lplugin) {
53   action("libv4l2_generate_stubs") {
54     extra_header = "gpu/media/v4l2_stub_header.fragment"
56     script = "../../tools/generate_stubs/generate_stubs.py"
57     sources = [
58       "gpu/media/v4l2.sig",
59     ]
60     inputs = [
61       extra_header,
62     ]
63     stubs_filename_root = "v4l2_stubs"
65     outputs = [
66       "$target_gen_dir/gpu/media/$stubs_filename_root.cc",
67       "$target_gen_dir/gpu/media/$stubs_filename_root.h",
68     ]
69     args = [
70       "-i",
71       rebase_path("$target_gen_dir/gpu/media", root_build_dir),
72       "-o",
73       rebase_path("$target_gen_dir/gpu/media", root_build_dir),
74       "-t",
75       "posix_stubs",
76       "-e",
77       rebase_path(extra_header, root_build_dir),
78       "-s",
79       stubs_filename_root,
80       "-p",
81       "content/common/gpu/media",
82     ]
84     args += rebase_path(sources, root_build_dir)
85   }
88 if (is_mac) {
89   action("libvt_generate_stubs") {
90     extra_header = "gpu/media/vt_stubs_header.fragment"
92     script = "../../tools/generate_stubs/generate_stubs.py"
93     sources = [
94       "gpu/media/vt.sig",
95     ]
96     inputs = [
97       extra_header,
98     ]
99     stubs_filename_root = "vt_stubs"
101     outputs = [
102       "$target_gen_dir/gpu/media/$stubs_filename_root.cc",
103       "$target_gen_dir/gpu/media/$stubs_filename_root.h",
104     ]
105     args = [
106       "-i",
107       rebase_path("$target_gen_dir/gpu/media", root_build_dir),
108       "-o",
109       rebase_path("$target_gen_dir/gpu/media", root_build_dir),
110       "-t",
111       "posix_stubs",
112       "-e",
113       rebase_path(extra_header, root_build_dir),
114       "-s",
115       stubs_filename_root,
116       "-p",
117       "content/common/gpu/media",
118     ]
120     args += rebase_path(sources, root_build_dir)
121   }
124 source_set("common") {
125   # Only the public target should depend on this. All other targets (even
126   # internal content ones) should depend on the public one.
127   visibility = [ "//content/public/common:common_sources" ]
129   sources = rebase_path(content_common_gypi_values.private_common_sources,
130                         ".",
131                         "//content")
133   configs += [
134     "//content:content_implementation",
135     "//build/config/compiler:no_size_t_to_int_warning",
136   ]
138   public_deps = [
139     "//gpu/command_buffer/common",
140     "//third_party/WebKit/public:blink_headers",
141   ]
142   deps = [
143     "//base",
144     "//build/util:webkit_version",
145     "//components/tracing",
146     "//components/tracing:startup_tracing",
147     "//gpu/command_buffer/client:gles2_interface",
148     "//gpu/command_buffer/common:gles2_utils",
149     "//net",
150     "//skia",
151     "//third_party/icu",
152     "//ui/accessibility",
153     "//ui/base",
154     "//ui/base/ime",
155     "//ui/events/ipc",
156     "//ui/gfx",
157     "//ui/gfx/geometry",
158     "//ui/gfx/ipc",
159     "//ui/shell_dialogs",
160     "//url",
161     "//third_party/libjingle",
162   ]
164   if (!is_ios) {
165     deps += [
166       "//cc",
167       "//device/bluetooth",
168       "//ipc",
169       "//ipc/mojo",
171       # TODO: the dependency on gl_in_process_context should be decoupled from
172       # content and moved to android_webview. See crbug.com/365797.
173       "//gpu/blink",
174       "//gpu/command_buffer/client:gl_in_process_context",
175       "//gpu/command_buffer/client:gles2_c_lib",
176       "//gpu/command_buffer/client:gles2_cmd_helper",
177       "//gpu/command_buffer/client:gles2_implementation",
178       "//gpu/command_buffer/service",
179       "//gpu/ipc",
180       "//gpu/skia_bindings",
181       "//media",
182       "//media/midi",
183       "//media:shared_memory_support",
184       "//mojo/application/public/interfaces",
185       "//mojo/environment:chromium",
186       "//sandbox",
187       "//storage/common",
188       "//third_party/WebKit/public:blink",
189       "//third_party/mojo/src/mojo/edk/system",
190       "//ui/gl",
191       ":mojo_bindings",
192     ]
193   }
195   defines = []
196   include_dirs = []
197   libs = []
198   ldflags = []
200   if (is_android && use_seccomp_bpf) {
201     set_sources_assignment_filter([])
202     sources += [
203       "sandbox_linux/sandbox_bpf_base_policy_linux.cc",
204       "sandbox_linux/sandbox_bpf_base_policy_linux.h",
205     ]
206     set_sources_assignment_filter(sources_assignment_filter)
207   }
209   if (is_mac) {
210     sources += [
211                  "gpu/client/gpu_memory_buffer_impl_io_surface.cc",
212                  "gpu/client/gpu_memory_buffer_impl_io_surface.h",
213                  "gpu/gpu_memory_buffer_factory_io_surface.cc",
214                  "gpu/gpu_memory_buffer_factory_io_surface.h",
215                  "gpu/media/vt.h",
216                  "gpu/media/vt_video_decode_accelerator.cc",
217                  "gpu/media/vt_video_decode_accelerator.h",
218                ] + get_target_outputs(":libvt_generate_stubs")
220     sources -= [ "plugin_list_posix.cc" ]
222     deps += [
223       ":libvt_generate_stubs",
224       "//content/app/resources",
225       "//content:resources",
226       "//third_party/WebKit/public:image_resources",
227       "//third_party/WebKit/public:resources",
228       "//ui/accelerated_widget_mac",
229     ]
230     libs += [
231       "IOSurface.framework",
232       "OpenGL.framework",
233       "QuartzCore.framework",
234     ]
235   }
237   if (is_android) {
238     sources += [
239       "gpu/client/gpu_memory_buffer_impl_surface_texture.cc",
240       "gpu/client/gpu_memory_buffer_impl_surface_texture.h",
241       "gpu/gpu_memory_buffer_factory_surface_texture.cc",
242       "gpu/gpu_memory_buffer_factory_surface_texture.h",
243     ]
245     deps += [
246       "//content/public/android:jni",
247       "//content/public/android:common_aidl",
248     ]
250     libs += [ "android" ]
251   }
253   if (is_debug && !is_component_build) {
254     # Content depends on the PPAPI message logging stuff; if this isn't here,
255     # some unit test binaries won't compile. This only worked in release mode
256     # because logging is disabled there.
257     deps += [ "//ppapi/proxy:ipc_sources" ]
258   }
260   if (is_ios) {
261     sources -= [ "user_agent.cc" ]
262     assert(false, "Need to add lots of conditions here")
263   }
265   if (use_ozone) {
266     deps += [
267       "//ui/ozone:ozone",
268       "//ui/ozone:ozone_base",
269       "//ui/ozone/gpu",
270     ]
271   } else {
272     sources -= [
273       "cursors/webcursor_ozone.cc",
274       "font_list_ozone.cc",
275       "gpu/client/gpu_memory_buffer_impl_ozone_native_pixmap.cc",
276       "gpu/client/gpu_memory_buffer_impl_ozone_native_pixmap.h",
277       "gpu/gpu_memory_buffer_factory_ozone_native_pixmap.cc",
278       "gpu/gpu_memory_buffer_factory_ozone_native_pixmap.h",
279     ]
280   }
282   if (!use_aura) {
283     sources -= [ "cursors/webcursor_aura.cc" ]
284   }
286   if (!use_aura || !use_x11) {
287     sources -= [ "cursors/webcursor_aurax11.cc" ]
288   }
290   if (use_pango) {
291     configs += [ "//build/config/linux:pangocairo" ]
292     if (use_ozone) {
293       # If we're using pango, never use this ozone file (it was removed in all
294       # non-ozone cases above).
295       sources -= [ "font_list_ozone.cc" ]
296     }
297   } else {
298     sources -= [ "font_list_pango.cc" ]
299   }
301   if (use_x11) {
302     configs += [
303       "//build/config/linux:xcomposite",
304       "//third_party/khronos:khronos_headers",
305     ]
307     if (current_cpu != "arm" || !is_chromeos) {
308       sources += [ "gpu/x_util.h" ]
309     }
310   }
312   if (enable_plugins) {
313     deps += [ "//ppapi/shared_impl" ]
314   } else {
315     sources -= [
316       "pepper_file_util.cc",
317       "pepper_file_util.h",
318       "pepper_messages.h",
319       "pepper_plugin_list.cc",
320       "pepper_plugin_list.h",
321       "pepper_renderer_instance_data.cc",
322       "pepper_renderer_instance_data.h",
323       "plugin_list.cc",
324       "plugin_list.h",
325       "plugin_list_posix.cc",
326       "sandbox_util.cc",
327     ]
328   }
330   if (is_android) {
331     sources += [
332       "gpu/media/android_video_decode_accelerator.cc",
333       "gpu/media/android_video_decode_accelerator.h",
334     ]
336     if (enable_webrtc) {
337       deps += [ "//third_party/libyuv" ]
338     }
339   }
341   if (is_chromeos) {
342     sources += [
343       "gpu/media/accelerated_video_decoder.h",
344       "gpu/media/h264_decoder.cc",
345       "gpu/media/h264_decoder.h",
346       "gpu/media/h264_dpb.cc",
347       "gpu/media/h264_dpb.h",
348       "gpu/media/vp8_decoder.cc",
349       "gpu/media/vp8_decoder.h",
350       "gpu/media/vp8_picture.cc",
351       "gpu/media/vp8_picture.h",
352     ]
353     if (use_v4lplugin) {
354       defines += [ "USE_LIBV4L2" ]
355       sources += get_target_outputs(":libv4l2_generate_stubs")
356       deps += [ ":libv4l2_generate_stubs" ]
357     }
358     if (use_v4l2_codec) {
359       defines += [ "USE_V4L2_CODEC" ]
360       sources += [
361         "gpu/media/generic_v4l2_device.cc",
362         "gpu/media/generic_v4l2_device.h",
363         "gpu/media/v4l2_device.cc",
364         "gpu/media/v4l2_device.h",
365         "gpu/media/v4l2_image_processor.cc",
366         "gpu/media/v4l2_image_processor.h",
367         "gpu/media/v4l2_jpeg_decode_accelerator.cc",
368         "gpu/media/v4l2_jpeg_decode_accelerator.h",
369         "gpu/media/v4l2_slice_video_decode_accelerator.cc",
370         "gpu/media/v4l2_slice_video_decode_accelerator.h",
371         "gpu/media/v4l2_video_decode_accelerator.cc",
372         "gpu/media/v4l2_video_decode_accelerator.h",
373         "gpu/media/v4l2_video_encode_accelerator.cc",
374         "gpu/media/v4l2_video_encode_accelerator.h",
375       ]
376       libs = [
377         "EGL",
378         "GLESv2",
379       ]
380     }
381     if (current_cpu == "arm") {
382       sources += [
383         "gpu/media/tegra_v4l2_device.cc",
384         "gpu/media/tegra_v4l2_device.h",
385       ]
386     }
387     if (current_cpu != "arm") {
388       sources += [
389                    "gpu/media/va_surface.h",
390                    "gpu/media/vaapi_jpeg_decode_accelerator.cc",
391                    "gpu/media/vaapi_jpeg_decode_accelerator.h",
392                    "gpu/media/vaapi_jpeg_decoder.cc",
393                    "gpu/media/vaapi_jpeg_decoder.h",
394                    "gpu/media/vaapi_picture.cc",
395                    "gpu/media/vaapi_picture.h",
396                    "gpu/media/vaapi_video_decode_accelerator.cc",
397                    "gpu/media/vaapi_video_decode_accelerator.h",
398                    "gpu/media/vaapi_video_encode_accelerator.cc",
399                    "gpu/media/vaapi_video_encode_accelerator.h",
400                    "gpu/media/vaapi_wrapper.cc",
401                    "gpu/media/vaapi_wrapper.h",
402                  ] + get_target_outputs(":libva_generate_stubs")
403       configs += [
404         "//third_party/libva:libva_config",
405         "//third_party/libyuv:libyuv_config",
406       ]
407       deps += [
408         ":libva_generate_stubs",
409         "//media",
410         "//third_party/libyuv",
411       ]
412       if (use_x11) {
413         sources += [
414           "gpu/media/vaapi_tfp_picture.cc",
415           "gpu/media/vaapi_tfp_picture.h",
416         ]
417       }
418       if (use_ozone) {
419         sources += [
420           "gpu/media/vaapi_drm_picture.cc",
421           "gpu/media/vaapi_drm_picture.h",
422         ]
423       }
424     }
425   }
427   if (is_win) {
428     sources += [
429       "gpu/media/dxva_video_decode_accelerator.cc",
430       "gpu/media/dxva_video_decode_accelerator.h",
431     ]
432     configs += [ "//third_party/khronos:khronos_headers" ]
433     deps += [ "//ui/gl" ]
434     libs += [
435       "d3d9.lib",
436       "d3d11.lib",
437       "dxva2.lib",
438       "strmiids.lib",
439       "mf.lib",
440       "mfplat.lib",
441       "mfuuid.lib",
442     ]
443     ldflags += [
444       "/DELAYLOAD:d3d9.dll",
445       "/DELAYLOAD:d3d11.dll",
446       "/DELAYLOAD:dxva2.dll",
447       "/DELAYLOAD:mf.dll",
448       "/DELAYLOAD:mfplat.dll",
449     ]
451     # TODO(GYP): extract_xinput action.
452   }
454   if (!is_win || !use_aura) {
455     sources -= [ "cursors/webcursor_aurawin.cc" ]
456   }
458   if (use_seccomp_bpf) {
459     defines += [ "USE_SECCOMP_BPF" ]
460   } else {
461     if (is_linux) {
462       sources -= [
463         "sandbox_linux/bpf_cros_arm_gpu_policy_linux.cc",
464         "sandbox_linux/bpf_cros_arm_gpu_policy_linux.h",
465         "sandbox_linux/bpf_gpu_policy_linux.cc",
466         "sandbox_linux/bpf_gpu_policy_linux.h",
467         "sandbox_linux/bpf_ppapi_policy_linux.cc",
468         "sandbox_linux/bpf_ppapi_policy_linux.h",
469         "sandbox_linux/bpf_renderer_policy_linux.cc",
470         "sandbox_linux/bpf_renderer_policy_linux.h",
471         "sandbox_linux/bpf_utility_policy_linux.cc",
472         "sandbox_linux/bpf_utility_policy_linux.h",
473         "sandbox_linux/sandbox_bpf_base_policy_linux.cc",
474         "sandbox_linux/sandbox_bpf_base_policy_linux.h",
475       ]
476     }
477     if (is_android) {
478       sources -= [
479         "sandbox_linux/android/sandbox_bpf_base_policy_android.cc",
480         "sandbox_linux/android/sandbox_bpf_base_policy_android.h",
481       ]
482     }
483   }
485   if (is_win && current_cpu == "x64") {
486     # TODO(jschuh): Remove this after crbug.com/173851 gets fixed.
487     cflags = [ "/bigobj" ]
488   }
491 mojom("mojo_bindings") {
492   sources = [
493     "application_setup.mojom",
494     "background_sync_service.mojom",
495     "geolocation_service.mojom",
496     "image_downloader/image_downloader.mojom",
497     "permission_service.mojom",
498     "presentation/presentation_service.mojom",
499     "process_control.mojom",
500     "render_frame_setup.mojom",
501     "service_port_service.mojom",
502     "service_worker/embedded_worker_setup.mojom",
503     "vr_service.mojom",
504   ]
506   import_dirs = [ "//mojo/services" ]
508   deps = [
509     "//content/public/common:mojo_bindings",
510     "//mojo/application/public/interfaces",
511     "//skia/public/interfaces",
512     "//ui/mojo/geometry:interfaces",
513   ]