Add ICU message format support
[chromium-blink-merge.git] / content / common / BUILD.gn
blob241872a397dd603aa95ddcf51f790f12e81bffd7
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/environment:chromium",
190       "//sandbox",
191       "//storage/common",
192       "//third_party/WebKit/public:blink",
193       "//third_party/mojo/src/mojo/edk/system",
194       "//ui/gl",
195       ":mojo_bindings",
196     ]
197   }
199   defines = []
200   include_dirs = []
201   libs = []
202   ldflags = []
204   if (is_android && use_seccomp_bpf) {
205     set_sources_assignment_filter([])
206     sources += [
207       "sandbox_linux/sandbox_bpf_base_policy_linux.cc",
208       "sandbox_linux/sandbox_bpf_base_policy_linux.h",
209     ]
210     set_sources_assignment_filter(sources_assignment_filter)
211   }
213   if (is_mac) {
214     sources += [
215                  "gpu/client/gpu_memory_buffer_impl_io_surface.cc",
216                  "gpu/client/gpu_memory_buffer_impl_io_surface.h",
217                  "gpu/gpu_memory_buffer_factory_io_surface.cc",
218                  "gpu/gpu_memory_buffer_factory_io_surface.h",
219                  "gpu/media/vt.h",
220                  "gpu/media/vt_video_decode_accelerator.cc",
221                  "gpu/media/vt_video_decode_accelerator.h",
222                ] + get_target_outputs(":libvt_generate_stubs")
224     sources -= [ "plugin_list_posix.cc" ]
226     deps += [
227       ":libvt_generate_stubs",
228       "//content/app/resources",
229       "//content:resources",
230       "//third_party/WebKit/public:image_resources",
231       "//third_party/WebKit/public:resources",
232       "//ui/accelerated_widget_mac",
233     ]
234     lib_dirs = [ "$mac_sdk_path/usr/lib" ]
235     libs += [
236       "IOSurface.framework",
237       "OpenGL.framework",
238       "QuartzCore.framework",
239       "sandbox",
240     ]
241   }
243   if (is_android) {
244     sources += [
245       "gpu/client/gpu_memory_buffer_impl_surface_texture.cc",
246       "gpu/client/gpu_memory_buffer_impl_surface_texture.h",
247       "gpu/gpu_memory_buffer_factory_surface_texture.cc",
248       "gpu/gpu_memory_buffer_factory_surface_texture.h",
249     ]
251     deps += [
252       "//content/public/android:jni",
253       "//content/public/android:common_aidl",
254     ]
256     libs += [ "android" ]
257   }
259   if (is_debug && !is_component_build) {
260     # Content depends on the PPAPI message logging stuff; if this isn't here,
261     # some unit test binaries won't compile. This only worked in release mode
262     # because logging is disabled there.
263     deps += [ "//ppapi/proxy:ipc_sources" ]
264   }
266   if (is_ios) {
267     sources -= [ "user_agent.cc" ]
268     assert(false, "Need to add lots of conditions here")
269   }
271   if (use_ozone) {
272     deps += [
273       "//ui/ozone:ozone",
274       "//ui/ozone:ozone_base",
275     ]
276   } else {
277     sources -= [
278       "cursors/webcursor_ozone.cc",
279       "font_list_ozone.cc",
280       "gpu/client/gpu_memory_buffer_impl_ozone_native_pixmap.cc",
281       "gpu/client/gpu_memory_buffer_impl_ozone_native_pixmap.h",
282       "gpu/gpu_memory_buffer_factory_ozone_native_pixmap.cc",
283       "gpu/gpu_memory_buffer_factory_ozone_native_pixmap.h",
284     ]
285   }
287   if (!use_aura || is_android) {
288     sources -= [ "cursors/webcursor_aura.cc" ]
289   }
291   if (!use_aura || !use_x11) {
292     sources -= [ "cursors/webcursor_aurax11.cc" ]
293   }
295   if (use_pango) {
296     configs += [ "//build/config/linux:pangocairo" ]
297     if (use_ozone) {
298       # If we're using pango, never use this ozone file (it was removed in all
299       # non-ozone cases above).
300       sources -= [ "font_list_ozone.cc" ]
301     }
302   } else {
303     sources -= [ "font_list_pango.cc" ]
304   }
306   if (use_x11) {
307     configs += [
308       "//build/config/linux:xcomposite",
309       "//third_party/khronos:khronos_headers",
310     ]
312     if (current_cpu != "arm" || !is_chromeos) {
313       sources += [ "gpu/x_util.h" ]
314     }
315   }
317   if (enable_plugins) {
318     deps += [ "//ppapi/shared_impl" ]
319   } else {
320     sources -= [
321       "pepper_file_util.cc",
322       "pepper_file_util.h",
323       "pepper_messages.h",
324       "pepper_plugin_list.cc",
325       "pepper_plugin_list.h",
326       "pepper_renderer_instance_data.cc",
327       "pepper_renderer_instance_data.h",
328       "plugin_list.cc",
329       "plugin_list.h",
330       "plugin_list_posix.cc",
331       "sandbox_util.cc",
332     ]
333   }
335   if (is_android) {
336     sources += [
337       "gpu/media/android_video_decode_accelerator.cc",
338       "gpu/media/android_video_decode_accelerator.h",
339     ]
341     if (enable_webrtc) {
342       deps += [ "//third_party/libyuv" ]
343     }
344   }
346   if (is_chromeos) {
347     sources += [
348       "gpu/media/accelerated_video_decoder.h",
349       "gpu/media/h264_decoder.cc",
350       "gpu/media/h264_decoder.h",
351       "gpu/media/h264_dpb.cc",
352       "gpu/media/h264_dpb.h",
353       "gpu/media/vp8_decoder.cc",
354       "gpu/media/vp8_decoder.h",
355       "gpu/media/vp8_picture.cc",
356       "gpu/media/vp8_picture.h",
357     ]
358     if (use_v4lplugin) {
359       defines += [ "USE_LIBV4L2" ]
360       sources += get_target_outputs(":libv4l2_generate_stubs")
361       deps += [ ":libv4l2_generate_stubs" ]
362     }
363     if (use_v4l2_codec) {
364       defines += [ "USE_V4L2_CODEC" ]
365       sources += [
366         "gpu/media/generic_v4l2_device.cc",
367         "gpu/media/generic_v4l2_device.h",
368         "gpu/media/v4l2_device.cc",
369         "gpu/media/v4l2_device.h",
370         "gpu/media/v4l2_image_processor.cc",
371         "gpu/media/v4l2_image_processor.h",
372         "gpu/media/v4l2_jpeg_decode_accelerator.cc",
373         "gpu/media/v4l2_jpeg_decode_accelerator.h",
374         "gpu/media/v4l2_slice_video_decode_accelerator.cc",
375         "gpu/media/v4l2_slice_video_decode_accelerator.h",
376         "gpu/media/v4l2_video_decode_accelerator.cc",
377         "gpu/media/v4l2_video_decode_accelerator.h",
378         "gpu/media/v4l2_video_encode_accelerator.cc",
379         "gpu/media/v4l2_video_encode_accelerator.h",
380       ]
381       libs = [
382         "EGL",
383         "GLESv2",
384       ]
385     }
386     if (current_cpu == "arm") {
387       sources += [
388         "gpu/media/tegra_v4l2_device.cc",
389         "gpu/media/tegra_v4l2_device.h",
390       ]
391     }
392     if (current_cpu != "arm") {
393       sources += [
394                    "gpu/media/va_surface.h",
395                    "gpu/media/vaapi_jpeg_decode_accelerator.cc",
396                    "gpu/media/vaapi_jpeg_decode_accelerator.h",
397                    "gpu/media/vaapi_jpeg_decoder.cc",
398                    "gpu/media/vaapi_jpeg_decoder.h",
399                    "gpu/media/vaapi_picture.cc",
400                    "gpu/media/vaapi_picture.h",
401                    "gpu/media/vaapi_video_decode_accelerator.cc",
402                    "gpu/media/vaapi_video_decode_accelerator.h",
403                    "gpu/media/vaapi_video_encode_accelerator.cc",
404                    "gpu/media/vaapi_video_encode_accelerator.h",
405                    "gpu/media/vaapi_wrapper.cc",
406                    "gpu/media/vaapi_wrapper.h",
407                  ] + get_target_outputs(":libva_generate_stubs")
408       configs += [
409         "//third_party/libva:libva_config",
410         "//third_party/libyuv:libyuv_config",
411       ]
412       deps += [
413         ":libva_generate_stubs",
414         "//media",
415         "//third_party/libyuv",
416       ]
417       if (use_x11) {
418         sources += [
419           "gpu/media/vaapi_tfp_picture.cc",
420           "gpu/media/vaapi_tfp_picture.h",
421         ]
422       }
423       if (use_ozone) {
424         sources += [
425           "gpu/media/vaapi_drm_picture.cc",
426           "gpu/media/vaapi_drm_picture.h",
427         ]
428       }
429     }
430   }
432   if (is_win) {
433     sources += [
434       "gpu/media/dxva_video_decode_accelerator.cc",
435       "gpu/media/dxva_video_decode_accelerator.h",
436     ]
437     configs += [ "//third_party/khronos:khronos_headers" ]
438     deps += [ "//ui/gl" ]
439     libs += [
440       "d3d9.lib",
441       "d3d11.lib",
442       "dxva2.lib",
443       "strmiids.lib",
444       "mf.lib",
445       "mfplat.lib",
446       "mfuuid.lib",
447     ]
448     ldflags += [
449       "/DELAYLOAD:d3d9.dll",
450       "/DELAYLOAD:d3d11.dll",
451       "/DELAYLOAD:dxva2.dll",
452       "/DELAYLOAD:mf.dll",
453       "/DELAYLOAD:mfplat.dll",
454     ]
456     # TODO(GYP): extract_xinput action.
457   }
459   if (!is_win || !use_aura) {
460     sources -= [ "cursors/webcursor_aurawin.cc" ]
461   }
463   if (use_seccomp_bpf) {
464     defines += [ "USE_SECCOMP_BPF" ]
465   } else {
466     if (is_linux) {
467       sources -= [
468         "sandbox_linux/bpf_cros_arm_gpu_policy_linux.cc",
469         "sandbox_linux/bpf_cros_arm_gpu_policy_linux.h",
470         "sandbox_linux/bpf_gpu_policy_linux.cc",
471         "sandbox_linux/bpf_gpu_policy_linux.h",
472         "sandbox_linux/bpf_ppapi_policy_linux.cc",
473         "sandbox_linux/bpf_ppapi_policy_linux.h",
474         "sandbox_linux/bpf_renderer_policy_linux.cc",
475         "sandbox_linux/bpf_renderer_policy_linux.h",
476         "sandbox_linux/bpf_utility_policy_linux.cc",
477         "sandbox_linux/bpf_utility_policy_linux.h",
478         "sandbox_linux/sandbox_bpf_base_policy_linux.cc",
479         "sandbox_linux/sandbox_bpf_base_policy_linux.h",
480       ]
481     }
482     if (is_android) {
483       sources -= [
484         "sandbox_linux/android/sandbox_bpf_base_policy_android.cc",
485         "sandbox_linux/android/sandbox_bpf_base_policy_android.h",
486       ]
487     }
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   ]