Blink roll 25b6bd3a7a131ffe68d809546ad1a20707915cdc:3a503f41ae42e5b79cfcd2ff10e65afde...
[chromium-blink-merge.git] / content / common / BUILD.gn
blobdc930713ad2a755287644bc478a46201286061b1
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 && use_x11 && 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 = [ "gpu/media/va.sigs" ]
16     inputs = [ extra_header ]
17     stubs_filename_root = "va_stubs"
19     outputs = [
20       "$target_gen_dir/gpu/media/$stubs_filename_root.cc",
21       "$target_gen_dir/gpu/media/$stubs_filename_root.h",
22     ]
23     args = [
24       "-i", rebase_path("$target_gen_dir/gpu/media", root_build_dir),
25       "-o", rebase_path("$target_gen_dir/gpu/media", root_build_dir),
26       "-t", "posix_stubs",
27       "-e", rebase_path(extra_header, root_build_dir),
28       "-s", stubs_filename_root,
29       "-p", "content/common/gpu/media",
30     ]
32     args += rebase_path(sources, root_build_dir)
33   }
36 if (is_mac) {
37   action("libvt_generate_stubs") {
38     extra_header = "gpu/media/vt_stubs_header.fragment"
40     script = "../../tools/generate_stubs/generate_stubs.py"
41     sources = [ "gpu/media/vt.sig" ]
42     inputs = [ extra_header ]
43     stubs_filename_root = "vt_stubs"
45     outputs = [
46       "$target_gen_dir/gpu/media/$stubs_filename_root.cc",
47       "$target_gen_dir/gpu/media/$stubs_filename_root.h",
48     ]
49     args = [
50       "-i", rebase_path("$target_gen_dir/gpu/media", root_build_dir),
51       "-o", rebase_path("$target_gen_dir/gpu/media", root_build_dir),
52       "-t", "posix_stubs",
53       "-e", rebase_path(extra_header, root_build_dir),
54       "-s", stubs_filename_root,
55       "-p", "content/common/gpu/media",
56     ]
58     args += rebase_path(sources, root_build_dir)
59   }
62 source_set("common") {
63   # Only the public target should depend on this. All other targets (even
64   # internal content ones) should depend on the public one.
65   visibility = [ "//content/public/common:common_sources" ]
67   sources = rebase_path(content_common_gypi_values.private_common_sources,
68                         ".", "//content")
70   configs += [
71     "//content:content_implementation",
72   ]
74   public_deps = [
75     "//gpu/command_buffer/common",
76     "//third_party/WebKit/public:blink_headers",
77   ]
78   deps = [
79     "//base",
80     "//build/util:webkit_version",
81     "//components/tracing",
82     "//gpu/command_buffer/client:gles2_interface",
83     "//gpu/command_buffer/client:gpu_memory_buffer_manager",
84     "//net",
85     "//skia",
86     "//third_party/icu",
87     "//ui/accessibility",
88     "//ui/base",
89     "//ui/events/ipc",
90     "//ui/gfx",
91     "//ui/gfx/geometry",
92     "//ui/gfx/ipc",
93     "//ui/shell_dialogs",
94     "//url",
95     "//third_party/libjingle",
96   ]
98   if (!is_ios) {
99     deps += [
100       "//cc",
101       "//ipc",
102       "//ipc/mojo",
103       # TODO: the dependency on gl_in_process_context should be decoupled from
104       # content and moved to android_webview. See crbug.com/365797.
105       "//gpu/command_buffer/client:gl_in_process_context",
106       "//gpu/command_buffer/client:gles2_c_lib",
107       "//gpu/command_buffer/client:gles2_cmd_helper",
108       "//gpu/command_buffer/client:gles2_implementation",
109       "//gpu/command_buffer/service",
110       "//gpu/ipc",
111       "//gpu/skia_bindings",
112       "//media",
113       "//media:shared_memory_support",
114       "//mojo/edk/system",
115       "//mojo/environment:chromium",
116       "//mojo/public/interfaces/application",
117       "//sandbox",
118       "//storage/browser",
119       "//storage/common",
120       "//third_party/WebKit/public:blink",
121       "//ui/gl",
122       "//webkit/common/gpu",
123     ]
124   }
126   defines = []
127   include_dirs = []
128   libs = []
129   ldflags = []
131   if (is_android && use_seccomp_bpf) {
132     set_sources_assignment_filter([])
133     sources += [
134       "sandbox_linux/sandbox_bpf_base_policy_linux.cc",
135       "sandbox_linux/sandbox_bpf_base_policy_linux.h",
136     ]
137     set_sources_assignment_filter(sources_assignment_filter)
138   }
140   if (is_mac) {
141     sources += [
142       "gpu/client/gpu_memory_buffer_impl_io_surface.cc",
143       "gpu/client/gpu_memory_buffer_impl_io_surface.h",
144     ] + get_target_outputs(":libvt_generate_stubs") 
146     sources -= [
147       "plugin_list_posix.cc",
148     ]
150     deps += [
151       ":libvt_generate_stubs",
152       "//content/app/resources",
153       "//content:resources",
154       "//third_party/WebKit/public:resources",
155     ]
156     libs += [ "QuartzCore.framework" ]
157   }
159   if (is_android) {
160     sources += [
161       "gpu/client/gpu_memory_buffer_impl_surface_texture.cc",
162       "gpu/client/gpu_memory_buffer_impl_surface_texture.h",
163       "gpu/gpu_memory_buffer_factory_surface_texture.cc",
164       "gpu/gpu_memory_buffer_factory_surface_texture.h",
165     ]
167     deps += [
168       "//content/public/android:jni",
169       "//content/public/android:common_aidl",
170     ]
172     libs += [ "android" ]
173   }
175   if (is_ios) {
176     sources -= [ "user_agent.cc" ]
177     assert(false, "Need to add lots of conditions here")
178   }
180   if (use_ozone) {
181     sources -= [
182       "gpu/client/gpu_memory_buffer_impl_linux.cc",
183       "gpu/gpu_memory_buffer_factory_linux.cc",
184     ]
185     deps += [
186       "//ui/ozone:ozone",
187       "//ui/ozone:ozone_base",
188       "//ui/ozone/gpu",
189     ]
190   } else {
191     sources -= [
192       "cursors/webcursor_ozone.cc",
193       "font_list_ozone.cc",
194       "gpu/client/gpu_memory_buffer_impl_ozone.cc",
195       "gpu/client/gpu_memory_buffer_impl_ozone_native_buffer.cc",
196       "gpu/client/gpu_memory_buffer_impl_ozone_native_buffer.h",
197       "gpu/gpu_memory_buffer_factory_ozone.cc",
198     ]
199   }
201   if (!use_aura) {
202     sources -= [ "cursors/webcursor_aura.cc" ]
203   }
205   if (!use_aura || !use_x11) {
206     sources -= [ "cursors/webcursor_aurax11.cc" ]
207   }
209   if (use_pango) {
210     configs += [ "//build/config/linux:pangocairo" ]
211     if (use_ozone) {
212       # If we're using pango, never use this ozone file (it was removed in all
213       # non-ozone cases above).
214       sources -= [ "font_list_ozone.cc" ]
215     }
216   } else {
217     sources -= [
218       "font_list_pango.cc",
219     ]
220   }
222   if (use_x11) {
223     include_dirs += [ "//third_party/khronos" ]
224     configs += [ "//build/config/linux:xcomposite" ]
226     if (cpu_arch != "arm" || !is_chromeos) {
227       sources +=[
228         "gpu/x_util.cc",
229         "gpu/x_util.h",
230       ]
231     }
232   }
234   if (enable_plugins) {
235     deps += [
236       "//ppapi:ppapi_shared",
237     ]
238   } else {
239     sources -= [
240       "pepper_file_util.cc",
241       "pepper_file_util.h",
242       "pepper_messages.h",
243       "pepper_plugin_list.cc",
244       "pepper_plugin_list.h",
245       "pepper_renderer_instance_data.cc",
246       "pepper_renderer_instance_data.h",
247       "plugin_list.cc",
248       "plugin_list.h",
249       "plugin_list_posix.cc",
250       "sandbox_util.cc",
251     ]
252   }
254   if (is_android) {
255     sources += [
256       "gpu/media/android_video_decode_accelerator.cc",
257       "gpu/media/android_video_decode_accelerator.h",
258     ]
260     if (enable_webrtc) {
261       deps += [ "//third_party/libyuv" ]
262     }
263   }
265   if (is_chromeos && use_x11) {
266     if (cpu_arch == "arm") {
267       sources += [
268         "gpu/media/exynos_v4l2_video_device.cc",
269         "gpu/media/exynos_v4l2_video_device.h",
270         "gpu/media/tegra_v4l2_video_device.cc",
271         "gpu/media/tegra_v4l2_video_device.h",
272         "gpu/media/v4l2_image_processor.cc",
273         "gpu/media/v4l2_image_processor.h",
274         "gpu/media/v4l2_video_decode_accelerator.cc",
275         "gpu/media/v4l2_video_decode_accelerator.h",
276         "gpu/media/v4l2_video_device.cc",
277         "gpu/media/v4l2_video_device.h",
278         "gpu/media/v4l2_video_encode_accelerator.cc",
279         "gpu/media/v4l2_video_encode_accelerator.h",
280       ]
281       libs = [ "EGL", "GLESv2" ]
282     } else {  # !arm
283       sources += [
284         "gpu/media/h264_dpb.cc",
285         "gpu/media/h264_dpb.h",
286         "gpu/media/va_surface.h",
287         "gpu/media/vaapi_h264_decoder.cc",
288         "gpu/media/vaapi_h264_decoder.h",
289         "gpu/media/vaapi_video_decode_accelerator.cc",
290         "gpu/media/vaapi_video_decode_accelerator.h",
291         "gpu/media/vaapi_video_encode_accelerator.cc",
292         "gpu/media/vaapi_video_encode_accelerator.h",
293         "gpu/media/vaapi_wrapper.cc",
294         "gpu/media/vaapi_wrapper.h",
295       ] + get_target_outputs(":libva_generate_stubs")
296       configs += [
297         "//third_party/libva:libva_config",
298         "//third_party/libyuv:libyuv_config",
299       ]
300       deps += [
301         ":libva_generate_stubs",
302         "//media",
303         "//third_party/libyuv",
304       ]
305     }
306   }
308   if (is_win) {
309     sources += [
310       "gpu/media/dxva_video_decode_accelerator.cc",
311       "gpu/media/dxva_video_decode_accelerator.h",
312     ]
313     include_dirs += [ "//third_party/khronos" ]
314     deps += [
315       "//ui/gl",
316     ]
318     # TODO(GYP): extract_xinput action.
319   }
321   if (!is_win || !use_aura) {
322     sources -= [ "cursors/webcursor_aurawin.cc" ]
323   }
325   if (use_seccomp_bpf) {
326     defines += [ "USE_SECCOMP_BPF" ]
327   } else {
328     if (is_linux) {
329       sources -= [
330         "sandbox_linux/bpf_cros_arm_gpu_policy_linux.cc",
331         "sandbox_linux/bpf_cros_arm_gpu_policy_linux.h",
332         "sandbox_linux/bpf_gpu_policy_linux.cc",
333         "sandbox_linux/bpf_gpu_policy_linux.h",
334         "sandbox_linux/bpf_ppapi_policy_linux.cc",
335         "sandbox_linux/bpf_ppapi_policy_linux.h",
336         "sandbox_linux/bpf_renderer_policy_linux.cc",
337         "sandbox_linux/bpf_renderer_policy_linux.h",
338         "sandbox_linux/bpf_utility_policy_linux.cc",
339         "sandbox_linux/bpf_utility_policy_linux.h",
340         "sandbox_linux/sandbox_bpf_base_policy_linux.cc",
341         "sandbox_linux/sandbox_bpf_base_policy_linux.h",
342       ]
343     }
344     if (is_android) {
345       sources -= [
346         "sandbox_linux/android/sandbox_bpf_base_policy_android.cc",
347         "sandbox_linux/android/sandbox_bpf_base_policy_android.h",
348       ]
349     }
350   }
353 mojom("mojo_bindings") {
354   sources = [
355     "geolocation_service.mojom",
356     "permission_service.mojom",
357     "render_frame_setup.mojom",
358   ]
360   deps = [
361     "//content/public/common:mojo_bindings",
362     "//mojo/public/interfaces/application:application",
363   ]