• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// This file is generated by cargo_embargo.
2// Do not modify this file after the first "rust_*" or "genrule" module
3// because the changes will be overridden on upgrade.
4// Content before the first "rust_*" or "genrule" module is preserved.
5
6// cargo2android.py limitations:
7//   does not handle "-l dylib=wayland-client" yet
8//   does not generate cc_library module yet
9//   does not generate wayland_protocol_codegen module yet
10
11package {
12    // See: http://go/android-license-faq
13    // A large-scale-change added 'default_applicable_licenses' to import
14    // all of the 'license_kinds' from "external_crosvm_license"
15    // to get the below license kinds:
16    //   SPDX-license-identifier-BSD
17    //   SPDX-license-identifier-MIT
18    default_applicable_licenses: ["external_crosvm_license"],
19}
20
21rust_library {
22    name: "libgpu_display",
23    defaults: ["crosvm_inner_defaults"],
24    host_supported: true,
25    crate_name: "gpu_display",
26    cargo_env_compat: true,
27    cargo_pkg_version: "0.1.0",
28    srcs: ["src/lib.rs"],
29    edition: "2021",
30    features: [
31        "android_display",
32    ],
33    rustlibs: [
34        "libanyhow",
35        "libbase_rust",
36        "libcfg_if",
37        "liblibc",
38        "liblinux_input_sys",
39        "libserde",
40        "libsync_rust",
41        "libthiserror",
42        "libvm_control",
43        "libzerocopy",
44    ],
45    proc_macros: ["libremain"],
46    static_libs: ["libdisplay_wl"],
47
48    // added manually
49    target: {
50        host: {
51            shared_libs: ["libwayland_client"],
52            features: ["android_display_stub"],
53        },
54        android: {
55            static_libs: [
56                "libwayland_client_static",
57                "libffi",
58                "libcrosvm_android_display_client",
59            ],
60            shared_libs: [
61                "libc++",
62                "libbinder_ndk",
63                "libnativewindow",
64            ],
65        },
66    },
67}
68
69cc_library_static {
70    name: "libdisplay_wl",
71    host_supported: true,
72    c_std: "c11",
73    srcs: ["src/display_wl.c"],
74
75    generated_sources: [
76        "gpu_display_protocol_sources",
77        "wayland_extension_protocol_sources",
78    ],
79    generated_headers: [
80        "gpu_display_client_protocol_headers",
81    ],
82    export_generated_headers: [
83        "gpu_display_client_protocol_headers",
84    ],
85
86    // added manually
87    target: {
88        host: {
89            shared_libs: ["libwayland_client"],
90        },
91        android: {
92            static_libs: [
93                "libwayland_client_static",
94                "libffi",
95            ],
96        },
97    },
98    apex_available: [
99        "com.android.virt",
100    ],
101}
102
103// We could use the modules provided in //external/wayland-protocols, except
104//
105//  1. virtio-gpu-metadata-v1.xml is missing
106//  2. crosvm expects a different header suffix
107
108wayland_protocol_codegen {
109    name: "gpu_display_protocol_sources",
110    cmd: "$(location wayland_scanner) private-code < $(in) > $(out)",
111    suffix: ".c",
112    srcs: [
113        ":wayland_extension_protocols",
114        "protocol/virtio-gpu-metadata-v1.xml",
115    ],
116    tools: ["wayland_scanner"],
117}
118
119wayland_protocol_codegen {
120    name: "gpu_display_client_protocol_headers",
121    cmd: "$(location wayland_scanner) client-header < $(in) > $(out)",
122    suffix: ".h",
123    srcs: [
124        ":wayland_extension_protocols",
125        "protocol/virtio-gpu-metadata-v1.xml",
126    ],
127    tools: ["wayland_scanner"],
128}
129
130wayland_protocol_codegen {
131    name: "gpu_display_server_protocol_headers",
132    cmd: "$(location wayland_scanner) server-header < $(in) > $(out)",
133    suffix: ".h",
134    srcs: [
135        ":wayland_extension_protocols",
136        "protocol/virtio-gpu-metadata-v1.xml",
137    ],
138    tools: ["wayland_scanner"],
139}
140
141cc_library_static {
142    name: "libwayland_crosvm_gpu_display_extension_server_protocols",
143    vendor_available: true,
144    host_supported: true,
145    cflags: [
146        "-Wall",
147        "-Wextra",
148        "-Werror",
149        "-g",
150        "-fvisibility=hidden",
151    ],
152    static_libs: ["libwayland_server"],
153    generated_sources: ["gpu_display_protocol_sources"],
154    generated_headers: ["gpu_display_server_protocol_headers"],
155    export_generated_headers: ["gpu_display_server_protocol_headers"],
156}
157