Roll src/third_party/WebKit 2085a03:f2395b6 (svn 200318:200329)
[chromium-blink-merge.git] / ui / views / BUILD.gn
blobae64118d03f8e1bc2cb8269b81101268952474f8
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("//testing/test.gni")
9 gypi_values = exec_script("//build/gypi_to_gn.py",
10                           [ rebase_path("views.gyp") ],
11                           "scope",
12                           [ "views.gyp" ])
14 config("flags") {
15   defines = [ "TOOLKIT_VIEWS=1" ]
18 component("views") {
19   all_dependent_configs = [ ":flags" ]
20   sources = gypi_values.views_sources
22   configs += [
23     "//build/config:precompiled_headers",
25     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
26     "//build/config/compiler:no_size_t_to_int_warning",
27   ]
29   defines = [ "VIEWS_IMPLEMENTATION" ]
31   deps = [
32     "//base:i18n",
33     "//base/third_party/dynamic_annotations",
34     "//skia",
35     "//third_party/icu",
36     "//ui/accessibility",
37     "//ui/native_theme",
38     "//ui/resources",
39     "//ui/strings",
40     "//ui/views/resources",
41     "//url",
42   ]
44   public_deps = [
45     "//base",
46     "//ui/accessibility:ax_gen",
47     "//ui/base",
48     "//ui/base/ime",
49     "//ui/compositor",
50     "//ui/events",
51     "//ui/events:events_base",
52     "//ui/events/platform",
53     "//ui/gfx",
54     "//ui/gfx/geometry",
55     "//ui/views/resources",
56   ]
58   if (use_x11 && !is_chromeos) {
59     deps += [ "//ui/display/util" ]
60   }
61   if (is_linux && !is_chromeos) {
62     sources -= [ "window/window_button_order_provider.cc" ]
63     deps += [ "//ui/shell_dialogs" ]
64   } else {
65     sources -= [
66       "linux_ui/linux_ui.cc",
67       "linux_ui/linux_ui.h",
68       "linux_ui/window_button_order_observer.h",
69       "linux_ui/window_button_order_provider.cc",
70     ]
71   }
73   if (is_chromeos) {
74     sources -= [
75       "linux_ui/status_icon_linux.cc",
76       "linux_ui/status_icon_linux.h",
77     ]
78   }
80   if (is_win) {
81     sources += gypi_values.views_win_sources
82     libs = [
83       "dwmapi.lib",
84       "imm32.lib",
85       "oleacc.lib",
86     ]
87     ldflags = [ "/DELAYLOAD:user32.dll" ]
88     deps += [
89       "//third_party/iaccessible2",
90       "//third_party/wtl",
91     ]
92   }
94   if (use_ozone) {
95     deps += [ "//ui/ozone" ]
96   }
97   if (use_x11) {
98     configs += [
99       "//build/config/linux:x11",
100       "//build/config/linux:xrandr",
101     ]
102     deps += [
103       "//ui/events/devices",
104       "//ui/events/platform/x11",
105       "//ui/gfx/x",
106     ]
107   }
109   if (use_aura) {
110     sources += gypi_values.views_aura_sources
111     deps += [
112       "//ui/aura",
113       "//ui/touch_selection",
114       "//ui/wm",
115     ]
116     if (!is_chromeos) {
117       sources += gypi_values.views_desktop_aura_sources
118       if (use_x11) {
119         sources += gypi_values.views_desktop_aura_x11_sources
120         configs += [ "//ui/accessibility:atk" ]
121       } else if (is_win) {
122         sources += gypi_values.views_desktop_aura_win_sources
123       } else if (use_ozone) {
124         sources += gypi_values.views_desktop_aura_ozone_sources
125       }
126       if (is_linux) {
127         sources += gypi_values.views_desktop_aura_linux_sources
128       }
129     }
130   }
132   if (is_mac) {
133     deps += [ "//ui/accelerated_widget_mac" ]
134     libs = [
135       # Required by bridged_native_widget.mm.
136       "QuartzCore.framework",
137     ]
138   }
141 static_library("test_support") {
142   testonly = true
143   sources = gypi_values.views_test_support_sources
145   configs += [ "//build/config:precompiled_headers" ]
147   public_deps = [
148     ":views",
149   ]
150   deps = [
151     "//base",
152     "//ipc:test_support",
153     "//skia",
154     "//testing/gtest",
155     "//ui/base",
156     "//ui/base/ime",
157     "//ui/compositor",
158     "//ui/compositor:test_support",
159     "//ui/events",
160     "//ui/events:events_base",
161     "//ui/events:test_support",
162     "//ui/events/platform",
163     "//ui/gfx",
164     "//ui/gfx/geometry",
165   ]
167   if (use_aura) {
168     sources += gypi_values.views_test_support_aura_sources
169     deps += [
170       "//ui/aura",
171       "//ui/aura:test_support",
172       "//ui/wm",
173     ]
174     if (use_x11 && !is_chromeos) {
175       sources += gypi_values.views_test_support_desktop_aura_x11_sources
176     }
177   }
178   if (use_x11) {
179     deps += [ "//ui/gfx/x" ]
180   }
181   if (use_ozone || !use_x11) {
182     sources -= [ "test/x11_property_change_waiter.cc" ]
183   }
186 test("views_unittests") {
187   sources = gypi_values.views_unittests_sources
189   deps = [
190     ":test_support",
191     "//base",
192     "//base:i18n",
193     "//base/allocator",
194     "//base/test:test_support",
195     "//skia",
196     "//testing/gtest",
197     "//third_party/icu",
198     "//ui/accessibility",
199     "//ui/base",
200     "//ui/base/ime",
201     "//ui/base:test_support",
202     "//ui/compositor:test_support",
203     "//ui/events:test_support",
204     "//ui/events:events_base",
205     "//ui/events/platform",
206     "//ui/gfx",
207     "//ui/gfx/geometry",
208     "//ui/gl",
209     "//ui/resources",
210     "//ui/strings",
211     "//url",
212   ]
214   if (is_win) {
215     deps += [
216       "//third_party/iaccessible2",
217       "//third_party/wtl",
218     ]
219     libs = [
220       "imm32.lib",
221       "oleacc.lib",
222       "comctl32.lib",
223     ]
225     # TOOD(GYP)
226     #'msvs_settings': {
227     #  'VCManifestTool': {
228     #    'AdditionalManifestFiles': [
229     #      '$(ProjectDir)\\test\\views_unittest.manifest',
230     #    ],
231     #  },
232     #},
233   }
235   if (use_x11) {
236     configs += [
237       "//build/config/linux:x11",
238       "//build/config/linux:xext",
239     ]
240     deps += [
241       "//ui/events/devices",
242       "//ui/events/platform/x11",
243       "//ui/gfx/x",
244     ]
245   }
247   if (use_aura) {
248     sources += gypi_values.views_unittests_aura_sources
249     deps += [
250       "//ui/aura",
251       "//ui/aura:test_support",
252       "//ui/touch_selection",
253       "//ui/wm",
254     ]
255     if (!is_chromeos) {
256       sources += gypi_values.views_unittests_desktop_aura_sources
257       if (use_x11) {
258         sources += gypi_values.views_unittests_desktop_aurax11_sources
259       }
260     }
261   }
262   if (!is_chromeos) {
263     sources += gypi_values.views_unittests_desktop_sources
264   }
265   if (use_x11) {
266     deps += [
267       "//ui/events/platform/x11",
268       "//ui/gfx/x",
269     ]
270   }
272   if (is_mac) {
273     # views_unittests not yet compiling on Mac. http://crbug.com/378134
274     sources -= [
275       "bubble/bubble_window_targeter_unittest.cc",
276       "controls/native/native_view_host_unittest.cc",
277       "widget/window_reorderer_unittest.cc",
278     ]
279     deps += [ "//ui/accelerated_widget_mac" ]
280   }
283 if (is_mac) {
284   test("macviews_interactive_ui_tests") {
285     sources = [
286       "cocoa/bridged_native_widget_interactive_uitest.mm",
287       "run_all_unittests.cc",
288       "widget/native_widget_mac_interactive_uitest.mm",
289     ]
290     deps = [
291       ":test_support",
292       ":views",
293       "//base",
294       "//base/test:test_support",
295       "//skia",
296       "//testing/gtest",
297       "//ui/base:test_support",
298       "//ui/compositor",
299       "//ui/resources",
300       "//ui/resources:ui_test_pak",
301       "//ui/strings",
302     ]
303   }