Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / ui / gfx / BUILD.gn
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.
4
5 import("//build/config/ui.gni")
6 if (is_android) {
7   import("//build/config/android/config.gni")
8 }
9
10 # Several targets want to include this header file, and some of them are
11 # child dependencies of "gfx". Therefore, we separate it out here so multiple
12 # targets can all have a dependency for header checking purposes without
13 # creating circular dependencies.
14 source_set("gfx_export") {
15   sources = [
16     "gfx_export.h",
17   ]
18 }
19
20 component("gfx") {
21   sources = [
22     "android/device_display_info.cc",
23     "android/device_display_info.h",
24     "android/gfx_jni_registrar.cc",
25     "android/gfx_jni_registrar.h",
26     "android/java_bitmap.cc",
27     "android/java_bitmap.h",
28     "android/scroller.cc",
29     "android/scroller.h",
30     "android/shared_device_display_info.cc",
31     "android/shared_device_display_info.h",
32     "android/view_configuration.cc",
33     "android/view_configuration.h",
34     "animation/animation.cc",
35     "animation/animation.h",
36     "animation/animation_container.cc",
37     "animation/animation_container.h",
38     "animation/animation_container_element.h",
39     "animation/animation_container_observer.h",
40     "animation/animation_delegate.h",
41     "animation/linear_animation.cc",
42     "animation/linear_animation.h",
43     "animation/multi_animation.cc",
44     "animation/multi_animation.h",
45     "animation/slide_animation.cc",
46     "animation/slide_animation.h",
47     "animation/throb_animation.cc",
48     "animation/throb_animation.h",
49     "animation/tween.cc",
50     "animation/tween.h",
51     "blit.cc",
52     "blit.h",
53     "break_list.h",
54     "canvas.cc",
55     "canvas.h",
56     "canvas_android.cc",
57     "canvas_paint_mac.h",
58     "canvas_paint_mac.mm",
59     "canvas_paint_win.cc",
60     "canvas_paint_win.h",
61     "canvas_skia.cc",
62     "canvas_skia_paint.h",
63     "codec/jpeg_codec.cc",
64     "codec/jpeg_codec.h",
65     "codec/png_codec.cc",
66     "codec/png_codec.h",
67     "color_analysis.cc",
68     "color_analysis.h",
69     "color_profile.cc",
70     "color_profile.h",
71     "color_profile_mac.cc",
72     "color_profile_win.cc",
73     "color_utils.cc",
74     "color_utils.h",
75     "display.cc",
76     "display.h",
77     "display_observer.cc",
78     "display_observer.h",
79     "favicon_size.cc",
80     "favicon_size.h",
81     "font.cc",
82     "font.h",
83     "font_fallback_win.cc",
84     "font_fallback_win.h",
85     "font_list.cc",
86     "font_list.h",
87     "font_list_impl.cc",
88     "font_list_impl.h",
89     "font_render_params_android.cc",
90     "font_render_params_linux.cc",
91     "font_render_params_linux.h",
92     "font_smoothing_win.cc",
93     "font_smoothing_win.h",
94     "frame_time.h",
95     "gdi_util.cc",
96     "gdi_util.h",
97     "gfx_paths.cc",
98     "gfx_paths.h",
99     "gpu_memory_buffer.cc",
100     "gpu_memory_buffer.h",
101     "icon_util.cc",
102     "icon_util.h",
103     "image/canvas_image_source.cc",
104     "image/canvas_image_source.h",
105     "image/image.cc",
106     "image/image.h",
107     "image/image_family.cc",
108     "image/image_family.h",
109     "image/image_ios.mm",
110     "image/image_mac.mm",
111     "image/image_png_rep.cc",
112     "image/image_png_rep.h",
113     "image/image_skia.cc",
114     "image/image_skia.h",
115     "image/image_skia_operations.cc",
116     "image/image_skia_operations.h",
117     "image/image_skia_rep.cc",
118     "image/image_skia_rep.h",
119     "image/image_skia_source.h",
120     "image/image_skia_util_ios.h",
121     "image/image_skia_util_ios.mm",
122     "image/image_skia_util_mac.h",
123     "image/image_skia_util_mac.mm",
124     "image/image_util.cc",
125     "image/image_util.h",
126     "image/image_util_ios.mm",
127     "interpolated_transform.cc",
128     "interpolated_transform.h",
129     "linux_font_delegate.cc",
130     "linux_font_delegate.h",
131     "mac/scoped_ns_disable_screen_updates.h",
132     "native_widget_types.h",
133     "nine_image_painter.cc",
134     "nine_image_painter.h",
135     "ozone/dri/dri_skbitmap.cc",
136     "ozone/dri/dri_skbitmap.h",
137     "ozone/dri/dri_surface.cc",
138     "ozone/dri/dri_surface.h",
139     "ozone/dri/dri_surface_factory.cc",
140     "ozone/dri/dri_surface_factory.h",
141     "ozone/dri/dri_vsync_provider.cc",
142     "ozone/dri/dri_vsync_provider.h",
143     "ozone/dri/dri_wrapper.cc",
144     "ozone/dri/dri_wrapper.h",
145     "ozone/dri/hardware_display_controller.cc",
146     "ozone/dri/hardware_display_controller.h",
147     "ozone/impl/file_surface_factory.cc",
148     "ozone/impl/file_surface_factory.h",
149     "ozone/surface_factory_ozone.cc",
150     "ozone/surface_factory_ozone.h",
151     "ozone/surface_ozone.h",
152     "ozone/overlay_candidates_ozone.cc",
153     "ozone/overlay_candidates_ozone.h",
154     "pango_util.cc",
155     "pango_util.h",
156     "path.cc",
157     "path.h",
158     "path_aura.cc",
159     "path_win.cc",
160     "path_win.h",
161     "path_x11.cc",
162     "path_x11.h",
163     "platform_font.h",
164     "platform_font_android.cc",
165     "platform_font_ios.h",
166     "platform_font_ios.mm",
167     "platform_font_mac.h",
168     "platform_font_mac.mm",
169     "platform_font_ozone.cc",
170     "platform_font_pango.cc",
171     "platform_font_pango.h",
172     "platform_font_win.cc",
173     "platform_font_win.h",
174     "range/range.cc",
175     "range/range.h",
176     "range/range_mac.mm",
177     "range/range_win.cc",
178     "render_text.cc",
179     "render_text.h",
180     "render_text_mac.cc",
181     "render_text_mac.h",
182     "render_text_ozone.cc",
183     "render_text_pango.cc",
184     "render_text_pango.h",
185     "render_text_win.cc",
186     "render_text_win.h",
187     "scoped_canvas.h",
188     "scoped_cg_context_save_gstate_mac.h",
189     "scoped_ns_graphics_context_save_gstate_mac.h",
190     "scoped_ns_graphics_context_save_gstate_mac.mm",
191     "scoped_ui_graphics_push_context_ios.h",
192     "scoped_ui_graphics_push_context_ios.mm",
193     "screen.cc",
194     "screen.h",
195     "screen_android.cc",
196     "screen_aura.cc",
197     "screen_ios.mm",
198     "screen_mac.mm",
199     "screen_win.cc",
200     "screen_win.h",
201     "scrollbar_size.cc",
202     "scrollbar_size.h",
203     "selection_model.cc",
204     "selection_model.h",
205     "sequential_id_generator.cc",
206     "sequential_id_generator.h",
207     "shadow_value.cc",
208     "shadow_value.h",
209     "skbitmap_operations.cc",
210     "skbitmap_operations.h",
211     "skia_util.cc",
212     "skia_util.h",
213     "switches.cc",
214     "switches.h",
215     "sys_color_change_listener.cc",
216     "sys_color_change_listener.h",
217     "text_constants.h",
218     "text_elider.cc",
219     "text_elider.h",
220     "text_utils.cc",
221     "text_utils.h",
222     "text_utils_android.cc",
223     "text_utils_ios.mm",
224     "text_utils_skia.cc",
225     "transform.cc",
226     "transform.h",
227     "transform_util.cc",
228     "transform_util.h",
229     "ui_gfx_exports.cc",
230     "utf16_indexing.cc",
231     "utf16_indexing.h",
232     "vsync_provider.h",
233     "win/dpi.cc",
234     "win/dpi.h",
235     "win/hwnd_util.cc",
236     "win/hwnd_util.h",
237     "win/scoped_set_map_mode.h",
238     "win/singleton_hwnd.cc",
239     "win/singleton_hwnd.h",
240     "win/window_impl.cc",
241     "win/window_impl.h",
242   ]
243
244   defines = [ "GFX_IMPLEMENTATION" ]
245
246   deps = [
247     ":gfx_export",
248     "//base",
249     "//base:i18n",
250     "//base:base_static",
251     "//base/third_party/dynamic_annotations",
252     "//skia",
253     "//third_party/icu:icui18n",
254     "//third_party/icu:icuuc",
255     "//third_party/libpng",
256     "//third_party/zlib",
257     "//ui/gfx/geometry",
258   ]
259
260   # iOS.
261   if (is_ios) {
262     sources -= [
263       "codec/jpeg_codec.cc",
264       "codec/jpeg_codec.h",
265     ]
266   } else {
267     deps += [ "//third_party:jpeg" ]
268   }
269
270   # Android.
271   if (is_android) {
272     sources -= [
273       "animation/throb_animation.cc",
274       "canvas_skia.cc",
275       "display_observer.cc",
276       "selection_model.cc",
277     ]
278
279     if (use_aura) {
280       sources -= [ "screen_android.cc" ]
281     } else {
282       sources -= [ "path.cc" ]
283     }
284
285     if (!is_android_webview_build) {
286       deps += [ "//base:base_java" ]
287     }
288
289     deps += [ ":jni_headers" ]
290     libs = [
291       "android",
292       "jnigraphics",
293     ]
294   }
295
296   if (is_android || is_ios) {
297     sources -= [
298       "render_text.cc",
299       "render_text.h",
300       "text_utils_skia.cc",
301     ]
302   }
303
304   # Windows.
305   if (is_win) {
306     cflags = [
307       "/wd4267",  # TODO(jschuh): C4267: http://crbug.com/167187 size_t -> int.
308       "/wd4324",  # Structure was padded due to __declspec(align()), which is
309                   # uninteresting.
310     ]
311   } else {
312     sources -= [
313       "gdi_util.cc",
314       "gdi_util.h",
315       "icon_util.cc",
316       "icon_util.h",
317     ]
318   }
319
320   # Linux.
321   if (is_linux) {
322     configs += [ "//build/config/linux:fontconfig" ]
323   }
324
325   # Ozone stuff.
326   if (!use_ozone) {
327     sources -= [
328       "ozone/impl/file_surface_factory.cc",
329       "ozone/impl/file_surface_factory.h",
330       "ozone/surface_factory_ozone.cc",
331       "ozone/surface_factory_ozone.h",
332       "ozone/surface_ozone.h",
333       "ozone/overlay_candidates_ozone.cc",
334       "ozone/overlay_candidates_ozone.h",
335     ]
336   }
337   if (ozone_platform_dri) {
338     configs += [ "//build/config/linux:dridrm" ]
339   } else {
340     sources -= [
341       "ozone/dri/dri_skbitmap.cc",
342       "ozone/dri/dri_skbitmap.h",
343       "ozone/dri/dri_surface.cc",
344       "ozone/dri/dri_surface.h",
345       "ozone/dri/dri_surface_factory.cc",
346       "ozone/dri/dri_surface_factory.h",
347       "ozone/dri/dri_vsync_provider.cc",
348       "ozone/dri/dri_vsync_provider.h",
349       "ozone/dri/dri_wrapper.cc",
350       "ozone/dri/dri_wrapper.h",
351       "ozone/dri/hardware_display_controller.cc",
352       "ozone/dri/hardware_display_controller.h",
353     ]
354   }
355
356   if (!use_aura) {
357     sources -= [
358       "nine_image_painter.cc",
359       "nine_image_painter.h",
360       "path_aura.cc",
361     ]
362   }
363
364   if (use_x11) {
365     deps += [
366       ":gfx_x11",
367     ]
368   } else {
369     sources -= [
370       "path_x11.cc",
371     ]
372   }
373
374   if (use_pango) {
375     sources -= [
376       "platform_font_ozone.cc",
377       "render_text_ozone.cc",
378     ]
379     configs += [ "//build/config/linux:pangocairo" ]
380   } else {
381     sources -= [
382       "pango_util.cc",
383       "pango_util.h",
384       "platform_font_pango.cc",
385       "platform_font_pango.h",
386       "render_text_pango.cc",
387       "render_text_pango.h",
388     ]
389   }
390 }
391
392 component("gfx_geometry") {
393   sources = [
394     "geometry/box_f.cc",
395     "geometry/box_f.h",
396     "geometry/cubic_bezier.h",
397     "geometry/cubic_bezier.cc",
398     "geometry/insets.cc",
399     "geometry/insets.h",
400     "geometry/insets_base.h",
401     "geometry/insets_f.cc",
402     "geometry/insets_f.h",
403     "geometry/matrix3_f.cc",
404     "geometry/matrix3_f.h",
405     "geometry/point.cc",
406     "geometry/point.h",
407     "geometry/point3_f.cc",
408     "geometry/point3_f.h",
409     "geometry/point_base.h",
410     "geometry/point_conversions.cc",
411     "geometry/point_conversions.h",
412     "geometry/point_f.cc",
413     "geometry/point_f.h",
414     "geometry/quad_f.cc",
415     "geometry/quad_f.h",
416     "geometry/rect.cc",
417     "geometry/rect.h",
418     "geometry/rect_base.h",
419     "geometry/rect_base_impl.h",
420     "geometry/rect_conversions.cc",
421     "geometry/rect_conversions.h",
422     "geometry/rect_f.cc",
423     "geometry/rect_f.h",
424     "geometry/r_tree.cc",
425     "geometry/r_tree.h",
426     "geometry/safe_integer_conversions.h",
427     "geometry/size.cc",
428     "geometry/size.h",
429     "geometry/size_base.h",
430     "geometry/size_conversions.cc",
431     "geometry/size_conversions.h",
432     "geometry/size_f.cc",
433     "geometry/size_f.h",
434     "geometry/vector2d.cc",
435     "geometry/vector2d.h",
436     "geometry/vector2d_conversions.cc",
437     "geometry/vector2d_conversions.h",
438     "geometry/vector2d_f.cc",
439     "geometry/vector2d_f.h",
440     "geometry/vector3d_f.cc",
441     "geometry/vector3d_f.h",
442   ]
443   defines = [ "GFX_IMPLEMENTATION" ]
444   deps = [ "//base" ]
445 }
446
447 source_set("gfx_test_support") {
448   sources = [
449     "test/gfx_util.cc",
450     "test/gfx_util.h",
451     "test/ui_cocoa_test_helper.h",
452     "test/ui_cocoa_test_helper.mm",
453   ]
454
455   deps = [
456     "//base",
457     "//base/test:test_support",
458     "//skia",
459     "//testing/gtest",
460   ]
461
462   if (is_ios) {
463     # The cocoa files don't apply to iOS.
464     sources -= [
465       "test/ui_cocoa_test_helper.h",
466       "test/ui_cocoa_test_helper.mm",
467     ]
468   }
469 }
470
471 test("gfx_unittests") {
472   sources = [
473     "geometry/box_unittest.cc",
474     "geometry/cubic_bezier_unittest.cc",
475     "geometry/insets_unittest.cc",
476     "geometry/matrix3_unittest.cc",
477     "geometry/point_unittest.cc",
478     "geometry/point3_unittest.cc",
479     "geometry/quad_unittest.cc",
480     "geometry/rect_unittest.cc",
481     "geometry/safe_integer_conversions_unittest.cc",
482     "geometry/size_unittest.cc",
483     "geometry/vector2d_unittest.cc",
484     "geometry/vector3d_unittest.cc",
485     "range/range_unittest.cc",
486   ]
487
488   deps = [
489     ":gfx",
490     "//base",
491     "//base/test:run_all_unittests",
492     "//base/test:run_all_unittests",
493     "//testing/gtest",
494     "//ui/gfx/geometry",
495   ]
496 }
497
498 if (is_android) {
499   # TODO(brettw) gfx_jni_headers
500 }
501
502 if (use_x11) {
503   component("gfx_x11") {
504     sources = [
505       "x/x11_atom_cache.cc",
506       "x/x11_atom_cache.h",
507       "x/x11_error_tracker.cc",
508       "x/x11_error_tracker.h",
509       "x/x11_types.cc",
510       "x/x11_types.h",
511     ]
512
513     configs += [ "//build/config/linux:x11" ]
514
515     deps = [
516       ":gfx_export",
517       "//base"
518     ]
519   }
520 }