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        "gl_headers",
76        "libsystem_headers",
77        "libhardware_headers",
78        "libnativebase_headers",
79    ],
80    export_header_lib_headers: ["gl_headers"],
81
82    // we need to access the private Bionic header <bionic_tls.h>
83    include_dirs: ["bionic/libc/private"],
84}
85
86//##############################################################################
87// Build META EGL library
88//
89cc_defaults {
90    name: "egl_libs_defaults",
91    defaults: ["gl_libs_defaults"],
92    cflags: [
93        "-DLOG_TAG=\"libEGL\"",
94        "-Wall",
95        "-Werror",
96        "-Wno-error=deprecated-register",
97        "-Wno-error=unknown-attributes",
98        "-Wno-unused-variable",
99    ],
100    shared_libs: [
101        // ***** DO NOT ADD NEW DEPENDENCIES HERE *****
102        // In particular, DO NOT add libutils nor anything "above" libui
103        "libgraphicsenv",
104        "libnativewindow",
105        "libbacktrace",
106    ],
107    target: {
108        vendor: {
109            exclude_shared_libs: ["libgraphicsenv"],
110        },
111    },
112}
113
114cc_library_static {
115    name: "libEGL_getProcAddress",
116    defaults: ["egl_libs_defaults"],
117    srcs: ["EGL/getProcAddress.cpp"],
118    arch: {
119        arm: {
120            instruction_set: "arm",
121        },
122    },
123}
124
125cc_library_static {
126    name: "libEGL_blobCache",
127    defaults: ["egl_libs_defaults"],
128    srcs: [
129        "EGL/BlobCache.cpp",
130        "EGL/FileBlobCache.cpp",
131    ],
132    export_include_dirs: ["EGL"],
133}
134
135cc_library_shared {
136    name: "libEGL",
137    defaults: ["egl_libs_defaults"],
138    srcs: [
139        "EGL/egl_tls.cpp",
140        "EGL/egl_cache.cpp",
141        "EGL/egl_display.cpp",
142        "EGL/egl_object.cpp",
143        "EGL/egl.cpp",
144        "EGL/eglApi.cpp",
145        "EGL/Loader.cpp",
146    ],
147    shared_libs: [
148        "libvndksupport",
149        "android.hardware.configstore@1.0",
150        "android.hardware.configstore-utils",
151        "libhidlbase",
152        "libhidltransport",
153        "libutils",
154    ],
155    static_libs: [
156        "libEGL_getProcAddress",
157        "libEGL_blobCache",
158    ],
159    ldflags: ["-Wl,--exclude-libs=ALL"],
160    export_include_dirs: ["EGL/include"],
161}
162
163cc_test {
164    name: "libEGL_test",
165    defaults: ["egl_libs_defaults"],
166    srcs: [
167        "EGL/BlobCache.cpp",
168        "EGL/BlobCache_test.cpp",
169    ],
170}
171
172cc_defaults {
173    name: "gles_libs_defaults",
174    defaults: ["gl_libs_defaults"],
175    arch: {
176        arm: {
177            instruction_set: "arm",
178
179            // TODO: This is to work around b/20093774. Remove after root cause is fixed
180            ldflags: ["-Wl,--hash-style,both"],
181        },
182    },
183    shared_libs: ["libEGL"],
184}
185
186//##############################################################################
187// Build the wrapper OpenGL ES 1.x library
188//
189cc_library_shared {
190    name: "libGLESv1_CM",
191    defaults: ["gles_libs_defaults"],
192    srcs: ["GLES_CM/gl.cpp"],
193    cflags: ["-DLOG_TAG=\"libGLESv1\""],
194}
195
196//##############################################################################
197// Build the wrapper OpenGL ES 2.x library
198//
199cc_library_shared {
200    name: "libGLESv2",
201    defaults: ["gles_libs_defaults"],
202    srcs: ["GLES2/gl2.cpp"],
203    cflags: ["-DLOG_TAG=\"libGLESv2\""],
204}
205
206//##############################################################################
207// Build the wrapper OpenGL ES 3.x library (this is just different name for v2)
208//
209cc_library_shared {
210    name: "libGLESv3",
211    defaults: ["gles_libs_defaults"],
212    srcs: ["GLES2/gl2.cpp"],
213    cflags: ["-DLOG_TAG=\"libGLESv3\""],
214}
215