Rename vector icon header files.
[chromium-blink-merge.git] / ui / gfx / BUILD.gn
blob6406021183a4bd6256803d8c645d39ce2cd2da16
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/ui.gni")
6 import("//testing/test.gni")
8 if (is_android) {
9   import("//build/config/android/config.gni")
10   import("//build/config/android/rules.gni")
13 # Several targets want to include this header file, and some of them are
14 # child dependencies of "gfx". Therefore, we separate it out here so multiple
15 # targets can all have a dependency for header checking purposes without
16 # creating circular dependencies.
17 source_set("gfx_export") {
18   sources = [
19     "gfx_export.h",
20   ]
23 vector_icons_cc_file = "$target_gen_dir/vector_icons.cc"
24 vector_icons_h_file = "$target_gen_dir/vector_icons.h"
26 component("gfx") {
27   sources = [
28     "android/device_display_info.cc",
29     "android/device_display_info.h",
30     "android/gfx_jni_registrar.cc",
31     "android/gfx_jni_registrar.h",
32     "android/java_bitmap.cc",
33     "android/java_bitmap.h",
34     "android/shared_device_display_info.cc",
35     "android/shared_device_display_info.h",
36     "android/view_configuration.cc",
37     "android/view_configuration.h",
38     "animation/animation.cc",
39     "animation/animation.h",
40     "animation/animation_container.cc",
41     "animation/animation_container.h",
42     "animation/animation_container_element.h",
43     "animation/animation_container_observer.h",
44     "animation/animation_delegate.h",
45     "animation/linear_animation.cc",
46     "animation/linear_animation.h",
47     "animation/multi_animation.cc",
48     "animation/multi_animation.h",
49     "animation/slide_animation.cc",
50     "animation/slide_animation.h",
51     "animation/throb_animation.cc",
52     "animation/throb_animation.h",
53     "animation/tween.cc",
54     "animation/tween.h",
55     "break_list.h",
56     "buffer_format_util.cc",
57     "buffer_format_util.h",
58     "codec/jpeg_codec.cc",
59     "codec/jpeg_codec.h",
60     "codec/png_codec.cc",
61     "codec/png_codec.h",
62     "color_analysis.cc",
63     "color_analysis.h",
64     "color_profile.cc",
65     "color_profile.h",
66     "color_profile_mac.mm",
67     "color_profile_win.cc",
68     "color_utils.cc",
69     "color_utils.h",
70     "display.cc",
71     "display.h",
72     "display_change_notifier.cc",
73     "display_change_notifier.h",
74     "display_observer.cc",
75     "display_observer.h",
76     "favicon_size.cc",
77     "favicon_size.h",
78     "font.cc",
79     "font.h",
80     "font_fallback.h",
81     "font_fallback_linux.cc",
82     "font_fallback_mac.mm",
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.cc",
90     "font_render_params.h",
91     "font_render_params_android.cc",
92     "font_render_params_linux.cc",
93     "font_render_params_mac.cc",
94     "font_render_params_win.cc",
95     "gdi_util.cc",
96     "gdi_util.h",
97     "generic_shared_memory_id.cc",
98     "generic_shared_memory_id.h",
99     "gfx_paths.cc",
100     "gfx_paths.h",
101     "hud_font.cc",
102     "hud_font.h",
103     "icon_util.cc",
104     "icon_util.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_rep.cc",
116     "image/image_skia_rep.h",
117     "image/image_skia_source.h",
118     "image/image_skia_util_ios.h",
119     "image/image_skia_util_ios.mm",
120     "image/image_skia_util_mac.h",
121     "image/image_skia_util_mac.mm",
122     "image/image_util.cc",
123     "image/image_util.h",
124     "image/image_util_ios.mm",
125     "interpolated_transform.cc",
126     "interpolated_transform.h",
127     "linux_font_delegate.cc",
128     "linux_font_delegate.h",
129     "mac/coordinate_conversion.h",
130     "mac/coordinate_conversion.mm",
131     "mac/nswindow_frame_controls.h",
132     "mac/nswindow_frame_controls.mm",
133     "mac/scoped_cocoa_disable_screen_updates.h",
134     "native_widget_types.h",
135     "nine_image_painter.cc",
136     "nine_image_painter.h",
137     "path.cc",
138     "path.h",
139     "path_win.cc",
140     "path_win.h",
141     "path_x11.cc",
142     "path_x11.h",
143     "platform_font.h",
144     "platform_font_android.cc",
145     "platform_font_ios.h",
146     "platform_font_ios.mm",
147     "platform_font_linux.cc",
148     "platform_font_linux.h",
149     "platform_font_mac.h",
150     "platform_font_mac.mm",
151     "platform_font_win.cc",
152     "platform_font_win.h",
153     "range/range.cc",
154     "range/range.h",
155     "range/range_f.cc",
156     "range/range_f.h",
157     "range/range_mac.mm",
158     "range/range_win.cc",
159     "scoped_canvas.h",
160     "scoped_cg_context_save_gstate_mac.h",
161     "scoped_ns_graphics_context_save_gstate_mac.h",
162     "scoped_ns_graphics_context_save_gstate_mac.mm",
163     "scoped_ui_graphics_push_context_ios.h",
164     "scoped_ui_graphics_push_context_ios.mm",
165     "screen.cc",
166     "screen.h",
167     "screen_android.cc",
168     "screen_aura.cc",
169     "screen_ios.mm",
170     "screen_mac.mm",
171     "screen_win.cc",
172     "screen_win.h",
173     "scrollbar_size.cc",
174     "scrollbar_size.h",
175     "selection_model.cc",
176     "selection_model.h",
177     "sequential_id_generator.cc",
178     "sequential_id_generator.h",
179     "shadow_value.cc",
180     "shadow_value.h",
181     "skbitmap_operations.cc",
182     "skbitmap_operations.h",
183     "skia_util.cc",
184     "skia_util.h",
185     "switches.cc",
186     "switches.h",
187     "sys_color_change_listener.cc",
188     "sys_color_change_listener.h",
189     "text_constants.h",
190     "text_elider.cc",
191     "text_elider.h",
192     "text_utils.cc",
193     "text_utils.h",
194     "text_utils_android.cc",
195     "text_utils_ios.mm",
196     "transform.cc",
197     "transform.h",
198     "transform_util.cc",
199     "transform_util.h",
200     "ui_gfx_exports.cc",
201     "utf16_indexing.cc",
202     "utf16_indexing.h",
203     "vsync_provider.h",
204     "win/direct_manipulation.cc",
205     "win/direct_manipulation.h",
206     "win/direct_write.cc",
207     "win/direct_write.h",
208     "win/dpi.cc",
209     "win/dpi.h",
210     "win/hwnd_util.cc",
211     "win/hwnd_util.h",
212     "win/metro_mode.cc",
213     "win/metro_mode.h",
214     "win/scoped_set_map_mode.h",
215     "win/singleton_hwnd.cc",
216     "win/singleton_hwnd.h",
217     "win/singleton_hwnd_observer.cc",
218     "win/singleton_hwnd_observer.h",
219     "win/window_impl.cc",
220     "win/window_impl.h",
221   ]
222   if (!is_ios) {
223     sources += [
224       "blit.cc",
225       "blit.h",
226       "canvas.cc",
227       "canvas.h",
228       "canvas_notimplemented.cc",
229       "canvas_paint_mac.h",
230       "canvas_paint_mac.mm",
231       "canvas_skia.cc",
232       "canvas_skia_paint.h",
233       "gpu_memory_buffer.cc",
234       "gpu_memory_buffer.h",
235       "image/canvas_image_source.cc",
236       "image/canvas_image_source.h",
237       "image/image_skia_operations.cc",
238       "image/image_skia_operations.h",
239       "paint_throbber.cc",
240       "paint_throbber.h",
241     ]
242   }
244   configs += [
245     "//build/config:precompiled_headers",
247     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
248     "//build/config/compiler:no_size_t_to_int_warning",
249   ]
251   defines = [ "GFX_IMPLEMENTATION" ]
253   deps = [
254     ":gfx_export",
255     "//base",
256     "//base:i18n",
257     "//base:base_static",
258     "//base/third_party/dynamic_annotations",
259     "//skia",
260     "//third_party/harfbuzz-ng",
261     "//third_party/libpng",
262     "//third_party/zlib",
263     "//ui/gfx/geometry",
264   ]
265   public_deps = [
266     "//base",
267     "//skia",
268     "//third_party/icu",
269   ]
271   # Text rendering conditions (complicated so separated out).
272   if (use_aura || is_mac) {
273     # Mac doesn't use RenderTextHarfBuzz by default yet.
274     sources += [
275       "harfbuzz_font_skia.cc",
276       "harfbuzz_font_skia.h",
277       "render_text_harfbuzz.cc",
278       "render_text_harfbuzz.h",
279       "render_text_mac.cc",
280       "render_text_mac.h",
281       "text_utils_skia.cc",
282     ]
284     if (!is_ios) {
285       sources += [
286         "render_text.cc",
287         "render_text.h",
288       ]
289     }
290   } else {
291     # We don't support RenderText on these platforms.
292   }
294   if (is_android && use_aura) {
295     sources -= [
296       "platform_font_android.cc",
297       "text_utils_android.cc",
298     ]
299     set_sources_assignment_filter([])
300     sources += [ "platform_font_linux.cc" ]
301     set_sources_assignment_filter(sources_assignment_filter)
302   }
304   # iOS.
305   if (is_ios) {
306     sources -= [
307       "codec/jpeg_codec.cc",
308       "codec/jpeg_codec.h",
309     ]
310   } else {
311     deps += [ "//third_party:jpeg" ]
312   }
314   # Android.
315   if (is_android) {
316     if (use_aura) {
317       sources -= [
318         "canvas_notimplemented.cc",
319         "screen_android.cc",
320       ]
321       sources += [ "font_fallback_android.cc" ]
322     } else {
323       sources -= [
324         "animation/throb_animation.cc",
325         "canvas_skia.cc",
326         "path.cc",
327         "selection_model.cc",
328       ]
329     }
331     if (!is_debug) {
332       configs -= [ "//build/config/compiler:optimize" ]
333       configs += [ "//build/config/compiler:optimize_max" ]
334     }
336     deps += [
337       ":gfx_jni_headers",
338       "//base:base_java",
339     ]
340     libs = [
341       "android",
342       "jnigraphics",
343     ]
344   } else if (!is_ios) {
345     sources -= [ "canvas_notimplemented.cc" ]
346   }
348   # Desktop only.
349   if (use_aura || (!is_ios && !is_android)) {
350     sources += [
351       "paint_vector_icon.cc",
352       "paint_vector_icon.h",
353       "vector_icon_types.h",
354       "vector_icons_public.h",
355       vector_icons_cc_file,
356       vector_icons_h_file,
357     ]
358     deps += [ ":aggregate_vector_icons" ]
359   }
361   # Windows.
362   if (is_win) {
363     cflags = [ "/wd4324" ]  # Structure was padded due to __declspec(align()), which is
364                             # uninteresting.
365   } else {
366     sources -= [
367       "gdi_util.cc",
368       "gdi_util.h",
369       "icon_util.cc",
370       "icon_util.h",
371       "sys_color_change_listener.cc",
372       "sys_color_change_listener.h",
373     ]
374   }
376   # Linux.
377   if (is_linux) {
378     configs += [ "//build/config/linux:fontconfig" ]
379   }
381   # Chrome OS
382   if (is_chromeos) {
383     # Robust JPEG decoding for the login screen.
384     sources += [
385       "chromeos/codec/jpeg_codec_robust_slow.cc",
386       "chromeos/codec/jpeg_codec_robust_slow.h",
387     ]
388     deps += [ "//third_party/libjpeg" ]
389   }
391   if (!use_aura) {
392     sources -= [ "screen_aura.cc" ]
393     if (!toolkit_views) {
394       sources -= [
395         "nine_image_painter.cc",
396         "nine_image_painter.h",
397       ]
398     }
399   }
401   if (use_x11) {
402     deps += [ "//ui/gfx/x" ]
403     configs += [ "//build/config/linux:x11" ]
404   } else {
405     sources -= [ "path_x11.cc" ]
406   }
408   if (use_ozone) {
409     sources += [ "native_pixmap_handle_ozone.h" ]
410   }
412   if (use_cairo) {
413     configs += [ "//build/config/linux:pangocairo" ]
414   }
417 # GYP version: ui/gfx/gfx.gyp:aggregate_vector_icons
418 action("aggregate_vector_icons") {
419   script = "vector_icons/aggregate_vector_icons.py"
420   sources = [
421     "vector_icon_types.h",
422     "vector_icons/account_box.icon",
423     "vector_icons/account_child_invert.icon",
424     "vector_icons/blocked_badge.icon",
425     "vector_icons/check_circle.icon",
426     "vector_icons/code.icon",
427     "vector_icons/cookie.icon",
428     "vector_icons/extension.icon",
429     "vector_icons/file_download.icon",
430     "vector_icons/file_download_shelf.icon",
431     "vector_icons/find_close.1x.icon",
432     "vector_icons/find_close.icon",
433     "vector_icons/find_next.1x.icon",
434     "vector_icons/find_next.icon",
435     "vector_icons/find_prev.1x.icon",
436     "vector_icons/find_prev.icon",
437     "vector_icons/fullscreen.icon",
438     "vector_icons/help_outline.icon",
439     "vector_icons/image.icon",
440     "vector_icons/laptop.icon",
441     "vector_icons/location_on.icon",
442     "vector_icons/midi.icon",
443     "vector_icons/mixed_content.icon",
444     "vector_icons/mode_edit.icon",
445     "vector_icons/my_location.icon",
446     "vector_icons/notifications.icon",
447     "vector_icons/photo_camera.icon",
448     "vector_icons/remove_box.icon",
449     "vector_icons/smartphone.icon",
450     "vector_icons/supervisor_account.icon",
451     "vector_icons/tab.icon",
452     "vector_icons/tab_audio.1x.icon",
453     "vector_icons/tab_audio.icon",
454     "vector_icons/tab_audio_muting.1x.icon",
455     "vector_icons/tab_audio_muting.icon",
456     "vector_icons/tablet.icon",
457     "vector_icons/translate.icon",
458     "vector_icons/warning.icon",
459     "vector_icons/web.icon",
460   ]
461   outputs = [
462     vector_icons_cc_file,
463     vector_icons_h_file,
464   ]
466   args = [
467     "--working_directory=" + rebase_path("vector_icons/"),
468     "--output_cc=" + rebase_path(vector_icons_cc_file, root_build_dir),
469     "--output_h=" + rebase_path(vector_icons_h_file, root_build_dir),
470   ]
473 # Looking for gfx_geometry? It's //ui/gfx/geometry:geometry
475 source_set("test_support") {
476   testonly = true
477   sources = [
478     "image/image_unittest_util.cc",
479     "image/image_unittest_util.h",
480     "image/image_unittest_util_ios.mm",
481     "image/image_unittest_util_mac.mm",
482     "test/fontconfig_util_linux.cc",
483     "test/fontconfig_util_linux.h",
484     "test/gfx_util.cc",
485     "test/gfx_util.h",
486     "test/test_screen.cc",
487     "test/test_screen.h",
488     "test/ui_cocoa_test_helper.h",
489     "test/ui_cocoa_test_helper.mm",
490   ]
492   public_deps = [
493     ":gfx",
494   ]
496   deps = [
497     "//base",
498     "//base/test:test_support",
499     "//skia",
500     "//testing/gtest",
501     "//ui/gfx/geometry",
502   ]
504   if (is_ios) {
505     # The cocoa files don't apply to iOS.
506     sources -= [
507       "test/ui_cocoa_test_helper.h",
508       "test/ui_cocoa_test_helper.mm",
509     ]
510   }
511   if (is_linux) {
512     configs += [ "//build/config/linux:fontconfig" ]
513   }
516 # TODO(GYP): Delete this after we've converted everything to GN.
517 # The _run targets exist only for compatibility w/ GYP.
518 group("gfx_unittests_run") {
519   testonly = true
520   deps = [
521     ":gfx_unittests",
522   ]
525 test("gfx_unittests") {
526   sources = [
527     "font_render_params_linux_unittest.cc",
528     "font_unittest.cc",
529     "image/image_family_unittest.cc",
530     "image/image_ios_unittest.mm",
531     "image/image_skia_unittest.cc",
532     "image/image_unittest.cc",
533     "platform_font_linux_unittest.cc",
534     "screen_unittest.cc",
535     "test/run_all_unittests.cc",
536     "text_elider_unittest.cc",
537     "text_utils_unittest.cc",
538   ]
540   data = [
541     "test/data/",
542     "$root_out_dir/ui_test.pak",
543   ]
545   if (!is_ios) {
546     sources += [
547       "animation/animation_container_unittest.cc",
548       "animation/animation_unittest.cc",
549       "animation/multi_animation_unittest.cc",
550       "animation/slide_animation_unittest.cc",
551       "animation/tween_unittest.cc",
552       "blit_unittest.cc",
553       "break_list_unittest.cc",
554       "canvas_unittest.cc",
555       "canvas_unittest_mac.mm",
556       "codec/jpeg_codec_unittest.cc",
557       "codec/png_codec_unittest.cc",
558       "color_analysis_unittest.cc",
559       "color_profile_mac_unittest.mm",
560       "color_utils_unittest.cc",
561       "display_change_notifier_unittest.cc",
562       "display_unittest.cc",
563       "font_fallback_mac_unittest.cc",
564       "font_list_unittest.cc",
565       "geometry/box_unittest.cc",
566       "geometry/cubic_bezier_unittest.cc",
567       "geometry/insets_unittest.cc",
568       "geometry/matrix3_unittest.cc",
569       "geometry/point3_unittest.cc",
570       "geometry/point_unittest.cc",
571       "geometry/quad_unittest.cc",
572       "geometry/rect_unittest.cc",
573       "geometry/safe_integer_conversions_unittest.cc",
574       "geometry/scroll_offset_unittest.cc",
575       "geometry/size_unittest.cc",
576       "geometry/vector2d_unittest.cc",
577       "geometry/vector3d_unittest.cc",
578       "image/image_mac_unittest.mm",
579       "image/image_util_unittest.cc",
580       "mac/coordinate_conversion_unittest.mm",
581       "nine_image_painter_unittest.cc",
582       "platform_font_mac_unittest.mm",
583       "range/range_mac_unittest.mm",
584       "range/range_unittest.cc",
585       "range/range_win_unittest.cc",
586       "sequential_id_generator_unittest.cc",
587       "shadow_value_unittest.cc",
588       "skbitmap_operations_unittest.cc",
589       "skrect_conversion_unittest.cc",
590       "transform_util_unittest.cc",
591       "utf16_indexing_unittest.cc",
592     ]
593   }
595   if (!is_android && !is_ios) {
596     sources += [ "render_text_unittest.cc" ]
597   }
599   # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
600   configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
602   deps = [
603     ":gfx",
604     ":test_support",
605     "//base",
606     "//base/test:test_support",
607     "//skia",
608     "//third_party/icu:icuuc",
609     "//third_party/libpng",
610     "//third_party/zlib",
611     "//testing/gtest",
612     "//ui/base",
613     "//ui/gfx/geometry",
614     "//ui/resources:ui_test_pak",
615   ]
617   data_deps = [ "//ui/resources:ui_test_pak" ]
619   if (!is_mac && !is_ios) {
620     sources += [
621       "interpolated_transform_unittest.cc",
622       "transform_unittest.cc",
623     ]
624   }
626   if (is_android) {
627     sources -= [
628       # Do not run display_change_notifier_unittest.cc on Android because it
629       # does not compile display_observer.cc
630       "display_change_notifier_unittest.cc",
631     ]
632   }
634   if (use_aura) {
635     sources -= [ "screen_unittest.cc" ]
636   } else if (!is_ios) {
637     sources -= [ "nine_image_painter_unittest.cc" ]
638   }
640   if (is_chromeos) {
641     sources += [ "chromeos/codec/jpeg_codec_robust_slow_unittest.cc" ]
642   }
644   if (is_win) {
645     sources += [
646       "color_profile_win_unittest.cc",
647       "font_fallback_win_unittest.cc",
648       "icon_util_unittest.cc",
649       "icon_util_unittests.rc",
650       "path_win_unittest.cc",
651       "platform_font_win_unittest.cc",
652     ]
654     ldflags = [
655       "/DELAYLOAD:d2d1.dll",
656       "/DELAYLOAD:d3d10_1.dll",
657     ]
659     libs = [
660       "d2d1.lib",
661       "d3d10_1.lib",
662       "imm32.lib",
663       "oleacc.lib",
664     ]
665   }
668 if (is_android) {
669   generate_jni("gfx_jni_headers") {
670     sources = [
671       "../android/java/src/org/chromium/ui/gfx/BitmapHelper.java",
672       "../android/java/src/org/chromium/ui/gfx/DeviceDisplayInfo.java",
673       "../android/java/src/org/chromium/ui/gfx/ViewConfigurationHelper.java",
674     ]
675     jni_package = "gfx"
676   }