blob: bf3c5ce36b35b1fe99949333467ee0068ec68f39 [file] [log] [blame]
# Copyright 2014 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/buildflag_header.gni")
import("//build/config/ozone.gni")
import("//build/config/python.gni")
import("//build/config/ui.gni")
import("//gpu/vulkan/features.gni")
import("//testing/test.gni")
assert(use_ozone)
visibility = [ ":*" ]
# The list of platforms that will be built.
ozone_platforms = ozone_external_platforms
# Extra dependencies to pull into ui/ozone for built platforms.
ozone_platform_deps = ozone_external_platform_deps
# Extra dependencies to pull into ozone_unittests for built platforms.
ozone_platform_test_deps = ozone_external_platform_test_deps
# Extra dependencies to pull into ozone_integration_tests
ozone_platform_integration_test_deps =
ozone_external_platform_integration_test_deps
# Extra dependencies to pull into ui_test_support for built platforms.
ozone_platform_ui_test_support_deps =
ozone_external_platform_ui_test_support_deps
# Extra dependencies to pull into interactive_ui_tests for built platforms.
ozone_platform_interactive_ui_tests_sources =
ozone_external_interactive_ui_tests_deps
if (ozone_platform_headless) {
ozone_platforms += [ "headless" ]
ozone_platform_deps += [ "platform/headless" ]
}
if (ozone_platform_drm) {
ozone_platforms += [ "drm" ]
ozone_platform_deps += [ "platform/drm:gbm" ]
ozone_platform_test_deps += [ "platform/drm:gbm_unittests" ]
ozone_platform_integration_test_deps +=
[ "platform/drm:drm_integration_tests" ]
}
if (ozone_platform_cast) {
ozone_platforms += [ "cast" ]
ozone_platform_deps += [ "platform/cast" ]
}
if (ozone_platform_wayland) {
ozone_platforms += [ "wayland" ]
ozone_platform_deps += [ "platform/wayland" ]
ozone_platform_test_deps += [ "platform/wayland:wayland_unittests" ]
ozone_platform_ui_test_support_deps += [ "platform/wayland:ui_test_support" ]
}
if (ozone_platform_x11) {
ozone_platforms += [ "x11" ]
ozone_platform_deps += [ "platform/x11" ]
ozone_platform_ui_test_support_deps += [ "platform/x11:test_support" ]
}
if (ozone_platform_flatland) {
ozone_platforms += [ "flatland" ]
ozone_platform_deps += [ "platform/flatland" ]
ozone_platform_test_deps += [ "platform/flatland:flatland_unittests" ]
}
platform_list_cc_file = "$target_gen_dir/platform_list.cc"
platform_list_h_file = "$target_gen_dir/platform_list.h"
platform_list_txt_file = "$target_gen_dir/platform_list.txt"
constructor_list_cc_file = "$target_gen_dir/constructor_list.cc"
test_constructor_list_cc_file = "$target_gen_dir/test_constructor_list.cc"
component("ozone_base") {
sources = [
"public/gl_ozone.h",
"public/gpu_platform_support_host.cc",
"public/gpu_platform_support_host.h",
"public/hardware_capabilities.h",
"public/input_controller.cc",
"public/input_controller.h",
"public/native_pixmap_gl_binding.cc",
"public/native_pixmap_gl_binding.h",
"public/overlay_candidates_ozone.cc",
"public/overlay_candidates_ozone.h",
"public/overlay_manager_ozone.h",
"public/overlay_plane.cc",
"public/overlay_plane.h",
"public/overlay_surface.cc",
"public/overlay_surface.h",
"public/overlay_surface_candidate.cc",
"public/overlay_surface_candidate.h",
"public/platform_clipboard.h",
"public/platform_gl_egl_utility.cc",
"public/platform_gl_egl_utility.h",
"public/platform_global_shortcut_listener.cc",
"public/platform_global_shortcut_listener.h",
"public/platform_keyboard_hook.cc",
"public/platform_keyboard_hook.h",
"public/platform_menu_utils.cc",
"public/platform_menu_utils.h",
"public/platform_screen.cc",
"public/platform_screen.h",
"public/platform_user_input_monitor.cc",
"public/platform_user_input_monitor.h",
"public/platform_utils.h",
"public/platform_window_surface.h",
"public/surface_factory_ozone.cc",
"public/surface_factory_ozone.h",
"public/surface_ozone_canvas.cc",
"public/surface_ozone_canvas.h",
"public/swap_completion_callback.h",
"public/system_input_injector.h",
]
defines = [ "IS_OZONE_BASE_IMPL" ]
public_deps = [
":drm_modifiers_filter",
":ozone_switches",
"//base",
"//gpu/vulkan:buildflags",
"//ipc",
"//skia",
"//ui/base:types",
"//ui/base/clipboard:clipboard_types",
"//ui/display",
"//ui/display/types",
"//ui/display/util",
"//ui/events",
"//ui/events:dom_keycode_converter",
"//ui/events/devices:devices",
"//ui/gfx",
"//ui/gfx/geometry",
"//ui/gfx/ipc",
"//ui/gfx/ipc/buffer_types",
"//ui/gfx/ipc/geometry",
"//ui/gfx/ipc/skia",
"//ui/gl",
"//ui/ozone/public/mojom:gesture_properties_service",
]
if (enable_vulkan) {
public_deps += [ "//gpu/vulkan" ]
}
if (is_fuchsia) {
public_deps += [
"//third_party/fuchsia-sdk/sdk/fidl/fuchsia.images:fuchsia.images_hlcpp",
]
}
if (is_linux) {
public_deps += [ "//ui/linux:linux_ui" ]
}
visibility += [
# Everyone should depend on //ui/ozone instead except a handful of
# things that would otherwise create a cycle.
"//ui/base/ime/ash/*",
"//ui/events/ozone/*",
"//ui/ozone/common/*",
"//ui/ozone/platform/*",
]
configs += [ "//third_party/khronos:khronos_headers" ]
# Out of tree platforms can depend on this.
visibility += ozone_external_platform_visibility
}
source_set("platform") {
sources = [
"common/stub_client_native_pixmap_factory.cc",
"common/stub_client_native_pixmap_factory.h",
"platform_constructor_list.h",
"platform_object_internal.h",
"platform_selection.cc",
"platform_selection.h",
"public/client_native_pixmap_factory_ozone.cc",
"public/ozone_platform.cc",
constructor_list_cc_file,
platform_list_cc_file,
platform_list_h_file,
]
public = [
"platform_object.h",
"public/client_native_pixmap_factory_ozone.h",
"public/ozone_platform.h",
]
defines = [ "IS_OZONE_IMPL" ]
public_deps = [
":ozone_base",
"//base",
"//ipc",
"//services/service_manager/public/cpp",
"//skia",
"//ui/base:data_exchange",
"//ui/display/types",
"//ui/events",
"//ui/events/devices",
"//ui/gfx",
"//ui/gfx/geometry",
"//ui/platform_window",
]
deps = [
":generate_constructor_list",
":generate_ozone_platform_list",
]
deps += ozone_platform_deps
# Platforms are always linked into //ui/ozone and can include our headers.
allow_circular_includes_from = ozone_platform_deps
# This is used for platform and clipboard tests.
visibility += [
"//ui/base/clipboard:clipboard_test",
"//ui/ozone/platform/*",
]
# This can be used for out of tree platforms tests.
visibility += ozone_external_platform_visibility
}
source_set("ozone_switches") {
sources = [
"public/ozone_switches.cc",
"public/ozone_switches.h",
]
defines = [ "IS_OZONE_SWITCHES_IMPL" ]
deps = [ "//base" ]
visibility += [
"//chrome/test:browser_tests_runner",
"//media/mojo/services",
"//ui/base/clipboard:clipboard_test",
"//ui/display:display_unittests",
]
}
component("ozone") {
visibility = []
visibility = [ "*" ]
public_deps = [ ":platform" ]
}
source_set("drm_modifiers_filter") {
sources = [ "public/drm_modifiers_filter.h" ]
deps = [
"//base",
"//ui/gfx/ipc/buffer_types",
]
visibility += [ "//gpu/vulkan" ]
}
source_set("test_support_internal") {
testonly = true
sources = [
"test/mock_platform_window_delegate.cc",
"test/mock_platform_window_delegate.h",
]
configs += [ "//build/config:precompiled_headers" ]
deps = [
"//mojo/public/cpp/bindings",
"//testing/gmock",
"//testing/gtest",
"//ui/base",
"//ui/gfx:test_support",
"//ui/gfx/geometry",
"//ui/platform_window:platform_window",
]
public_deps = [ "//base/test:test_support" ]
}
static_library("ui_test_support") {
visibility = []
visibility = [ "//ui/views:test_support" ]
testonly = true
sources = [
"common/test/stub_ozone_ui_controls_test_helper.cc",
"common/test/stub_ozone_ui_controls_test_helper.h",
"public/ozone_ui_controls_test_helper.cc",
test_constructor_list_cc_file,
]
public = [ "public/ozone_ui_controls_test_helper.h" ]
deps = [
":generate_test_support_constructor_list",
":ozone",
"//ui/base:test_support",
"//ui/events:events_base",
]
deps += ozone_platform_ui_test_support_deps
allow_circular_includes_from = ozone_platform_ui_test_support_deps
}
source_set("ozone_interactive_ui_tests") {
visibility = []
visibility = [ "//chrome/test:interactive_ui_tests${exec_target_suffix}" ]
testonly = true
deps = ozone_platform_interactive_ui_tests_sources
}
static_library("test_support") {
visibility = []
visibility = [
":*",
"platform/flatland:flatland_unittests",
"platform/wayland:test_support",
"platform/wayland:wayland_unittests",
"platform/x11:x11_unittests",
]
testonly = true
public_deps = [ ":test_support_internal" ]
}
action("generate_ozone_platform_list") {
script = "generate_ozone_platform_list.py"
outputs = [
platform_list_cc_file,
platform_list_h_file,
platform_list_txt_file,
]
args =
[
"--output_cc=" + rebase_path(platform_list_cc_file, root_build_dir),
"--output_h=" + rebase_path(platform_list_h_file, root_build_dir),
"--output_txt=" + rebase_path(platform_list_txt_file, root_build_dir),
"--default=$ozone_platform",
] + ozone_platforms
visibility += [ "//media:*" ]
}
source_set("ozone_gpu_test_support") {
visibility = []
visibility = [ "//components/viz/demo:viz_demo" ]
sources = [ "public/ozone_gpu_test_helper.cc" ]
public = [ "public/ozone_gpu_test_helper.h" ]
public_deps = [
":platform",
"//base",
]
}
action("generate_constructor_list") {
script = "generate_constructor_list.py"
inputs = [ platform_list_txt_file ]
outputs = [ constructor_list_cc_file ]
args = [
"--platform_list=" + rebase_path(platform_list_txt_file, root_build_dir),
"--output_cc=" + rebase_path(constructor_list_cc_file, root_build_dir),
"--namespace=ui",
"--typename=OzonePlatform",
"--typename=ClientNativePixmapFactory",
"--using=gfx::ClientNativePixmapFactory",
"--include=\"ui/gfx/client_native_pixmap_factory.h\"",
"--include=\"ui/ozone/public/ozone_platform.h\"",
]
deps = [ ":generate_ozone_platform_list" ]
}
action("generate_test_support_constructor_list") {
script = "generate_constructor_list.py"
inputs = [ platform_list_txt_file ]
outputs = [ test_constructor_list_cc_file ]
args = [
"--platform_list=" + rebase_path(platform_list_txt_file, root_build_dir),
"--output_cc=" + rebase_path(test_constructor_list_cc_file, root_build_dir),
"--namespace=ui",
"--typename=OzoneUIControlsTestHelper",
"--include=\"ui/ozone/public/ozone_ui_controls_test_helper.h\"",
"--include=\"ui/ozone/public/ozone_platform.h\"",
]
deps = [ ":generate_ozone_platform_list" ]
}
test("ozone_unittests") {
if (is_chromeos_lacros && is_chromeos_device) {
configs += [ "//build/lacros:optional_shared_libgcc" ]
}
deps = [
":test_support",
"//mojo/core/test:run_all_unittests",
"//ui/ozone/common:unittests",
]
# Add tests of platform internals.
deps += ozone_platform_test_deps
# Platform tests link ozone statically. Make sure we're not getting a
# 2nd copy of any code via the component.
assert_no_deps = [ "//ui/ozone" ]
data_deps = [ "//testing/buildbot/filters:ozone_unittests_filters" ]
if (is_fuchsia) {
additional_manifest_fragments =
[ "//build/config/fuchsia/test/test_ui_stack.shard.test-cml" ]
}
}
# X11 backend has its own test suite only built when we are using the x11
# backend.
if (ozone_platform_x11) {
test("ozone_x11_unittests") {
use_xvfb = true
deps = [
":test_support",
"//mojo/core/test:run_all_unittests",
]
deps += [ "platform/x11:x11_unittests" ]
# Platform tests link ozone statically. Make sure we're not getting a
# 2nd copy of any code via the component.
assert_no_deps = [ "//ui/ozone" ]
}
}
test("ozone_integration_tests") {
testonly = true
visibility += [ "*" ]
sources = [ "test/ozone_integration_tests_main.cc" ]
deps = [
"//base/test:test_support",
"//mojo/core/embedder",
]
deps += ozone_platform_integration_test_deps
}
group("unittests") {
testonly = true
visibility += [ "*" ]
deps = [
":ozone_unittests",
"//ui/ozone/gl:ozone_gl_unittests",
]
if (ozone_platform_x11) {
deps += [ "//ui/ozone:ozone_x11_unittests" ]
}
}