Upstream version 9.38.198.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/scroller.cc",
31     "android/scroller.h",
32     "android/shared_device_display_info.cc",
33     "android/shared_device_display_info.h",
34     "android/view_configuration.cc",
35     "android/view_configuration.h",
36     "animation/animation.cc",
37     "animation/animation.h",
38     "animation/animation_container.cc",
39     "animation/animation_container.h",
40     "animation/animation_container_element.h",
41     "animation/animation_container_observer.h",
42     "animation/animation_delegate.h",
43     "animation/linear_animation.cc",
44     "animation/linear_animation.h",
45     "animation/multi_animation.cc",
46     "animation/multi_animation.h",
47     "animation/slide_animation.cc",
48     "animation/slide_animation.h",
49     "animation/throb_animation.cc",
50     "animation/throb_animation.h",
51     "animation/tween.cc",
52     "animation/tween.h",
53     "blit.cc",
54     "blit.h",
55     "break_list.h",
56     "canvas.cc",
57     "canvas.h",
58     "canvas_notimplemented.cc",
59     "canvas_paint_mac.h",
60     "canvas_paint_mac.mm",
61     "canvas_paint_win.cc",
62     "canvas_paint_win.h",
63     "canvas_skia.cc",
64     "canvas_skia_paint.h",
65     "codec/jpeg_codec.cc",
66     "codec/jpeg_codec.h",
67     "codec/png_codec.cc",
68     "codec/png_codec.h",
69     "color_analysis.cc",
70     "color_analysis.h",
71     "color_profile.cc",
72     "color_profile.h",
73     "color_profile_mac.mm",
74     "color_profile_win.cc",
75     "color_utils.cc",
76     "color_utils.h",
77     "display.cc",
78     "display.h",
79     "display_change_notifier.cc",
80     "display_change_notifier.h",
81     "display_observer.cc",
82     "display_observer.h",
83     "favicon_size.cc",
84     "favicon_size.h",
85     "font.cc",
86     "font.h",
87     "font_fallback.h",
88     "font_fallback_linux.cc",
89     "font_fallback_mac.cc",
90     "font_fallback_win.cc",
91     "font_fallback_win.h",
92     "font_list.cc",
93     "font_list.h",
94     "font_list_impl.cc",
95     "font_list_impl.h",
96     "font_render_params_android.cc",
97     "font_render_params_linux.cc",
98     "font_render_params_win.cc",
99     "font_render_params.cc",
100     "font_render_params.h",
101     "frame_time.h",
102     "gdi_util.cc",
103     "gdi_util.h",
104     "gfx_paths.cc",
105     "gfx_paths.h",
106     "gpu_memory_buffer.cc",
107     "gpu_memory_buffer.h",
108     "icon_util.cc",
109     "icon_util.h",
110     "image/canvas_image_source.cc",
111     "image/canvas_image_source.h",
112     "image/image.cc",
113     "image/image.h",
114     "image/image_family.cc",
115     "image/image_family.h",
116     "image/image_ios.mm",
117     "image/image_mac.mm",
118     "image/image_png_rep.cc",
119     "image/image_png_rep.h",
120     "image/image_skia.cc",
121     "image/image_skia.h",
122     "image/image_skia_operations.cc",
123     "image/image_skia_operations.h",
124     "image/image_skia_rep.cc",
125     "image/image_skia_rep.h",
126     "image/image_skia_source.h",
127     "image/image_skia_util_ios.h",
128     "image/image_skia_util_ios.mm",
129     "image/image_skia_util_mac.h",
130     "image/image_skia_util_mac.mm",
131     "image/image_util.cc",
132     "image/image_util.h",
133     "image/image_util_ios.mm",
134     "interpolated_transform.cc",
135     "interpolated_transform.h",
136     "linux_font_delegate.cc",
137     "linux_font_delegate.h",
138     "mac/coordinate_conversion.h",
139     "mac/coordinate_conversion.mm",
140     "mac/scoped_ns_disable_screen_updates.h",
141     "native_widget_types.h",
142     "nine_image_painter.cc",
143     "nine_image_painter.h",
144     "path.cc",
145     "path.h",
146     "path_aura.cc",
147     "path_win.cc",
148     "path_win.h",
149     "path_x11.cc",
150     "path_x11.h",
151     "platform_font.h",
152     "platform_font_android.cc",
153     "platform_font_ios.h",
154     "platform_font_ios.mm",
155     "platform_font_mac.h",
156     "platform_font_mac.mm",
157     "platform_font_win.cc",
158     "platform_font_win.h",
159     "range/range.cc",
160     "range/range.h",
161     "range/range_mac.mm",
162     "range/range_win.cc",
163     "scoped_canvas.h",
164     "scoped_cg_context_save_gstate_mac.h",
165     "scoped_ns_graphics_context_save_gstate_mac.h",
166     "scoped_ns_graphics_context_save_gstate_mac.mm",
167     "scoped_ui_graphics_push_context_ios.h",
168     "scoped_ui_graphics_push_context_ios.mm",
169     "screen.cc",
170     "screen.h",
171     "screen_android.cc",
172     "screen_aura.cc",
173     "screen_ios.mm",
174     "screen_mac.mm",
175     "screen_win.cc",
176     "screen_win.h",
177     "scrollbar_size.cc",
178     "scrollbar_size.h",
179     "selection_model.cc",
180     "selection_model.h",
181     "sequential_id_generator.cc",
182     "sequential_id_generator.h",
183     "shadow_value.cc",
184     "shadow_value.h",
185     "skbitmap_operations.cc",
186     "skbitmap_operations.h",
187     "skia_util.cc",
188     "skia_util.h",
189     "switches.cc",
190     "switches.h",
191     "sys_color_change_listener.cc",
192     "sys_color_change_listener.h",
193     "text_constants.h",
194     "text_elider.cc",
195     "text_elider.h",
196     "text_utils.cc",
197     "text_utils.h",
198     "text_utils_android.cc",
199     "text_utils_ios.mm",
200     "transform.cc",
201     "transform.h",
202     "transform_util.cc",
203     "transform_util.h",
204     "ui_gfx_exports.cc",
205     "utf16_indexing.cc",
206     "utf16_indexing.h",
207     "vsync_provider.h",
208     "win/dpi.cc",
209     "win/dpi.h",
210     "win/hwnd_util.cc",
211     "win/hwnd_util.h",
212     "win/scoped_set_map_mode.h",
213     "win/singleton_hwnd.cc",
214     "win/singleton_hwnd.h",
215     "win/window_impl.cc",
216     "win/window_impl.h",
217   ]
218
219   defines = [ "GFX_IMPLEMENTATION" ]
220
221   deps = [
222     ":gfx_export",
223     "//base",
224     "//base:i18n",
225     "//base:base_static",
226     "//base/third_party/dynamic_annotations",
227     "//skia",
228     "//third_party/harfbuzz-ng",
229     "//third_party/icu:icui18n",
230     "//third_party/icu:icuuc",
231     "//third_party/libpng",
232     "//third_party/zlib",
233     "//ui/gfx/geometry",
234   ]
235   forward_dependent_configs_from = [ "//skia" ]
236
237   # Text rendering conditions (complicated so separated out).
238   if (is_android || is_ios) {
239     # We don't support RenderText on these platforms.
240   } else {
241     # These text rendering files are supported everywhere text rendering is.
242     sources += [
243       "render_text.cc",
244       "render_text.h",
245       "render_text_harfbuzz.cc",
246       "render_text_harfbuzz.h",
247       "text_utils_skia.cc",
248     ]
249     # These are the "native" rendering routines, only one should apply.
250     if (is_win) {
251       sources += [ "render_text_win.cc" ]
252     } else if (is_mac) {
253       sources += [ "render_text_mac.cc" ]
254     } else if (use_pango) {
255       sources += [ "render_text_pango.cc" ]
256     } else if (use_ozone) {
257       sources += [ "render_text_ozone.cc" ]
258     }
259   }
260
261   # iOS.
262   if (is_ios) {
263     sources -= [
264       "codec/jpeg_codec.cc",
265       "codec/jpeg_codec.h",
266     ]
267   } else {
268     deps += [ "//third_party:jpeg" ]
269   }
270
271   # Android.
272   if (is_android) {
273     sources -= [
274       "animation/throb_animation.cc",
275       "canvas_skia.cc",
276       "display_observer.cc",
277       "selection_model.cc",
278     ]
279
280     if (use_aura) {
281       sources -= [ "screen_android.cc" ]
282     } else {
283       sources -= [ "path.cc" ]
284     }
285
286     # TODO(GYP) re-enable when base_java exists.
287     #if (!is_android_webview_build) {
288     #  deps += [ "//base:base_java" ]
289     #}
290
291     deps += [ ":gfx_jni_headers" ]
292     libs = [
293       "android",
294       "jnigraphics",
295     ]
296   } else {
297     sources -= [ "canvas_notimplemented.cc" ]
298   }
299
300   # Windows.
301   if (is_win) {
302     cflags = [
303       "/wd4267",  # TODO(jschuh): C4267: http://crbug.com/167187 size_t -> int.
304       "/wd4324",  # Structure was padded due to __declspec(align()), which is
305                   # uninteresting.
306     ]
307   } else {
308     sources -= [
309       "gdi_util.cc",
310       "gdi_util.h",
311       "icon_util.cc",
312       "icon_util.h",
313     ]
314   }
315
316   # Linux.
317   if (is_linux) {
318     configs += [ "//build/config/linux:fontconfig" ]
319   }
320
321   # Ozone stuff.
322   if (use_ozone) {
323     sources += [
324       "platform_font_ozone.cc",
325     ]
326   }
327
328   if (!use_aura) {
329     sources -= [
330       "nine_image_painter.cc",
331       "nine_image_painter.h",
332       "path_aura.cc",
333       "screen_aura.cc",
334     ]
335   }
336
337   if (use_x11) {
338     deps += [
339       "//ui/gfx/x",
340     ]
341   } else {
342     sources -= [
343       "path_x11.cc",
344     ]
345   }
346
347   if (use_pango) {
348     sources += [
349       "pango_util.cc",
350       "pango_util.h",
351       "platform_font_pango.cc",
352       "platform_font_pango.h",
353     ]
354     configs += [ "//build/config/linux:pangocairo" ]
355   }
356   if (use_pango && use_ozone) {
357     sources -= [
358       "platform_font_ozone.cc",
359     ]
360   }
361 }
362
363 # Looking for gfx_geometry? It's //ui/gfx/geometry:geometry
364
365 source_set("test_support") {
366   sources = [
367     "test/fontconfig_util_linux.cc",
368     "test/fontconfig_util_linux.h",
369     "test/gfx_util.cc",
370     "test/gfx_util.h",
371     "test/ui_cocoa_test_helper.h",
372     "test/ui_cocoa_test_helper.mm",
373   ]
374
375   deps = [
376     ":gfx",
377     "//base",
378     "//base/test:test_support",
379     "//skia",
380     "//testing/gtest",
381     "//ui/gfx/geometry",
382   ]
383
384   if (is_ios) {
385     # The cocoa files don't apply to iOS.
386     sources -= [
387       "test/ui_cocoa_test_helper.h",
388       "test/ui_cocoa_test_helper.mm",
389     ]
390   }
391   if (is_linux) {
392     configs += [ "//build/config/linux:fontconfig" ]
393   }
394 }
395
396 test("gfx_unittests") {
397   sources = [
398     "geometry/box_unittest.cc",
399     "geometry/cubic_bezier_unittest.cc",
400     "geometry/insets_unittest.cc",
401     "geometry/matrix3_unittest.cc",
402     "geometry/point_unittest.cc",
403     "geometry/point3_unittest.cc",
404     "geometry/quad_unittest.cc",
405     "geometry/rect_unittest.cc",
406     "geometry/safe_integer_conversions_unittest.cc",
407     "geometry/size_unittest.cc",
408     "geometry/vector2d_unittest.cc",
409     "geometry/vector3d_unittest.cc",
410     "mac/coordinate_conversion_unittest.mm",
411     "range/range_unittest.cc",
412     "test/run_all_unittests.cc",
413   ]
414
415   deps = [
416     ":gfx",
417     ":test_support",
418     "//base",
419     "//base/test:test_support",
420     "//testing/gtest",
421     "//ui/base",
422     "//ui/gfx/geometry",
423     "//ui/resources:ui_test_pak",
424   ]
425
426   if (use_pango) {
427     sources += [
428       "font_render_params_linux_unittest.cc",
429       "platform_font_pango_unittest.cc",
430     ]
431     configs += [
432       "//build/config/linux:pangocairo",
433       "//build/config/linux:pangoft2",
434     ]
435   }
436 }
437
438 if (is_android) {
439   generate_jni("gfx_jni_headers") {
440     sources = [
441       "../android/java/src/org/chromium/ui/gfx/BitmapHelper.java",
442       "../android/java/src/org/chromium/ui/gfx/DeviceDisplayInfo.java",
443       "../android/java/src/org/chromium/ui/gfx/ViewConfigurationHelper.java",
444     ]
445     jni_package = "gfx"
446   }
447 }