Update To 11.40.268.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
7 if (is_android) {
8   import("//build/config/android/config.gni")
9   import("//build/config/android/rules.gni")
10 }
11
12 # Several targets want to include this header file, and some of them are
13 # child dependencies of "gfx". Therefore, we separate it out here so multiple
14 # targets can all have a dependency for header checking purposes without
15 # creating circular dependencies.
16 source_set("gfx_export") {
17   sources = [
18     "gfx_export.h",
19   ]
20 }
21
22 component("gfx") {
23   sources = [
24     "android/device_display_info.cc",
25     "android/device_display_info.h",
26     "android/gfx_jni_registrar.cc",
27     "android/gfx_jni_registrar.h",
28     "android/java_bitmap.cc",
29     "android/java_bitmap.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_notimplemented.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.mm",
72     "color_profile_win.cc",
73     "color_utils.cc",
74     "color_utils.h",
75     "display.cc",
76     "display.h",
77     "display_change_notifier.cc",
78     "display_change_notifier.h",
79     "display_observer.cc",
80     "display_observer.h",
81     "favicon_size.cc",
82     "favicon_size.h",
83     "font.cc",
84     "font.h",
85     "font_fallback.h",
86     "font_fallback_linux.cc",
87     "font_fallback_mac.cc",
88     "font_fallback_win.cc",
89     "font_fallback_win.h",
90     "font_list.cc",
91     "font_list.h",
92     "font_list_impl.cc",
93     "font_list_impl.h",
94     "font_render_params.cc",
95     "font_render_params.h",
96     "font_render_params_android.cc",
97     "font_render_params_linux.cc",
98     "font_render_params_mac.cc",
99     "font_render_params_win.cc",
100     "frame_time.h",
101     "gdi_util.cc",
102     "gdi_util.h",
103     "gfx_paths.cc",
104     "gfx_paths.h",
105     "gpu_memory_buffer.cc",
106     "gpu_memory_buffer.h",
107     "icon_util.cc",
108     "icon_util.h",
109     "image/canvas_image_source.cc",
110     "image/canvas_image_source.h",
111     "image/image.cc",
112     "image/image.h",
113     "image/image_family.cc",
114     "image/image_family.h",
115     "image/image_ios.mm",
116     "image/image_mac.mm",
117     "image/image_png_rep.cc",
118     "image/image_png_rep.h",
119     "image/image_skia.cc",
120     "image/image_skia.h",
121     "image/image_skia_operations.cc",
122     "image/image_skia_operations.h",
123     "image/image_skia_rep.cc",
124     "image/image_skia_rep.h",
125     "image/image_skia_source.h",
126     "image/image_skia_util_ios.h",
127     "image/image_skia_util_ios.mm",
128     "image/image_skia_util_mac.h",
129     "image/image_skia_util_mac.mm",
130     "image/image_util.cc",
131     "image/image_util.h",
132     "image/image_util_ios.mm",
133     "interpolated_transform.cc",
134     "interpolated_transform.h",
135     "linux_font_delegate.cc",
136     "linux_font_delegate.h",
137     "mac/coordinate_conversion.h",
138     "mac/coordinate_conversion.mm",
139     "mac/scoped_ns_disable_screen_updates.h",
140     "native_widget_types.h",
141     "nine_image_painter.cc",
142     "nine_image_painter.h",
143     "path.cc",
144     "path.h",
145     "path_aura.cc",
146     "path_win.cc",
147     "path_win.h",
148     "path_x11.cc",
149     "path_x11.h",
150     "platform_font.h",
151     "platform_font_android.cc",
152     "platform_font_ios.h",
153     "platform_font_ios.mm",
154     "platform_font_mac.h",
155     "platform_font_mac.mm",
156     "platform_font_win.cc",
157     "platform_font_win.h",
158     "range/range.cc",
159     "range/range.h",
160     "range/range_mac.mm",
161     "range/range_win.cc",
162     "scoped_canvas.h",
163     "scoped_cg_context_save_gstate_mac.h",
164     "scoped_ns_graphics_context_save_gstate_mac.h",
165     "scoped_ns_graphics_context_save_gstate_mac.mm",
166     "scoped_ui_graphics_push_context_ios.h",
167     "scoped_ui_graphics_push_context_ios.mm",
168     "screen.cc",
169     "screen.h",
170     "screen_android.cc",
171     "screen_aura.cc",
172     "screen_ios.mm",
173     "screen_mac.mm",
174     "screen_win.cc",
175     "screen_win.h",
176     "scrollbar_size.cc",
177     "scrollbar_size.h",
178     "selection_model.cc",
179     "selection_model.h",
180     "sequential_id_generator.cc",
181     "sequential_id_generator.h",
182     "shadow_value.cc",
183     "shadow_value.h",
184     "skbitmap_operations.cc",
185     "skbitmap_operations.h",
186     "skia_util.cc",
187     "skia_util.h",
188     "switches.cc",
189     "switches.h",
190     "sys_color_change_listener.cc",
191     "sys_color_change_listener.h",
192     "text_constants.h",
193     "text_elider.cc",
194     "text_elider.h",
195     "text_utils.cc",
196     "text_utils.h",
197     "text_utils_android.cc",
198     "text_utils_ios.mm",
199     "transform.cc",
200     "transform.h",
201     "transform_util.cc",
202     "transform_util.h",
203     "ui_gfx_exports.cc",
204     "utf16_indexing.cc",
205     "utf16_indexing.h",
206     "vsync_provider.h",
207     "win/direct_write.cc",
208     "win/direct_write.h",
209     "win/dpi.cc",
210     "win/dpi.h",
211     "win/hwnd_util.cc",
212     "win/hwnd_util.h",
213     "win/scoped_set_map_mode.h",
214     "win/singleton_hwnd.cc",
215     "win/singleton_hwnd.h",
216     "win/window_impl.cc",
217     "win/window_impl.h",
218   ]
219
220   defines = [ "GFX_IMPLEMENTATION" ]
221
222   deps = [
223     ":gfx_export",
224     "//base:i18n",
225     "//base:base_static",
226     "//base/third_party/dynamic_annotations",
227     "//skia",
228     "//third_party/harfbuzz-ng",
229     "//third_party/libpng",
230     "//third_party/zlib",
231     "//ui/gfx/geometry",
232   ]
233   public_deps = [
234     "//base",
235     "//skia",
236     "//third_party/icu",
237   ]
238
239   # Text rendering conditions (complicated so separated out).
240   if (is_android || is_ios) {
241     # We don't support RenderText on these platforms.
242   } else {
243     # These text rendering files are supported everywhere text rendering is.
244     sources += [
245       "render_text.cc",
246       "render_text.h",
247       "render_text_harfbuzz.cc",
248       "render_text_harfbuzz.h",
249       "text_utils_skia.cc",
250     ]
251     # These are the "native" rendering routines, only one should apply.
252     if (is_win) {
253       sources += [ "render_text_win.cc" ]
254     } else if (is_mac) {
255       sources += [ "render_text_mac.cc" ]
256     } else if (use_pango) {
257       sources += [ "render_text_pango.cc" ]
258     } else if (use_ozone) {
259       sources += [ "render_text_ozone.cc" ]
260     }
261   }
262
263   # iOS.
264   if (is_ios) {
265     sources -= [
266       "codec/jpeg_codec.cc",
267       "codec/jpeg_codec.h",
268     ]
269   } else {
270     deps += [ "//third_party:jpeg" ]
271   }
272
273   # Android.
274   if (is_android) {
275     sources -= [
276       "animation/throb_animation.cc",
277       "canvas_skia.cc",
278       "selection_model.cc",
279     ]
280
281     if (use_aura) {
282       sources -= [ "screen_android.cc" ]
283     } else {
284       sources -= [ "path.cc" ]
285     }
286
287     # TODO(GYP) re-enable when base_java exists.
288     #if (!is_android_webview_build) {
289     #  deps += [ "//base:base_java" ]
290     #}
291
292     if (!is_debug) {
293       configs -= [ "//build/config/compiler:optimize" ]
294       configs += [ "//build/config/compiler:optimize_max" ]
295     }
296
297     deps += [ ":gfx_jni_headers" ]
298     libs = [
299       "android",
300       "jnigraphics",
301     ]
302   } else {
303     sources -= [ "canvas_notimplemented.cc" ]
304   }
305
306   # Windows.
307   if (is_win) {
308     cflags = [
309       "/wd4267",  # TODO(jschuh): C4267: http://crbug.com/167187 size_t -> int.
310       "/wd4324",  # Structure was padded due to __declspec(align()), which is
311                   # uninteresting.
312     ]
313   } else {
314     sources -= [
315       "gdi_util.cc",
316       "gdi_util.h",
317       "icon_util.cc",
318       "icon_util.h",
319     ]
320   }
321
322   # Linux.
323   if (is_linux) {
324     configs += [ "//build/config/linux:fontconfig" ]
325   }
326
327   # Ozone stuff.
328   if (use_ozone) {
329     sources += [
330       "platform_font_ozone.cc",
331     ]
332   }
333
334   if (!use_aura) {
335     sources -= [
336       "nine_image_painter.cc",
337       "nine_image_painter.h",
338       "path_aura.cc",
339       "screen_aura.cc",
340     ]
341   }
342
343   if (use_x11) {
344     deps += [
345       "//ui/gfx/x",
346     ]
347     configs += [
348       "//build/config/linux:x11",
349     ]
350   } else {
351     sources -= [
352       "path_x11.cc",
353     ]
354   }
355
356   if (use_pango) {
357     sources += [
358       "pango_util.cc",
359       "pango_util.h",
360       "platform_font_pango.cc",
361       "platform_font_pango.h",
362     ]
363     configs += [ "//build/config/linux:pangocairo" ]
364   }
365   if (use_pango && use_ozone) {
366     sources -= [
367       "platform_font_ozone.cc",
368     ]
369   }
370 }
371
372 # Looking for gfx_geometry? It's //ui/gfx/geometry:geometry
373
374 source_set("test_support") {
375   testonly = true
376   sources = [
377     "image/image_unittest_util.cc",
378     "image/image_unittest_util.h",
379     "image/image_unittest_util_ios.mm",
380     "image/image_unittest_util_mac.mm",
381     "test/fontconfig_util_linux.cc",
382     "test/fontconfig_util_linux.h",
383     "test/gfx_util.cc",
384     "test/gfx_util.h",
385     "test/ui_cocoa_test_helper.h",
386     "test/ui_cocoa_test_helper.mm",
387   ]
388
389   public_deps = [
390     ":gfx",
391   ]
392
393   deps = [
394     "//base",
395     "//base/test:test_support",
396     "//skia",
397     "//testing/gtest",
398     "//ui/gfx/geometry",
399   ]
400
401   if (is_ios) {
402     # The cocoa files don't apply to iOS.
403     sources -= [
404       "test/ui_cocoa_test_helper.h",
405       "test/ui_cocoa_test_helper.mm",
406     ]
407   }
408   if (is_linux) {
409     configs += [ "//build/config/linux:fontconfig" ]
410   }
411 }
412
413 test("gfx_unittests") {
414   sources = [
415     "font_unittest.cc",
416     "image/image_skia_unittest.cc",
417     "image/image_unittest.cc",
418     "screen_unittest.cc",
419     "test/run_all_unittests.cc",
420     "text_elider_unittest.cc",
421     "text_utils_unittest.cc",
422   ]
423
424   if (!is_ios) {
425     sources += [
426       "animation/animation_container_unittest.cc",
427       "animation/animation_unittest.cc",
428       "animation/multi_animation_unittest.cc",
429       "animation/slide_animation_unittest.cc",
430       "animation/tween_unittest.cc",
431       "blit_unittest.cc",
432       "break_list_unittest.cc",
433       "canvas_unittest.cc",
434       "canvas_unittest_mac.mm",
435       "codec/jpeg_codec_unittest.cc",
436       "codec/png_codec_unittest.cc",
437       "color_analysis_unittest.cc",
438       "color_profile_mac_unittest.mm",
439       "color_utils_unittest.cc",
440       "display_change_notifier_unittest.cc",
441       "display_unittest.cc",
442       "font_list_unittest.cc",
443       "geometry/box_unittest.cc",
444       "geometry/cubic_bezier_unittest.cc",
445       "geometry/insets_unittest.cc",
446       "geometry/matrix3_unittest.cc",
447       "geometry/point_unittest.cc",
448       "geometry/point3_unittest.cc",
449       "geometry/quad_unittest.cc",
450       "geometry/r_tree_unittest.cc",
451       "geometry/rect_unittest.cc",
452       "geometry/safe_integer_conversions_unittest.cc",
453       "geometry/scroll_offset_unittest.cc",
454       "geometry/size_unittest.cc",
455       "geometry/vector2d_unittest.cc",
456       "geometry/vector3d_unittest.cc",
457       "mac/coordinate_conversion_unittest.mm",
458       "platform_font_mac_unittest.mm",
459       "range/range_mac_unittest.mm",
460       "range/range_unittest.cc",
461       "range/range_win_unittest.cc",
462       "render_text_unittest.cc",
463       "sequential_id_generator_unittest.cc",
464       "shadow_value_unittest.cc",
465       "skbitmap_operations_unittest.cc",
466       "skrect_conversion_unittest.cc",
467       "transform_util_unittest.cc",
468       "utf16_indexing_unittest.cc",
469     ]
470   }
471
472   deps = [
473     ":gfx",
474     ":test_support",
475     "//base",
476     "//base/test:test_support",
477     "//skia",
478     "//third_party/icu:icuuc",
479     "//third_party/libpng",
480     "//third_party/zlib",
481     "//testing/gtest",
482     "//ui/base",
483     "//ui/gfx/geometry",
484     "//ui/resources:ui_test_pak",
485   ]
486
487   if (use_pango) {
488     sources += [
489       "font_render_params_linux_unittest.cc",
490       "platform_font_pango_unittest.cc",
491     ]
492     configs += [
493       "//build/config/linux:pangocairo",
494       "//build/config/linux:pangoft2",
495     ]
496   }
497
498   if (!is_mac && !is_ios) {
499     sources += [
500       "transform_unittest.cc",
501       "interpolated_transform_unittest.cc",
502     ]
503   }
504
505   if (use_ozone && !use_pango) {
506     sources -= [
507       "canvas_unittest.cc",
508       "font_list_unittest.cc",
509       "font_unittest.cc",
510       "render_text_unittest.cc",
511       "text_elider_unittest.cc",
512     ]
513   }
514
515   if (is_android) {
516     sources -= [
517       # Do not run display_change_notifier_unittest.cc on Android because it
518       # does not compile display_observer.cc
519       "display_change_notifier_unittest.cc",
520     ]
521
522     deps += [
523       #'../../testing/android/native_test.gyp:native_test_native_code', TODO(GYP)
524     ]
525   }
526
527   if (is_android || is_ios) {
528     sources -= [
529       "render_text_unittest.cc",
530     ]
531   }
532
533   if (use_aura) {
534     sources -= [
535       "screen_unittest.cc",
536     ]
537   }
538
539   if (is_win) {
540     sources += [
541       "color_profile_win_unittest.cc",
542       "font_fallback_win_unittest.cc",
543       "icon_util_unittest.cc",
544       "icon_util_unittests.rc",
545       "platform_font_win_unittest.cc",
546     ]
547
548     ldflags = [
549       "/DELAYLOAD:d2d1.dll",
550       "/DELAYLOAD:d3d10_1.dll",
551     ]
552
553     libs = [
554       "d2d1.lib",
555       "d3d10_1.lib",
556       "imm32.lib",
557       "oleacc.lib",
558     ]
559
560     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
561     cflags = [ "/wd4267" ]
562   }
563 }
564
565 if (is_android) {
566   generate_jni("gfx_jni_headers") {
567     sources = [
568       "../android/java/src/org/chromium/ui/gfx/BitmapHelper.java",
569       "../android/java/src/org/chromium/ui/gfx/DeviceDisplayInfo.java",
570       "../android/java/src/org/chromium/ui/gfx/ViewConfigurationHelper.java",
571     ]
572     jni_package = "gfx"
573   }
574 }