Revert of Support multiple video decoders and encoders (patchset #14 id:260001 of...
[chromium-blink-merge.git] / content / common / BUILD.gn
blob2ce16acc74950cb1e1743d9a3f3a1c5f2b8647b4
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("//mojo/public/tools/bindings/mojom.gni")
10 if (is_chromeos && cpu_arch != "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_mac) {
53   action("libvt_generate_stubs") {
54     extra_header = "gpu/media/vt_stubs_header.fragment"
56     script = "../../tools/generate_stubs/generate_stubs.py"
57     sources = [
58       "gpu/media/vt.sig",
59     ]
60     inputs = [
61       extra_header,
62     ]
63     stubs_filename_root = "vt_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 source_set("common") {
89   # Only the public target should depend on this. All other targets (even
90   # internal content ones) should depend on the public one.
91   visibility = [ "//content/public/common:common_sources" ]
93   sources = rebase_path(content_common_gypi_values.private_common_sources,
94                         ".",
95                         "//content")
97   configs += [ "//content:content_implementation" ]
99   public_deps = [
100     "//gpu/command_buffer/common",
101     "//third_party/WebKit/public:blink_headers",
102   ]
103   deps = [
104     "//base",
105     "//build/util:webkit_version",
106     "//components/tracing",
107     "//gpu/command_buffer/client:gles2_interface",
108     "//gpu/command_buffer/client:gpu_memory_buffer_manager",
109     "//net",
110     "//skia",
111     "//third_party/icu",
112     "//ui/accessibility",
113     "//ui/base",
114     "//ui/events/ipc",
115     "//ui/gfx",
116     "//ui/gfx/geometry",
117     "//ui/gfx/ipc",
118     "//ui/shell_dialogs",
119     "//url",
120     "//third_party/libjingle",
121   ]
123   if (!is_ios) {
124     deps += [
125       "//cc",
126       "//ipc",
127       "//ipc/mojo",
129       # TODO: the dependency on gl_in_process_context should be decoupled from
130       # content and moved to android_webview. See crbug.com/365797.
131       "//gpu/blink",
132       "//gpu/command_buffer/client:gl_in_process_context",
133       "//gpu/command_buffer/client:gles2_c_lib",
134       "//gpu/command_buffer/client:gles2_cmd_helper",
135       "//gpu/command_buffer/client:gles2_implementation",
136       "//gpu/command_buffer/service",
137       "//gpu/ipc",
138       "//gpu/skia_bindings",
139       "//media",
140       "//media:shared_memory_support",
141       "//mojo/edk/system",
142       "//mojo/environment:chromium",
143       "//mojo/public/interfaces/application",
144       "//sandbox",
145       "//storage/browser",
146       "//storage/common",
147       "//third_party/WebKit/public:blink",
148       "//ui/gl",
149       "//webkit/common/gpu",
150     ]
151   }
153   defines = []
154   include_dirs = []
155   libs = []
156   ldflags = []
158   if (is_android && use_seccomp_bpf) {
159     set_sources_assignment_filter([])
160     sources += [
161       "sandbox_linux/sandbox_bpf_base_policy_linux.cc",
162       "sandbox_linux/sandbox_bpf_base_policy_linux.h",
163     ]
164     set_sources_assignment_filter(sources_assignment_filter)
165   }
167   if (is_mac) {
168     sources += [
169                  "gpu/client/gpu_memory_buffer_impl_io_surface.cc",
170                  "gpu/client/gpu_memory_buffer_impl_io_surface.h",
171                ] + get_target_outputs(":libvt_generate_stubs")
173     sources -= [ "plugin_list_posix.cc" ]
175     deps += [
176       ":libvt_generate_stubs",
177       "//content/app/resources",
178       "//content:resources",
179       "//third_party/WebKit/public:resources",
180       "//ui/accelerated_widget_mac",
181     ]
182     libs += [ "QuartzCore.framework" ]
183   }
185   if (is_android) {
186     sources += [
187       "gpu/client/gpu_memory_buffer_impl_surface_texture.cc",
188       "gpu/client/gpu_memory_buffer_impl_surface_texture.h",
189       "gpu/gpu_memory_buffer_factory_surface_texture.cc",
190       "gpu/gpu_memory_buffer_factory_surface_texture.h",
191     ]
193     deps += [
194       "//content/public/android:jni",
195       "//content/public/android:common_aidl",
196     ]
198     libs += [ "android" ]
199   }
201   if (is_ios) {
202     sources -= [ "user_agent.cc" ]
203     assert(false, "Need to add lots of conditions here")
204   }
206   if (use_ozone) {
207     deps += [
208       "//ui/ozone:ozone",
209       "//ui/ozone:ozone_base",
210       "//ui/ozone/gpu",
211     ]
212   } else {
213     sources -= [
214       "cursors/webcursor_ozone.cc",
215       "font_list_ozone.cc",
216       "gpu/client/gpu_memory_buffer_impl_ozone_native_buffer.cc",
217       "gpu/client/gpu_memory_buffer_impl_ozone_native_buffer.h",
218       "gpu/gpu_memory_buffer_factory_ozone_native_buffer.cc",
219       "gpu/gpu_memory_buffer_factory_ozone_native_buffer.h",
220     ]
221   }
223   if (!use_aura) {
224     sources -= [ "cursors/webcursor_aura.cc" ]
225   }
227   if (!use_aura || !use_x11) {
228     sources -= [ "cursors/webcursor_aurax11.cc" ]
229   }
231   if (use_pango) {
232     configs += [ "//build/config/linux:pangocairo" ]
233     if (use_ozone) {
234       # If we're using pango, never use this ozone file (it was removed in all
235       # non-ozone cases above).
236       sources -= [ "font_list_ozone.cc" ]
237     }
238   } else {
239     sources -= [ "font_list_pango.cc" ]
240   }
242   if (use_x11) {
243     include_dirs += [ "//third_party/khronos" ]
244     configs += [ "//build/config/linux:xcomposite" ]
246     if (cpu_arch != "arm" || !is_chromeos) {
247       sources += [
248         "gpu/x_util.cc",
249         "gpu/x_util.h",
250       ]
251     }
252   }
254   if (enable_plugins) {
255     deps += [ "//ppapi:ppapi_shared" ]
256   } else {
257     sources -= [
258       "pepper_file_util.cc",
259       "pepper_file_util.h",
260       "pepper_messages.h",
261       "pepper_plugin_list.cc",
262       "pepper_plugin_list.h",
263       "pepper_renderer_instance_data.cc",
264       "pepper_renderer_instance_data.h",
265       "plugin_list.cc",
266       "plugin_list.h",
267       "plugin_list_posix.cc",
268       "sandbox_util.cc",
269     ]
270   }
272   if (is_android) {
273     sources += [
274       "gpu/media/android_video_decode_accelerator.cc",
275       "gpu/media/android_video_decode_accelerator.h",
276     ]
278     if (enable_webrtc) {
279       deps += [ "//third_party/libyuv" ]
280     }
281   }
283   if (is_chromeos) {
284     if (cpu_arch == "arm" && use_x11) {
285       sources += [
286         "gpu/media/exynos_v4l2_video_device.cc",
287         "gpu/media/exynos_v4l2_video_device.h",
288         "gpu/media/tegra_v4l2_video_device.cc",
289         "gpu/media/tegra_v4l2_video_device.h",
290         "gpu/media/v4l2_image_processor.cc",
291         "gpu/media/v4l2_image_processor.h",
292         "gpu/media/v4l2_video_decode_accelerator.cc",
293         "gpu/media/v4l2_video_decode_accelerator.h",
294         "gpu/media/v4l2_video_device.cc",
295         "gpu/media/v4l2_video_device.h",
296         "gpu/media/v4l2_video_encode_accelerator.cc",
297         "gpu/media/v4l2_video_encode_accelerator.h",
298       ]
299       libs = [
300         "EGL",
301         "GLESv2",
302       ]
303     }
304     if (cpu_arch != "arm") {
305       sources += [
306                    "gpu/media/h264_dpb.cc",
307                    "gpu/media/h264_dpb.h",
308                    "gpu/media/va_surface.h",
309                    "gpu/media/vaapi_h264_decoder.cc",
310                    "gpu/media/vaapi_h264_decoder.h",
311                    "gpu/media/vaapi_picture.cc",
312                    "gpu/media/vaapi_picture.h",
313                    "gpu/media/vaapi_video_decode_accelerator.cc",
314                    "gpu/media/vaapi_video_decode_accelerator.h",
315                    "gpu/media/vaapi_video_encode_accelerator.cc",
316                    "gpu/media/vaapi_video_encode_accelerator.h",
317                    "gpu/media/vaapi_wrapper.cc",
318                    "gpu/media/vaapi_wrapper.h",
319                  ] + get_target_outputs(":libva_generate_stubs")
320       configs += [
321         "//third_party/libva:libva_config",
322         "//third_party/libyuv:libyuv_config",
323       ]
324       deps += [
325         ":libva_generate_stubs",
326         "//media",
327         "//third_party/libyuv",
328       ]
329       if (use_x11) {
330         sources += [
331           "gpu/media/vaapi_tfp_picture.cc",
332           "gpu/media/vaapi_tfp_picture.h",
333         ]
334       }
335       if (use_ozone) {
336         sources += [
337           "gpu/media/vaapi_drm_picture.cc",
338           "gpu/media/vaapi_drm_picture.h",
339         ]
340       }
341     }
342   }
344   if (is_win) {
345     sources += [
346       "gpu/media/dxva_video_decode_accelerator.cc",
347       "gpu/media/dxva_video_decode_accelerator.h",
348     ]
349     include_dirs += [ "//third_party/khronos" ]
350     deps += [ "//ui/gl" ]
352     # TODO(GYP): extract_xinput action.
353   }
355   if (!is_win || !use_aura) {
356     sources -= [ "cursors/webcursor_aurawin.cc" ]
357   }
359   if (use_seccomp_bpf) {
360     defines += [ "USE_SECCOMP_BPF" ]
361   } else {
362     if (is_linux) {
363       sources -= [
364         "sandbox_linux/bpf_cros_arm_gpu_policy_linux.cc",
365         "sandbox_linux/bpf_cros_arm_gpu_policy_linux.h",
366         "sandbox_linux/bpf_gpu_policy_linux.cc",
367         "sandbox_linux/bpf_gpu_policy_linux.h",
368         "sandbox_linux/bpf_ppapi_policy_linux.cc",
369         "sandbox_linux/bpf_ppapi_policy_linux.h",
370         "sandbox_linux/bpf_renderer_policy_linux.cc",
371         "sandbox_linux/bpf_renderer_policy_linux.h",
372         "sandbox_linux/bpf_utility_policy_linux.cc",
373         "sandbox_linux/bpf_utility_policy_linux.h",
374         "sandbox_linux/sandbox_bpf_base_policy_linux.cc",
375         "sandbox_linux/sandbox_bpf_base_policy_linux.h",
376       ]
377     }
378     if (is_android) {
379       sources -= [
380         "sandbox_linux/android/sandbox_bpf_base_policy_android.cc",
381         "sandbox_linux/android/sandbox_bpf_base_policy_android.h",
382       ]
383     }
384   }
387 mojom("mojo_bindings") {
388   sources = [
389     "geolocation_service.mojom",
390     "permission_service.mojom",
391     "render_frame_setup.mojom",
392   ]
394   deps = [
395     "//content/public/common:mojo_bindings",
396     "//mojo/public/interfaces/application:application",
397   ]