Refactors gesture conversion functions to ui/events/blink
[chromium-blink-merge.git] / content / common / BUILD.gn
blob80e6c774512876edae990b16fc9917b02221fedc
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     "//gpu/command_buffer/client:gles2_interface",
147     "//gpu/command_buffer/client:gpu_memory_buffer_manager",
148     "//net",
149     "//skia",
150     "//third_party/icu",
151     "//ui/accessibility",
152     "//ui/base",
153     "//ui/base/ime",
154     "//ui/events/ipc",
155     "//ui/gfx",
156     "//ui/gfx/geometry",
157     "//ui/gfx/ipc",
158     "//ui/shell_dialogs",
159     "//url",
160     "//third_party/libjingle",
161   ]
163   if (!is_ios) {
164     deps += [
165       "//cc",
166       "//ipc",
167       "//ipc/mojo",
169       # TODO: the dependency on gl_in_process_context should be decoupled from
170       # content and moved to android_webview. See crbug.com/365797.
171       "//gpu/blink",
172       "//gpu/command_buffer/client:gl_in_process_context",
173       "//gpu/command_buffer/client:gles2_c_lib",
174       "//gpu/command_buffer/client:gles2_cmd_helper",
175       "//gpu/command_buffer/client:gles2_implementation",
176       "//gpu/command_buffer/service",
177       "//gpu/ipc",
178       "//gpu/skia_bindings",
179       "//media",
180       "//media:shared_memory_support",
181       "//mojo/environment:chromium",
182       "//sandbox",
183       "//storage/common",
184       "//third_party/WebKit/public:blink",
185       "//third_party/mojo/src/mojo/edk/system",
186       "//third_party/mojo/src/mojo/public/interfaces/application",
187       "//ui/gl",
188       "//webkit/common/gpu",
189     ]
190   }
192   defines = []
193   include_dirs = []
194   libs = []
195   ldflags = []
197   if (is_android && use_seccomp_bpf) {
198     set_sources_assignment_filter([])
199     sources += [
200       "sandbox_linux/sandbox_bpf_base_policy_linux.cc",
201       "sandbox_linux/sandbox_bpf_base_policy_linux.h",
202     ]
203     set_sources_assignment_filter(sources_assignment_filter)
204   }
206   if (is_mac) {
207     sources += [
208                  "gpu/client/gpu_memory_buffer_impl_io_surface.cc",
209                  "gpu/client/gpu_memory_buffer_impl_io_surface.h",
210                ] + get_target_outputs(":libvt_generate_stubs")
212     sources -= [ "plugin_list_posix.cc" ]
214     deps += [
215       ":libvt_generate_stubs",
216       "//content/app/resources",
217       "//content:resources",
218       "//third_party/WebKit/public:resources",
219       "//ui/accelerated_widget_mac",
220     ]
221     libs += [ "QuartzCore.framework" ]
222   }
224   if (is_android) {
225     sources += [
226       "gpu/client/gpu_memory_buffer_impl_surface_texture.cc",
227       "gpu/client/gpu_memory_buffer_impl_surface_texture.h",
228       "gpu/gpu_memory_buffer_factory_surface_texture.cc",
229       "gpu/gpu_memory_buffer_factory_surface_texture.h",
230     ]
232     deps += [
233       "//content/public/android:jni",
234       "//content/public/android:common_aidl",
235     ]
237     libs += [ "android" ]
238   }
240   if (is_ios) {
241     sources -= [ "user_agent.cc" ]
242     assert(false, "Need to add lots of conditions here")
243   }
245   if (use_ozone) {
246     deps += [
247       "//ui/ozone:ozone",
248       "//ui/ozone:ozone_base",
249       "//ui/ozone/gpu",
250     ]
251   } else {
252     sources -= [
253       "cursors/webcursor_ozone.cc",
254       "font_list_ozone.cc",
255       "gpu/client/gpu_memory_buffer_impl_ozone_native_buffer.cc",
256       "gpu/client/gpu_memory_buffer_impl_ozone_native_buffer.h",
257       "gpu/gpu_memory_buffer_factory_ozone_native_buffer.cc",
258       "gpu/gpu_memory_buffer_factory_ozone_native_buffer.h",
259     ]
260   }
262   if (!use_aura) {
263     sources -= [ "cursors/webcursor_aura.cc" ]
264   }
266   if (!use_aura || !use_x11) {
267     sources -= [ "cursors/webcursor_aurax11.cc" ]
268   }
270   if (use_pango) {
271     configs += [ "//build/config/linux:pangocairo" ]
272     if (use_ozone) {
273       # If we're using pango, never use this ozone file (it was removed in all
274       # non-ozone cases above).
275       sources -= [ "font_list_ozone.cc" ]
276     }
277   } else {
278     sources -= [ "font_list_pango.cc" ]
279   }
281   if (use_x11) {
282     include_dirs += [ "//third_party/khronos" ]
283     configs += [ "//build/config/linux:xcomposite" ]
285     if (current_cpu != "arm" || !is_chromeos) {
286       sources += [ "gpu/x_util.h" ]
287     }
288   }
290   if (enable_plugins) {
291     deps += [ "//ppapi/shared_impl" ]
292   } else {
293     sources -= [
294       "pepper_file_util.cc",
295       "pepper_file_util.h",
296       "pepper_messages.h",
297       "pepper_plugin_list.cc",
298       "pepper_plugin_list.h",
299       "pepper_renderer_instance_data.cc",
300       "pepper_renderer_instance_data.h",
301       "plugin_list.cc",
302       "plugin_list.h",
303       "plugin_list_posix.cc",
304       "sandbox_util.cc",
305     ]
306   }
308   if (is_android) {
309     sources += [
310       "gpu/media/android_video_decode_accelerator.cc",
311       "gpu/media/android_video_decode_accelerator.h",
312     ]
314     if (enable_webrtc) {
315       deps += [ "//third_party/libyuv" ]
316     }
317   }
319   if (is_chromeos) {
320     if (use_v4lplugin) {
321       defines += [ "USE_LIBV4L2" ]
322       sources += get_target_outputs(":libv4l2_generate_stubs")
323       deps += [ ":libv4l2_generate_stubs" ]
324     }
325     if (use_v4l2_codec) {
326       defines += [ "USE_V4L2_CODEC" ]
327       sources += [
328         "gpu/media/accelerated_video_decoder.h",
329         "gpu/media/generic_v4l2_device.cc",
330         "gpu/media/generic_v4l2_device.h",
331         "gpu/media/h264_decoder.cc",
332         "gpu/media/h264_decoder.h",
333         "gpu/media/h264_dpb.cc",
334         "gpu/media/h264_dpb.h",
335         "gpu/media/v4l2_device.cc",
336         "gpu/media/v4l2_device.h",
337         "gpu/media/v4l2_image_processor.cc",
338         "gpu/media/v4l2_image_processor.h",
339         "gpu/media/v4l2_slice_video_decode_accelerator.cc",
340         "gpu/media/v4l2_slice_video_decode_accelerator.h",
341         "gpu/media/v4l2_video_decode_accelerator.cc",
342         "gpu/media/v4l2_video_decode_accelerator.h",
343         "gpu/media/v4l2_video_encode_accelerator.cc",
344         "gpu/media/v4l2_video_encode_accelerator.h",
345         "gpu/media/vp8_decoder.cc",
346         "gpu/media/vp8_decoder.h",
347         "gpu/media/vp8_picture.cc",
348         "gpu/media/vp8_picture.h",
349       ]
350       libs = [
351         "EGL",
352         "GLESv2",
353       ]
354     }
355     if (current_cpu == "arm") {
356       sources += [
357         "gpu/media/tegra_v4l2_device.cc",
358         "gpu/media/tegra_v4l2_device.h",
359       ]
360     }
361     if (current_cpu != "arm") {
362       sources += [
363                    "gpu/media/va_surface.h",
364                    "gpu/media/vaapi_h264_decoder.cc",
365                    "gpu/media/vaapi_h264_decoder.h",
366                    "gpu/media/vaapi_h264_dpb.cc",
367                    "gpu/media/vaapi_h264_dpb.h",
368                    "gpu/media/vaapi_picture.cc",
369                    "gpu/media/vaapi_picture.h",
370                    "gpu/media/vaapi_video_decode_accelerator.cc",
371                    "gpu/media/vaapi_video_decode_accelerator.h",
372                    "gpu/media/vaapi_video_encode_accelerator.cc",
373                    "gpu/media/vaapi_video_encode_accelerator.h",
374                    "gpu/media/vaapi_wrapper.cc",
375                    "gpu/media/vaapi_wrapper.h",
376                  ] + get_target_outputs(":libva_generate_stubs")
377       configs += [
378         "//third_party/libva:libva_config",
379         "//third_party/libyuv:libyuv_config",
380       ]
381       deps += [
382         ":libva_generate_stubs",
383         "//media",
384         "//third_party/libyuv",
385       ]
386       if (use_x11) {
387         sources += [
388           "gpu/media/vaapi_tfp_picture.cc",
389           "gpu/media/vaapi_tfp_picture.h",
390         ]
391       }
392       if (use_ozone) {
393         sources += [
394           "gpu/media/vaapi_drm_picture.cc",
395           "gpu/media/vaapi_drm_picture.h",
396         ]
397       }
398     }
399   }
401   if (is_win) {
402     sources += [
403       "gpu/media/dxva_video_decode_accelerator.cc",
404       "gpu/media/dxva_video_decode_accelerator.h",
405     ]
406     include_dirs += [ "//third_party/khronos" ]
407     deps += [ "//ui/gl" ]
408     libs += [
409       "d3d9.lib",
410       "d3d11.lib",
411       "dxva2.lib",
412       "strmiids.lib",
413       "mf.lib",
414       "mfplat.lib",
415       "mfuuid.lib",
416     ]
417     ldflags += [
418       "/DELAYLOAD:d3d9.dll",
419       "/DELAYLOAD:d3d11.dll",
420       "/DELAYLOAD:dxva2.dll",
421       "/DELAYLOAD:mf.dll",
422       "/DELAYLOAD:mfplat.dll",
423     ]
425     # TODO(GYP): extract_xinput action.
426   }
428   if (!is_win || !use_aura) {
429     sources -= [ "cursors/webcursor_aurawin.cc" ]
430   }
432   if (use_seccomp_bpf) {
433     defines += [ "USE_SECCOMP_BPF" ]
434   } else {
435     if (is_linux) {
436       sources -= [
437         "sandbox_linux/bpf_cros_arm_gpu_policy_linux.cc",
438         "sandbox_linux/bpf_cros_arm_gpu_policy_linux.h",
439         "sandbox_linux/bpf_gpu_policy_linux.cc",
440         "sandbox_linux/bpf_gpu_policy_linux.h",
441         "sandbox_linux/bpf_ppapi_policy_linux.cc",
442         "sandbox_linux/bpf_ppapi_policy_linux.h",
443         "sandbox_linux/bpf_renderer_policy_linux.cc",
444         "sandbox_linux/bpf_renderer_policy_linux.h",
445         "sandbox_linux/bpf_utility_policy_linux.cc",
446         "sandbox_linux/bpf_utility_policy_linux.h",
447         "sandbox_linux/sandbox_bpf_base_policy_linux.cc",
448         "sandbox_linux/sandbox_bpf_base_policy_linux.h",
449       ]
450     }
451     if (is_android) {
452       sources -= [
453         "sandbox_linux/android/sandbox_bpf_base_policy_android.cc",
454         "sandbox_linux/android/sandbox_bpf_base_policy_android.h",
455       ]
456     }
457   }
459   if (is_win && current_cpu == "x64") {
460     # TODO(jschuh): Remove this after crbug.com/173851 gets fixed.
461     cflags = [ "/bigobj" ]
462   }
465 mojom("mojo_bindings") {
466   sources = [
467     "application_setup.mojom",
468     "geolocation_service.mojom",
469     "permission_service.mojom",
470     "presentation/presentation_service.mojom",
471     "render_frame_setup.mojom",
472   ]
474   deps = [
475     "//content/public/common:mojo_bindings",
476     "//third_party/mojo/src/mojo/public/interfaces/application:application",
477   ]