xref: /aosp_15_r20/external/crosvm/gpu_display/Android.bp (revision bb4ee6a4ae7042d18b07a98463b9c8b875e44b39)
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    crate_root: "src/lib.rs",
29    edition: "2021",
30    features: [
31        "android_display",
32        "gfxstream",
33    ],
34    rustlibs: [
35        "libanyhow",
36        "libbase_rust",
37        "libcfg_if",
38        "liblibc",
39        "liblinux_input_sys",
40        "libserde",
41        "libsync_rust",
42        "libthiserror",
43        "libvm_control",
44        "libzerocopy",
45    ],
46    proc_macros: ["libremain"],
47    static_libs: ["libdisplay_wl"],
48
49    // added manually
50    target: {
51        host: {
52            shared_libs: ["libwayland_client"],
53            features: ["android_display_stub"],
54        },
55        android: {
56            static_libs: [
57                "libwayland_client_static",
58                "libffi",
59                "libcrosvm_android_display_client",
60            ],
61            shared_libs: [
62                "libc++",
63                "libbinder_ndk",
64                "libnativewindow",
65            ],
66        },
67    },
68}
69
70cc_library_static {
71    name: "libdisplay_wl",
72    host_supported: true,
73    c_std: "c11",
74    srcs: ["src/display_wl.c"],
75
76    generated_sources: [
77        "gpu_display_protocol_sources",
78        "wayland_extension_protocol_sources",
79    ],
80    generated_headers: [
81        "gpu_display_client_protocol_headers",
82    ],
83    export_generated_headers: [
84        "gpu_display_client_protocol_headers",
85    ],
86
87    // added manually
88    target: {
89        host: {
90            shared_libs: ["libwayland_client"],
91        },
92        android: {
93            static_libs: [
94                "libwayland_client_static",
95                "libffi",
96            ],
97        },
98    },
99    apex_available: [
100        "com.android.virt",
101    ],
102}
103
104// We could use the modules provided in //external/wayland-protocols, except
105//
106//  1. virtio-gpu-metadata-v1.xml is missing
107//  2. crosvm expects a different header suffix
108
109wayland_protocol_codegen {
110    name: "gpu_display_protocol_sources",
111    cmd: "$(location wayland_scanner) private-code < $(in) > $(out)",
112    suffix: ".c",
113    srcs: [
114        ":wayland_extension_protocols",
115        "protocol/virtio-gpu-metadata-v1.xml",
116    ],
117    tools: ["wayland_scanner"],
118}
119
120wayland_protocol_codegen {
121    name: "gpu_display_client_protocol_headers",
122    cmd: "$(location wayland_scanner) client-header < $(in) > $(out)",
123    suffix: ".h",
124    srcs: [
125        ":wayland_extension_protocols",
126        "protocol/virtio-gpu-metadata-v1.xml",
127    ],
128    tools: ["wayland_scanner"],
129}
130
131wayland_protocol_codegen {
132    name: "gpu_display_server_protocol_headers",
133    cmd: "$(location wayland_scanner) server-header < $(in) > $(out)",
134    suffix: ".h",
135    srcs: [
136        ":wayland_extension_protocols",
137        "protocol/virtio-gpu-metadata-v1.xml",
138    ],
139    tools: ["wayland_scanner"],
140}
141
142cc_library_static {
143    name: "libwayland_crosvm_gpu_display_extension_server_protocols",
144    vendor_available: true,
145    host_supported: true,
146    cflags: [
147        "-Wall",
148        "-Wextra",
149        "-Werror",
150        "-g",
151        "-fvisibility=hidden",
152    ],
153    static_libs: ["libwayland_server"],
154    generated_sources: ["gpu_display_protocol_sources"],
155    generated_headers: ["gpu_display_server_protocol_headers"],
156    export_generated_headers: ["gpu_display_server_protocol_headers"],
157}
158