MacViews: Get c/b/ui/views/tabs to build on Mac
[chromium-blink-merge.git] / ui / views / BUILD.gn
blob1b1b6bf69120d4870dbb99c661b8e02793ab04fb
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")
8 gypi_values = exec_script(
9     "//build/gypi_to_gn.py",
10     [ rebase_path("views.gyp") ],
11     "scope",
12     [ "views.gyp" ])
14 component("views") {
15   sources = gypi_values.views_sources
17   defines = [ "VIEWS_IMPLEMENTATION" ]
19   deps = [
20     "//base:i18n",
21     "//base/third_party/dynamic_annotations",
22     "//skia",
23     "//third_party/icu",
24     "//ui/accessibility",
25     "//ui/aura",
26     "//ui/native_theme",
27     "//ui/resources",
28     "//ui/strings",
29     "//ui/wm",
30     "//url",
31   ]
33   public_deps = [
34     "//base",
35     "//ui/accessibility:ax_gen",
36     "//ui/base",
37     "//ui/compositor",
38     "//ui/events",
39     "//ui/events:events_base",
40     "//ui/events/platform",
41     "//ui/gfx",
42     "//ui/gfx/geometry",
43   ]
45   if (use_x11 && !is_chromeos) {
46     deps += [ "//ui/display/util" ]
47   }
48   if (is_linux && !is_chromeos) {
49     sources -= [ "window/window_button_order_provider.cc" ]
50     deps += [ "//ui/shell_dialogs" ]
51   } else {
52     sources -= [
53       "linux_ui/linux_ui.h",
54       "linux_ui/linux_ui.cc",
55       "linux_ui/window_button_order_observer.h",
56       "linux_ui/window_button_order_provider.cc",
57     ]
58   }
60   if (is_chromeos) {
61     sources -= [
62       "linux_ui/status_icon_linux.h",
63       "linux_ui/status_icon_linux.cc",
64     ]
65   }
67   if (is_win) {
68     sources += gypi_values.views_win_sources
69     cflags = [ "/wd4267" ]  # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
70     libs = [ "/imm32.lib", "oleacc.lib" ]
71     ldflags = [ "/DELAYLOAD:user32.dll" ]
72     deps += [
73       "//third_party/iaccessible2",
74       "//third_party/wtl",
75     ]
76   }
78   if (use_ozone) {
79     deps += [ "//ui/ozone" ]
80   }
81   if (use_x11) {
82     configs += [
83       "//build/config/linux:x11",
84       "//build/config/linux:xrandr",
85     ]
86     deps += [
87       "//ui/events/platform/x11",
88       "//ui/gfx/x",
89     ]
90   }
92   if (use_aura) {
93     sources += gypi_values.views_aura_sources
94     if (!is_chromeos) {
95       sources += gypi_values.views_desktop_aura_sources
96       if (use_x11) {
97         sources += gypi_values.views_desktop_aura_x11_sources
98       } else if (is_win) {
99         sources += gypi_values.views_desktop_aura_win_sources
100       } else if (use_ozone) {
101         sources += gypi_values.views_desktop_aura_ozone_sources
102       }
103     }
104   }
107 static_library("test_support") {
108   testonly = true
109   sources = gypi_values.views_test_support_sources
111   public_deps = [
112     ":views",
113   ]
114   deps = [
115     "//base",
116     "//ipc:test_support",
117     "//skia",
118     "//testing/gtest",
119     "//ui/aura",
120     "//ui/base",
121     "//ui/compositor",
122     "//ui/compositor:test_support",
123     "//ui/events",
124     "//ui/events:events_base",
125     "//ui/events:test_support",
126     "//ui/events/platform",
127     "//ui/gfx",
128     "//ui/gfx/geometry",
129     "//ui/wm",
130   ]
132   if (is_chromeos) {
133     sources -= [
134       "test/ui_controls_factory_desktop_aurax11.cc",
135       "test/ui_controls_factory_desktop_aurax11.h",
136     ]
137   }
138   if (use_aura) {
139     sources += gypi_values.views_test_support_aura_sources
140     deps += [ "//ui/aura:test_support" ]
141   }
142   if (use_x11) {
143     deps += [ "//ui/gfx/x" ]
144   }
147 test("views_unittests") {
148   sources = gypi_values.views_unittests_sources
150   deps = [
151     ":test_support",
152     "//base",
153     "//base:i18n",
154     "//base/allocator",
155     "//base/test:test_support",
156     "//skia",
157     "//testing/gtest",
158     "//third_party/icu",
159     "//ui/accessibility",
160     "//ui/aura",
161     "//ui/base",
162     "//ui/base:test_support",
163     "//ui/compositor:test_support",
164     "//ui/events:test_support",
165     "//ui/events:events_base",
166     "//ui/events/platform",
167     "//ui/gfx",
168     "//ui/gfx/geometry",
169     "//ui/gl",
170     "//ui/resources",
171     "//ui/strings",
172     "//ui/wm",
173     "//url",
174   ]
176   if (is_chromeos) {
177     sources -= [
178       "ime/input_method_bridge_unittest.cc",
179     ]
180   }
182   if (is_win) {
183     deps += [
184       "//third_party/iaccessible2",
185       "//third_party/wtl",
186     ]
187     libs = [
188       "imm32.lib",
189       "oleacc.lib",
190       "comctl32.lib",
191     ]
192     # TOOD(GYP)
193     #'msvs_settings': {
194     #  'VCManifestTool': {
195     #    'AdditionalManifestFiles': [
196     #      '$(ProjectDir)\\test\\views_unittest.manifest',
197     #    ],
198     #  },
199     #},
200   }
202   if (use_x11) {
203     configs += [
204       "//build/config/linux:x11",
205       "//build/config/linux:xext",
206     ]
207     deps += [
208       "//ui/events/platform/x11",
209       "//ui/gfx/x",
210     ]
211   }
213   if (use_aura) {
214     sources += gypi_values.views_unittests_aura_sources
215     deps += [ "//ui/aura:test_support" ]
216     if (!is_chromeos) {
217       sources += gypi_values.views_unittests_desktop_aura_sources
218     }
219   }
220   if (use_x11) {
221     deps += [
222       "//ui/events/platform/x11",
223       "//ui/gfx/x",
224     ]
225   }
227   if (is_mac) {
228     # views_unittests not yet compiling on Mac. http://crbug.com/378134
229     sources -= [
230       "bubble/bubble_window_targeter_unittest.cc",
231       "controls/button/custom_button_unittest.cc",
232       "controls/button/menu_button_unittest.cc",
233       "controls/native/native_view_host_unittest.cc",
234       "controls/menu/menu_controller_unittest.cc",
235       "ime/input_method_bridge_unittest.cc",
236       "focus/focus_manager_unittest.cc",
237       "widget/window_reorderer_unittest.cc",
238       "widget/widget_unittest.cc",
239     ]
240   }
243 if (is_mac) {
244   test("macviews_interactive_ui_tests") {
245     sources = [
246       "run_all_unittests.cc",
247       "widget/native_widget_mac_interactive_uitest.mm",
248     ]
249     deps = [
250       ":test_support",
251       ":views",
252       "//base",
253       "//base/test:test_support",
254       "//skia",
255       "//testing/gtest",
256       "//ui/aura",
257       "//ui/compositor",
258       "//ui/resources",
259       "//ui/resources:ui_test_pak",
260       "//ui/strings",
261       "//ui/wm",
262     ]
263   }