xref: /aosp_15_r20/external/crosvm/third_party/virglrenderer/Android.bp (revision bbecb9d118dfdb95f99bd754f8fa9be01f189df3)
1//
2// Copyright (C) 2018 The Android Open Source Project
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8//      http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15//
16
17package {
18    default_applicable_licenses: ["external_virglrenderer_license"],
19}
20
21// Added automatically by a large-scale-change that took the approach of
22// 'apply every license found to every target'. While this makes sure we respect
23// every license restriction, it may not be entirely correct.
24//
25// e.g. GPL in an MIT project might only apply to the contrib/ directory.
26//
27// Please consider splitting the single license below into multiple licenses,
28// taking care not to lose any license_kind information, and overriding the
29// default license using the 'licenses: [...]' property on targets as needed.
30//
31// For unused files, consider creating a 'fileGroup' with "//visibility:private"
32// to attach the license to, and including a comment whether the files may be
33// used in the current project.
34//
35// large-scale-change included anything that looked like it might be a license
36// text as a license_text. e.g. LICENSE, NOTICE, COPYING etc.
37//
38// Please consider removing redundant or irrelevant files from 'license_text:'.
39// See: http://go/android-license-faq
40license {
41    name: "external_virglrenderer_license",
42    visibility: [":__subpackages__"],
43    license_kinds: [
44        "SPDX-license-identifier-BSD",
45        "SPDX-license-identifier-BSL-1.0",
46        "SPDX-license-identifier-MIT",
47    ],
48    license_text: [
49        "COPYING",
50        "LICENSE",
51        "NOTICE",
52    ],
53}
54
55cc_library_headers {
56    name: "virgl_headers",
57    host_supported: true,
58    export_include_dirs: ["src"],
59}
60
61cc_library {
62    name: "libvirglrenderer",
63    host_supported: true,
64
65    // This project's unreachable() macro conflicts with the C23 one.
66    c_std: "gnu17",
67
68    cflags: [
69        "-DHAVE_CONFIG_H",
70        "-include prebuilt-intermediates/config.h",
71        "-Wno-unused-parameter",
72    ],
73    local_include_dirs: [
74        "prebuilt-intermediates",
75        "src",
76        "src/drm",
77        "src/gallium/auxiliary",
78        "src/gallium/auxiliary/util",
79        "src/gallium/include",
80        "src/mesa",
81        "src/mesa/compat",
82        "src/mesa/pipe",
83        "src/mesa/util",
84        "src/venus",
85    ],
86    srcs: [
87        "prebuilt-intermediates/src/u_format_table.c",
88        "src/gallium/auxiliary/cso_cache/cso_cache.c",
89        "src/gallium/auxiliary/cso_cache/cso_hash.c",
90        "src/gallium/auxiliary/tgsi/tgsi_build.c",
91        "src/gallium/auxiliary/tgsi/tgsi_dump.c",
92        "src/gallium/auxiliary/tgsi/tgsi_info.c",
93        "src/gallium/auxiliary/tgsi/tgsi_iterate.c",
94        "src/gallium/auxiliary/tgsi/tgsi_parse.c",
95        "src/gallium/auxiliary/tgsi/tgsi_sanity.c",
96        "src/gallium/auxiliary/tgsi/tgsi_scan.c",
97        "src/gallium/auxiliary/tgsi/tgsi_strings.c",
98        "src/gallium/auxiliary/tgsi/tgsi_text.c",
99        "src/gallium/auxiliary/tgsi/tgsi_util.c",
100        "src/gallium/auxiliary/util/u_debug_describe.c",
101        "src/gallium/auxiliary/util/u_format.c",
102        "src/gallium/auxiliary/util/u_hash_table.c",
103        "src/gallium/auxiliary/util/u_texture.c",
104        "src/mesa/util/anon_file.c",
105        "src/mesa/util/bitscan.c",
106        "src/mesa/util/hash_table.c",
107        "src/mesa/util/os_file.c",
108        "src/mesa/util/os_misc.c",
109        "src/mesa/util/ralloc.c",
110        "src/mesa/util/u_cpu_detect.c",
111        "src/mesa/util/u_debug.c",
112        "src/mesa/util/u_math.c",
113        "src/iov.c",
114        "src/virgl_context.c",
115        "src/virglrenderer.c",
116        "src/virgl_resource.c",
117        "src/virgl_util.c",
118        "src/vrend_blitter.c",
119        "src/vrend_debug.c",
120        "src/vrend_decode.c",
121        "src/vrend_formats.c",
122        "src/vrend_object.c",
123        "src/vrend_renderer.c",
124        "src/vrend_shader.c",
125        "src/vrend_tweaks.c",
126        "src/vrend_winsys.c",
127        "src/vrend_winsys_egl.c",
128        "src/vrend_winsys_gbm_stubs.c",
129    ],
130    target: {
131        host_linux: {
132            shared_libs: [
133                "libepoxy",
134            ],
135        },
136        linux_glibc: {
137            cflags: [
138                "-Wno-#warnings",
139                // FIXME: Figure out how to get C protos for asprintf,
140                // pthread_setname_np and sched_getcpu from glibc sysroot
141                "-Wno-error=implicit-function-declaration",
142            ],
143            // Avoid linking to another host copy of libdrm; this library will cause
144            // binary GPU drivers to be loaded from the host, which might be linked
145            // to a system copy of libdrm, which conflicts with the AOSP one
146            allow_undefined_symbols: true,
147            header_libs: ["libdrm_headers"],
148            exclude_shared_libs: [
149                "libdrm",
150            ],
151        },
152        linux_bionic: {
153            cflags: [
154                // Provide a C proto for memfd_create
155                "-D__USE_GNU",
156                "-DHAVE_MEMFD_CREATE=1",
157            ],
158        },
159        android: {
160            cflags: [
161                // Provide a C proto for memfd_create
162                "-D__USE_GNU",
163                "-DHAVE_MEMFD_CREATE=1",
164            ],
165            shared_libs: [
166                "libcutils",
167                "liblog",
168            ],
169            static_libs: [
170                "libepoxy",
171            ],
172        },
173    },
174    apex_available: [
175        "//apex_available:platform",
176        "com.android.virt",
177    ],
178}
179