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