1// Build the ETC1 library
2package {
3    // See: http://go/android-license-faq
4    // A large-scale-change added 'default_applicable_licenses' to import
5    // all of the 'license_kinds' from "frameworks_native_license"
6    // to get the below license kinds:
7    //   SPDX-license-identifier-Apache-2.0
8    default_applicable_licenses: ["frameworks_native_license"],
9}
10
11cc_library {
12    name: "libETC1",
13    srcs: ["ETC1/etc1.cpp"],
14    host_supported: true,
15    cflags: ["-Wall", "-Werror"],
16
17    target: {
18        android: {
19            static: {
20                enabled: false,
21            },
22        },
23        host: {
24            shared: {
25                enabled: false,
26            },
27        },
28        windows: {
29            enabled: true,
30        },
31    },
32}
33
34// The headers modules are in frameworks/native/opengl/Android.bp.
35ndk_library {
36    name: "libEGL",
37    symbol_file: "libEGL.map.txt",
38    first_version: "9",
39    unversioned_until: "current",
40}
41
42ndk_library {
43    name: "libGLESv1_CM",
44    symbol_file: "libGLESv1_CM.map.txt",
45    first_version: "9",
46    unversioned_until: "current",
47}
48
49ndk_library {
50    name: "libGLESv2",
51    symbol_file: "libGLESv2.map.txt",
52    first_version: "9",
53    unversioned_until: "current",
54}
55
56ndk_library {
57    name: "libGLESv3",
58    symbol_file: "libGLESv3.map.txt",
59    first_version: "18",
60    unversioned_until: "current",
61}
62
63cc_defaults {
64    name: "gl_libs_defaults",
65    cflags: [
66        "-DGL_GLEXT_PROTOTYPES",
67        "-DEGL_EGLEXT_PROTOTYPES",
68        "-fvisibility=hidden",
69        "-Wall",
70        "-Werror",
71        "-Wno-unused-variable",
72    ],
73    shared_libs: [
74        // ***** DO NOT ADD NEW DEPENDENCIES HERE *****
75        // In particular, DO NOT add libutils or anything "above" libcutils
76        "libcutils",
77        "liblog",
78        "libdl",
79    ],
80    static_libs: [
81        "libarect",
82    ],
83    header_libs: [
84        "bionic_libc_platform_headers",
85        "gl_headers",
86        "libsystem_headers",
87        "libnativebase_headers",
88    ],
89    export_header_lib_headers: ["gl_headers"],
90}
91
92//##############################################################################
93// Build META EGL library
94//
95cc_defaults {
96    name: "egl_libs_defaults",
97    defaults: ["gl_libs_defaults"],
98    cflags: [
99        "-DLOG_TAG=\"libEGL\"",
100        "-Wall",
101        "-Werror",
102        "-Wno-error=deprecated-register",
103        "-Wno-error=unknown-attributes",
104        "-Wno-unused-variable",
105    ],
106    shared_libs: [
107        // ***** DO NOT ADD NEW DEPENDENCIES HERE *****
108        // In particular, DO NOT add libutils nor anything "above" libui
109        "libgraphicsenv",
110        "libnativewindow",
111        "libbacktrace",
112        "libbase",
113    ],
114}
115
116cc_library_static {
117    name: "libEGL_getProcAddress",
118    defaults: ["egl_libs_defaults"],
119    srcs: ["EGL/getProcAddress.cpp"],
120    arch: {
121        arm: {
122            instruction_set: "arm",
123        },
124    },
125}
126
127cc_library_static {
128    name: "libEGL_blobCache",
129    defaults: ["egl_libs_defaults"],
130    srcs: [
131        "EGL/BlobCache.cpp",
132        "EGL/FileBlobCache.cpp",
133    ],
134    export_include_dirs: ["EGL"],
135}
136
137cc_library_shared {
138    name: "libEGL",
139    defaults: ["egl_libs_defaults"],
140    llndk: {
141        symbol_file: "libEGL.map.txt",
142        export_llndk_headers: ["gl_headers"],
143        // Don't export EGL/include from the LLNDK variant.
144        override_export_include_dirs: [],
145    },
146    srcs: [
147        "EGL/egl_tls.cpp",
148        "EGL/egl_cache.cpp",
149        "EGL/egl_display.cpp",
150        "EGL/egl_object.cpp",
151        "EGL/egl_layers.cpp",
152        "EGL/egl.cpp",
153        "EGL/eglApi.cpp",
154        "EGL/egl_platform_entries.cpp",
155        "EGL/Loader.cpp",
156        "EGL/egl_angle_platform.cpp",
157    ],
158    shared_libs: [
159        "libvndksupport",
160        "android.hardware.configstore@1.0",
161        "android.hardware.configstore-utils",
162        "libbase",
163        "libhidlbase",
164        "libnativebridge_lazy",
165        "libnativeloader_lazy",
166        "libutils",
167        "libSurfaceFlingerProp",
168    ],
169    static_libs: [
170        "libEGL_getProcAddress",
171        "libEGL_blobCache",
172    ],
173    ldflags: ["-Wl,--exclude-libs=ALL,--Bsymbolic-functions"],
174    export_include_dirs: ["EGL/include"],
175    stubs: {
176        symbol_file: "libEGL.map.txt",
177        versions: ["29"],
178    },
179    header_libs: ["libsurfaceflinger_headers"],
180}
181
182cc_test {
183    name: "libEGL_test",
184    defaults: ["egl_libs_defaults"],
185    srcs: [
186        "EGL/BlobCache.cpp",
187        "EGL/BlobCache_test.cpp",
188    ],
189}
190
191cc_defaults {
192    name: "gles_libs_defaults",
193    defaults: ["gl_libs_defaults"],
194    arch: {
195        arm: {
196            instruction_set: "arm",
197
198            // TODO: This is to work around b/20093774. Remove after root cause is fixed
199            ldflags: ["-Wl,--hash-style,both"],
200        },
201    },
202    shared_libs: ["libEGL"],
203}
204
205//##############################################################################
206// Build the wrapper OpenGL ES 1.x library
207//
208cc_library_shared {
209    name: "libGLESv1_CM",
210    defaults: ["gles_libs_defaults"],
211    llndk: {
212        symbol_file: "libGLESv1_CM.map.txt",
213        export_llndk_headers: ["gl_headers"],
214        // Don't export EGL/include from the LLNDK variant.
215        override_export_include_dirs: [],
216    },
217    srcs: ["GLES_CM/gl.cpp"],
218    cflags: ["-DLOG_TAG=\"libGLESv1\""],
219    version_script: "libGLESv1_CM.map.txt",
220}
221
222//##############################################################################
223// Build the wrapper OpenGL ES 2.x library
224//
225cc_library_shared {
226    name: "libGLESv2",
227    defaults: ["gles_libs_defaults"],
228    llndk: {
229        symbol_file: "libGLESv2.map.txt",
230        export_llndk_headers: ["gl_headers"],
231        // Don't export EGL/include from the LLNDK variant.
232        override_export_include_dirs: [],
233    },
234    srcs: ["GLES2/gl2.cpp"],
235    cflags: ["-DLOG_TAG=\"libGLESv2\""],
236
237    // Bug: http://b/133874658  Disable native_coverage as we investigate a
238    // crash in surfaceflinger on coverage-enabled cuttlefish builds.
239    native_coverage: false,
240}
241
242//##############################################################################
243// Build the wrapper OpenGL ES 3.x library (this is just different name for v2)
244//
245cc_library_shared {
246    name: "libGLESv3",
247    defaults: ["gles_libs_defaults"],
248    llndk: {
249        symbol_file: "libGLESv3.map.txt",
250        export_llndk_headers: ["gl_headers"],
251        // Don't export EGL/include from the LLNDK variant.
252        override_export_include_dirs: [],
253    },
254    srcs: ["GLES2/gl2.cpp"],
255    cflags: ["-DLOG_TAG=\"libGLESv3\""],
256}
257