1# Copyright 2018 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
5import("//device/vr/buildflags/buildflags.gni")
6import("//mojo/public/tools/bindings/mojom.gni")
7
8mojom_component("vr_service") {
9  output_prefix = "device_vr_service_mojo_bindings"
10  macro_prefix = "DEVICE_VR_SERVICE_MOJO_BINDINGS"
11
12  sources = [ "vr_service.mojom" ]
13
14  public_deps = [
15    ":test_mojom",
16    "//device/gamepad/public/mojom",
17    "//gpu/ipc/common:interfaces",
18    "//mojo/public/mojom/base",
19    "//skia/public/mojom",
20    "//ui/display/mojom:mojom",
21    "//ui/gfx/geometry/mojom",
22    "//ui/gfx/mojom",
23  ]
24
25  enabled_features = []
26  if (enable_windows_mr) {
27    enabled_features += [ "enable_windows_mr" ]
28  }
29  if (enable_openxr) {
30    enabled_features += [ "enable_openxr" ]
31  }
32
33  shared_cpp_typemap = {
34    types = [
35      {
36        mojom = "device.mojom.RgbaTupleF16"
37        cpp = "::device::RgbaTupleF16"
38      },
39      {
40        mojom = "device.mojom.RgbTupleF32"
41        cpp = "::device::RgbTupleF32"
42      },
43      {
44        mojom = "device.mojom.Pose"
45        cpp = "::device::Pose"
46      },
47    ]
48    traits_headers = [ "//device/vr/public/mojom/vr_service_mojom_traits.h" ]
49    traits_public_deps = [ ":vr_public_typemaps" ]
50  }
51
52  cpp_typemaps = [ shared_cpp_typemap ]
53  blink_cpp_typemaps = [ shared_cpp_typemap ]
54}
55
56# Separating the public mojom interface into vr_service and isolated_xr_service
57# components allows us to add dependencies to isolated_xr_service without having
58# a blink variant. The blink variant tends to cause problematic, unresolved externals.
59mojom_component("isolated_xr_service") {
60  output_prefix = "device_vr_isolated_xr_service_mojo_bindings"
61  macro_prefix = "DEVICE_VR_ISOLATED_XR_SERVICE_MOJO_BINDINGS"
62
63  sources = [ "isolated_xr_service.mojom" ]
64
65  disable_variants = true
66
67  public_deps = [
68    ":test_mojom",
69    ":vr_service",
70    "//gpu/ipc/common:interfaces",
71    "//mojo/public/mojom/base",
72    "//skia/public/mojom",
73    "//ui/gfx/geometry/mojom",
74  ]
75}
76
77mojom_component("test_mojom") {
78  output_prefix = "device_vr_test_mojo_bindings"
79  macro_prefix = "DEVICE_VR_TEST_MOJO_BINDINGS"
80
81  sources = [ "browser_test_interfaces.mojom" ]
82
83  public_deps = [
84    "//ui/gfx/geometry/mojom",
85    "//ui/gfx/mojom",
86  ]
87}
88
89component("vr_public_typemaps") {
90  output_name = "device_vr_public_typemaps"
91
92  defines = [ "IS_VR_PUBLIC_TYPEMAPS_IMPL" ]
93
94  sources = [
95    "pose.cc",
96    "pose.h",
97  ]
98
99  deps = [
100    "//base:base",
101    "//skia",
102    "//ui/gfx:geometry_skia",
103    "//ui/gfx/geometry:geometry",
104  ]
105}
106