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