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