aboutsummaryrefslogtreecommitdiff
path: root/gpu_display/Android.bp
blob: 18a04722ec531ad78396f8d082fadbf5af6e7f09 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
// This file is generated by cargo_embargo.
// Do not modify this file as changes will be overridden on upgrade.

// cargo2android.py limitations:
//   does not handle "-l dylib=wayland-client" yet
//   does not generate cc_library module yet
//   does not generate wayland_protocol_codegen module yet

package {
    // See: http://go/android-license-faq
    // A large-scale-change added 'default_applicable_licenses' to import
    // all of the 'license_kinds' from "external_crosvm_license"
    // to get the below license kinds:
    //   SPDX-license-identifier-BSD
    //   SPDX-license-identifier-MIT
    default_applicable_licenses: ["external_crosvm_license"],
}

rust_library {
    name: "libgpu_display",
    defaults: ["crosvm_inner_defaults"],
    host_supported: true,
    crate_name: "gpu_display",
    cargo_env_compat: true,
    cargo_pkg_version: "0.1.0",
    srcs: ["src/lib.rs"],
    edition: "2021",
    features: [
        "android_display",
    ],
    rustlibs: [
        "libanyhow",
        "libbase_rust",
        "libcfg_if",
        "liblibc",
        "liblinux_input_sys",
        "libserde",
        "libsync_rust",
        "libthiserror",
        "libvm_control",
        "libzerocopy",
    ],
    proc_macros: ["libremain"],
    static_libs: ["libdisplay_wl"],

    // added manually
    target: {
        host: {
            shared_libs: ["libwayland_client"],
            features: ["android_display_stub"],
        },
        android: {
            static_libs: [
                "libwayland_client_static",
                "libffi",
                "libcrosvm_android_display_client",
            ],
            shared_libs: [
                "libc++",
                "libbinder_ndk",
                "libnativewindow",
            ],
        },
    },
}

cc_library_static {
    name: "libdisplay_wl",
    host_supported: true,
    c_std: "c11",
    srcs: ["src/display_wl.c"],

    generated_sources: [
        "gpu_display_protocol_sources",
        "wayland_extension_protocol_sources",
    ],
    generated_headers: [
        "gpu_display_client_protocol_headers",
    ],
    export_generated_headers: [
        "gpu_display_client_protocol_headers",
    ],

    // added manually
    target: {
        host: {
            shared_libs: ["libwayland_client"],
        },
        android: {
            static_libs: [
                "libwayland_client_static",
                "libffi",
            ],
        },
    },
    apex_available: [
        "//apex_available:platform",
        "com.android.virt",
    ],
}

// We could use the modules provided in //external/wayland-protocols, except
//
//  1. virtio-gpu-metadata-v1.xml is missing
//  2. crosvm expects a different header suffix

wayland_protocol_codegen {
    name: "gpu_display_protocol_sources",
    cmd: "$(location wayland_scanner) private-code < $(in) > $(out)",
    suffix: ".c",
    srcs: [
        ":wayland_extension_protocols",
        "protocol/virtio-gpu-metadata-v1.xml",
    ],
    tools: ["wayland_scanner"],
}

wayland_protocol_codegen {
    name: "gpu_display_client_protocol_headers",
    cmd: "$(location wayland_scanner) client-header < $(in) > $(out)",
    suffix: ".h",
    srcs: [
        ":wayland_extension_protocols",
        "protocol/virtio-gpu-metadata-v1.xml",
    ],
    tools: ["wayland_scanner"],
}

wayland_protocol_codegen {
    name: "gpu_display_server_protocol_headers",
    cmd: "$(location wayland_scanner) server-header < $(in) > $(out)",
    suffix: ".h",
    srcs: [
        ":wayland_extension_protocols",
        "protocol/virtio-gpu-metadata-v1.xml",
    ],
    tools: ["wayland_scanner"],
}

cc_library_static {
    name: "libwayland_crosvm_gpu_display_extension_server_protocols",
    vendor_available: true,
    host_supported: true,
    cflags: [
        "-Wall",
        "-Wextra",
        "-Werror",
        "-g",
        "-fvisibility=hidden",
    ],
    static_libs: ["libwayland_server"],
    generated_sources: ["gpu_display_protocol_sources"],
    generated_headers: ["gpu_display_server_protocol_headers"],
    export_generated_headers: ["gpu_display_server_protocol_headers"],
}