BUILD.gn 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480
  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. import("//build/buildflag_header.gni")
  5. import("//build/config/ozone.gni")
  6. import("//build/config/python.gni")
  7. import("//build/config/ui.gni")
  8. import("//gpu/vulkan/features.gni")
  9. import("//testing/test.gni")
  10. assert(use_ozone)
  11. visibility = [ ":*" ]
  12. # The list of platforms that will be built.
  13. ozone_platforms = ozone_external_platforms
  14. # Extra dependencies to pull into ui/ozone for built platforms.
  15. ozone_platform_deps = ozone_external_platform_deps
  16. # Extra dependencies to pull into ozone_unittests for built platforms.
  17. ozone_platform_test_deps = ozone_external_platform_test_deps
  18. # Extra dependencies to pull into ozone_integration_tests
  19. ozone_platform_integration_test_deps =
  20. ozone_external_platform_integration_test_deps
  21. # Extra dependencies to pull into ui_test_support for built platforms.
  22. ozone_platform_ui_test_support_deps =
  23. ozone_external_platform_ui_test_support_deps
  24. # Extra dependencies to pull into interactive_ui_tests for built platforms.
  25. ozone_platform_interactive_ui_tests_sources =
  26. ozone_external_interactive_ui_tests_deps
  27. if (ozone_platform_headless) {
  28. ozone_platforms += [ "headless" ]
  29. ozone_platform_deps += [ "platform/headless" ]
  30. }
  31. if (ozone_platform_drm) {
  32. ozone_platforms += [ "drm" ]
  33. ozone_platform_deps += [ "platform/drm:gbm" ]
  34. ozone_platform_test_deps += [ "platform/drm:gbm_unittests" ]
  35. ozone_platform_integration_test_deps +=
  36. [ "platform/drm:drm_integration_tests" ]
  37. }
  38. if (ozone_platform_cast) {
  39. ozone_platforms += [ "cast" ]
  40. ozone_platform_deps += [ "platform/cast" ]
  41. }
  42. if (ozone_platform_wayland) {
  43. ozone_platforms += [ "wayland" ]
  44. ozone_platform_deps += [ "platform/wayland" ]
  45. ozone_platform_test_deps += [ "platform/wayland:wayland_unittests" ]
  46. ozone_platform_ui_test_support_deps += [ "platform/wayland:ui_test_support" ]
  47. }
  48. if (ozone_platform_x11) {
  49. ozone_platforms += [ "x11" ]
  50. ozone_platform_deps += [ "platform/x11" ]
  51. ozone_platform_ui_test_support_deps += [ "platform/x11:test_support" ]
  52. }
  53. if (ozone_platform_scenic) {
  54. ozone_platforms += [ "scenic" ]
  55. ozone_platform_deps += [ "platform/scenic" ]
  56. }
  57. if (ozone_platform_flatland) {
  58. ozone_platforms += [ "flatland" ]
  59. ozone_platform_deps += [ "platform/flatland" ]
  60. ozone_platform_test_deps += [ "platform/flatland:flatland_unittests" ]
  61. }
  62. platform_list_cc_file = "$target_gen_dir/platform_list.cc"
  63. platform_list_h_file = "$target_gen_dir/platform_list.h"
  64. platform_list_txt_file = "$target_gen_dir/platform_list.txt"
  65. constructor_list_cc_file = "$target_gen_dir/constructor_list.cc"
  66. test_constructor_list_cc_file = "$target_gen_dir/test_constructor_list.cc"
  67. component("ozone_base") {
  68. sources = [
  69. "public/gl_ozone.h",
  70. "public/gpu_platform_support_host.cc",
  71. "public/gpu_platform_support_host.h",
  72. "public/hardware_capabilities.h",
  73. "public/input_controller.cc",
  74. "public/input_controller.h",
  75. "public/native_pixmap_gl_binding.cc",
  76. "public/native_pixmap_gl_binding.h",
  77. "public/overlay_candidates_ozone.cc",
  78. "public/overlay_candidates_ozone.h",
  79. "public/overlay_manager_ozone.h",
  80. "public/overlay_plane.cc",
  81. "public/overlay_plane.h",
  82. "public/overlay_surface.cc",
  83. "public/overlay_surface.h",
  84. "public/overlay_surface_candidate.cc",
  85. "public/overlay_surface_candidate.h",
  86. "public/platform_clipboard.h",
  87. "public/platform_gl_egl_utility.cc",
  88. "public/platform_gl_egl_utility.h",
  89. "public/platform_global_shortcut_listener.cc",
  90. "public/platform_global_shortcut_listener.h",
  91. "public/platform_keyboard_hook.cc",
  92. "public/platform_keyboard_hook.h",
  93. "public/platform_menu_utils.cc",
  94. "public/platform_menu_utils.h",
  95. "public/platform_screen.cc",
  96. "public/platform_screen.h",
  97. "public/platform_user_input_monitor.cc",
  98. "public/platform_user_input_monitor.h",
  99. "public/platform_utils.h",
  100. "public/platform_window_surface.h",
  101. "public/surface_factory_ozone.cc",
  102. "public/surface_factory_ozone.h",
  103. "public/surface_ozone_canvas.cc",
  104. "public/surface_ozone_canvas.h",
  105. "public/swap_completion_callback.h",
  106. "public/system_input_injector.h",
  107. ]
  108. defines = [ "IS_OZONE_BASE_IMPL" ]
  109. public_deps = [
  110. ":ozone_switches",
  111. "//base",
  112. "//gpu/vulkan:buildflags",
  113. "//ipc",
  114. "//skia",
  115. "//ui/base/clipboard:clipboard_types",
  116. "//ui/display",
  117. "//ui/display/types",
  118. "//ui/display/util",
  119. "//ui/events",
  120. "//ui/events:dom_keycode_converter",
  121. "//ui/events/devices:devices",
  122. "//ui/gfx",
  123. "//ui/gfx/geometry",
  124. "//ui/gfx/ipc",
  125. "//ui/gfx/ipc/buffer_types",
  126. "//ui/gfx/ipc/geometry",
  127. "//ui/gfx/ipc/skia",
  128. "//ui/gl",
  129. "//ui/ozone/public/mojom:gesture_properties_service",
  130. ]
  131. if (enable_vulkan) {
  132. public_deps += [ "//gpu/vulkan" ]
  133. }
  134. if (is_fuchsia) {
  135. public_deps += [ "//third_party/fuchsia-sdk/sdk/fidl/fuchsia.images" ]
  136. }
  137. visibility += [
  138. # Everyone should depend on //ui/ozone instead except a handful of
  139. # things that would otherwise create a cycle.
  140. "//chromeos/system:system",
  141. "//ui/base/ime/ash/*",
  142. "//ui/events/ozone/*",
  143. "//ui/ozone/common/*",
  144. "//ui/ozone/platform/*",
  145. ]
  146. configs += [ "//third_party/khronos:khronos_headers" ]
  147. # Out of tree platforms can depend on this.
  148. visibility += ozone_external_platform_visibility
  149. }
  150. source_set("platform") {
  151. sources = [
  152. "common/base_keyboard_hook.cc",
  153. "common/base_keyboard_hook.h",
  154. "common/stub_client_native_pixmap_factory.cc",
  155. "common/stub_client_native_pixmap_factory.h",
  156. "platform_constructor_list.h",
  157. "platform_object_internal.h",
  158. "platform_selection.cc",
  159. "platform_selection.h",
  160. "public/client_native_pixmap_factory_ozone.cc",
  161. "public/ozone_platform.cc",
  162. constructor_list_cc_file,
  163. platform_list_cc_file,
  164. platform_list_h_file,
  165. ]
  166. public = [
  167. "platform_object.h",
  168. "public/client_native_pixmap_factory_ozone.h",
  169. "public/ozone_platform.h",
  170. ]
  171. defines = [ "IS_OZONE_IMPL" ]
  172. public_deps = [
  173. ":ozone_base",
  174. "//base",
  175. "//ipc",
  176. "//services/service_manager/public/cpp",
  177. "//skia",
  178. "//ui/base:data_exchange",
  179. "//ui/display/types",
  180. "//ui/events",
  181. "//ui/events/devices",
  182. "//ui/gfx",
  183. "//ui/gfx/geometry",
  184. "//ui/platform_window",
  185. ]
  186. deps = [
  187. ":generate_constructor_list",
  188. ":generate_ozone_platform_list",
  189. ]
  190. deps += ozone_platform_deps
  191. # Platforms are always linked into //ui/ozone and can include our headers.
  192. allow_circular_includes_from = ozone_platform_deps
  193. # This is used for platform tests.
  194. visibility += [ "//ui/ozone/platform/*" ]
  195. # This can be used for out of tree platforms tests.
  196. visibility += ozone_external_platform_visibility
  197. }
  198. source_set("ozone_switches") {
  199. sources = [
  200. "public/ozone_switches.cc",
  201. "public/ozone_switches.h",
  202. ]
  203. defines = [ "IS_OZONE_SWITCHES_IMPL" ]
  204. deps = [ "//base" ]
  205. visibility += [
  206. "//chrome/test:browser_tests_runner",
  207. "//content/public/browser:browser_sources",
  208. ]
  209. }
  210. component("ozone") {
  211. visibility = []
  212. visibility = [ "*" ]
  213. public_deps = [
  214. ":buildflags",
  215. ":platform",
  216. ]
  217. }
  218. source_set("test_support_internal") {
  219. testonly = true
  220. sources = [
  221. "test/mock_platform_window_delegate.cc",
  222. "test/mock_platform_window_delegate.h",
  223. ]
  224. configs += [ "//build/config:precompiled_headers" ]
  225. deps = [
  226. "//mojo/public/cpp/bindings",
  227. "//testing/gmock",
  228. "//testing/gtest",
  229. "//ui/base",
  230. "//ui/gfx:test_support",
  231. "//ui/gfx/geometry",
  232. "//ui/platform_window:platform_window",
  233. ]
  234. public_deps = [ "//base/test:test_support" ]
  235. }
  236. static_library("ui_test_support") {
  237. visibility = []
  238. visibility = [ "//ui/views:test_support" ]
  239. testonly = true
  240. sources = [
  241. "common/test/stub_ozone_ui_controls_test_helper.cc",
  242. "common/test/stub_ozone_ui_controls_test_helper.h",
  243. "public/ozone_ui_controls_test_helper.cc",
  244. test_constructor_list_cc_file,
  245. ]
  246. public = [ "public/ozone_ui_controls_test_helper.h" ]
  247. deps = [
  248. ":generate_test_support_constructor_list",
  249. ":ozone",
  250. "//ui/base:test_support",
  251. "//ui/events:events_base",
  252. ]
  253. deps += ozone_platform_ui_test_support_deps
  254. allow_circular_includes_from = ozone_platform_ui_test_support_deps
  255. }
  256. source_set("ozone_interactive_ui_tests") {
  257. visibility = []
  258. visibility = [ "//chrome/test:interactive_ui_tests${exec_target_suffix}" ]
  259. testonly = true
  260. deps = ozone_platform_interactive_ui_tests_sources
  261. }
  262. static_library("test_support") {
  263. visibility = []
  264. visibility = [
  265. ":*",
  266. "platform/flatland:flatland_unittests",
  267. "platform/wayland:test_support",
  268. "platform/wayland:wayland_unittests",
  269. "platform/x11:x11_unittests",
  270. ]
  271. testonly = true
  272. public_deps = [ ":test_support_internal" ]
  273. }
  274. action("generate_ozone_platform_list") {
  275. script = "generate_ozone_platform_list.py"
  276. outputs = [
  277. platform_list_cc_file,
  278. platform_list_h_file,
  279. platform_list_txt_file,
  280. ]
  281. args =
  282. [
  283. "--output_cc=" + rebase_path(platform_list_cc_file, root_build_dir),
  284. "--output_h=" + rebase_path(platform_list_h_file, root_build_dir),
  285. "--output_txt=" + rebase_path(platform_list_txt_file, root_build_dir),
  286. "--default=$ozone_platform",
  287. ] + ozone_platforms
  288. visibility += [ "//media:*" ]
  289. }
  290. source_set("ozone_gpu_test_support") {
  291. visibility = []
  292. visibility = [ "//components/viz/demo:viz_demo" ]
  293. sources = [ "public/ozone_gpu_test_helper.cc" ]
  294. public = [ "public/ozone_gpu_test_helper.h" ]
  295. public_deps = [
  296. ":platform",
  297. "//base",
  298. ]
  299. }
  300. action("generate_constructor_list") {
  301. script = "generate_constructor_list.py"
  302. inputs = [ platform_list_txt_file ]
  303. outputs = [ constructor_list_cc_file ]
  304. args = [
  305. "--platform_list=" + rebase_path(platform_list_txt_file, root_build_dir),
  306. "--output_cc=" + rebase_path(constructor_list_cc_file, root_build_dir),
  307. "--namespace=ui",
  308. "--typename=OzonePlatform",
  309. "--typename=ClientNativePixmapFactory",
  310. "--using=gfx::ClientNativePixmapFactory",
  311. "--include=\"ui/gfx/client_native_pixmap_factory.h\"",
  312. "--include=\"ui/ozone/public/ozone_platform.h\"",
  313. ]
  314. deps = [ ":generate_ozone_platform_list" ]
  315. }
  316. action("generate_test_support_constructor_list") {
  317. script = "generate_constructor_list.py"
  318. inputs = [ platform_list_txt_file ]
  319. outputs = [ test_constructor_list_cc_file ]
  320. args = [
  321. "--platform_list=" + rebase_path(platform_list_txt_file, root_build_dir),
  322. "--output_cc=" + rebase_path(test_constructor_list_cc_file, root_build_dir),
  323. "--namespace=ui",
  324. "--typename=OzoneUIControlsTestHelper",
  325. "--include=\"ui/ozone/public/ozone_ui_controls_test_helper.h\"",
  326. "--include=\"ui/ozone/public/ozone_platform.h\"",
  327. ]
  328. deps = [ ":generate_ozone_platform_list" ]
  329. }
  330. test("ozone_unittests") {
  331. if (is_chromeos_lacros && is_chromeos_device) {
  332. configs += [ "//build/lacros:optional_shared_libgcc" ]
  333. }
  334. deps = [
  335. ":test_support",
  336. "//mojo/core/test:run_all_unittests",
  337. "//ui/ozone/common:unittests",
  338. ]
  339. # Add tests of platform internals.
  340. deps += ozone_platform_test_deps
  341. # Platform tests link ozone statically. Make sure we're not getting a
  342. # 2nd copy of any code via the component.
  343. assert_no_deps = [ "//ui/ozone" ]
  344. data_deps = [ "//testing/buildbot/filters:ozone_unittests_filters" ]
  345. }
  346. # X11 backend has its own test suite only built when we are using the x11
  347. # backend.
  348. if (ozone_platform_x11) {
  349. test("ozone_x11_unittests") {
  350. use_xvfb = true
  351. deps = [
  352. ":test_support",
  353. "//mojo/core/test:run_all_unittests",
  354. ]
  355. deps += [ "platform/x11:x11_unittests" ]
  356. # Platform tests link ozone statically. Make sure we're not getting a
  357. # 2nd copy of any code via the component.
  358. assert_no_deps = [ "//ui/ozone" ]
  359. }
  360. }
  361. test("ozone_integration_tests") {
  362. testonly = true
  363. visibility += [ "*" ]
  364. sources = [ "test/ozone_integration_tests_main.cc" ]
  365. deps = [
  366. "//base/test:test_support",
  367. "//mojo/core/embedder",
  368. ]
  369. deps += ozone_platform_integration_test_deps
  370. }
  371. buildflag_header("buildflags") {
  372. header = "buildflags.h"
  373. flags = [
  374. "OZONE_PLATFORM_WAYLAND=$ozone_platform_wayland",
  375. "OZONE_PLATFORM_X11=$ozone_platform_x11",
  376. ]
  377. visibility += [ "*" ]
  378. }
  379. group("unittests") {
  380. testonly = true
  381. visibility += [ "*" ]
  382. deps = [
  383. ":ozone_unittests",
  384. "//ui/ozone/gl:ozone_gl_unittests",
  385. ]
  386. if (ozone_platform_x11) {
  387. deps += [ "//ui/ozone:ozone_x11_unittests" ]
  388. }
  389. }