1package {
2    default_applicable_licenses: ["Android-Apache-2.0"],
3}
4
5cc_library_headers {
6    name: "rs-headers",
7    export_include_dirs: ["."],
8    sdk_version: "9",
9}
10
11cc_defaults {
12    name: "rs_defaults",
13    cflags: [
14        "-Werror",
15        "-Wall",
16        "-Wextra",
17        "-Wno-deprecated-declarations",
18        "-Wno-unused-parameter",
19        "-Wno-unused-variable",
20    ],
21    arch: {
22        riscv64: {
23            enabled: false,
24        },
25    },
26}
27
28cc_library_shared {
29    name: "libRSDriver",
30    vendor_available: true,
31    native_bridge_supported: true,
32    double_loadable: true,
33    defaults: ["rs_defaults"],
34
35    srcs: [
36        "driver/rsdAllocation.cpp",
37        "driver/rsdBcc.cpp",
38        "driver/rsdCore.cpp",
39        "driver/rsdElement.cpp",
40        "driver/rsdFrameBuffer.cpp",
41        "driver/rsdFrameBufferObj.cpp",
42        "driver/rsdGL.cpp",
43        "driver/rsdMesh.cpp",
44        "driver/rsdMeshObj.cpp",
45        "driver/rsdProgram.cpp",
46        "driver/rsdProgramRaster.cpp",
47        "driver/rsdProgramStore.cpp",
48        "driver/rsdRuntimeStubs.cpp",
49        "driver/rsdSampler.cpp",
50        "driver/rsdScriptGroup.cpp",
51        "driver/rsdShader.cpp",
52        "driver/rsdShaderCache.cpp",
53        "driver/rsdType.cpp",
54        "driver/rsdVertexArray.cpp",
55    ],
56
57    shared_libs: [
58        "libRS_internal",
59        "libRSCpuRef",
60
61        "liblog",
62        "libEGL",
63        "libGLESv1_CM",
64        "libGLESv2",
65
66        "libnativewindow",
67
68        "libbcinfo",
69    ],
70
71    static_libs: ["libarect"],
72
73    header_libs: [
74        "libcutils_headers",
75        "libutils_headers",
76        "libnativebase_headers",
77    ],
78
79    // Bug: http://b/77445194 - Disable x86 asan where rsdRuntimeStubs.cpp has
80    // undefined reference to half-conversion routines (__gnu_h2f_ieee,
81    // __gnu_f2h_ieee).
82    arch: {
83        x86: {
84            sanitize: {
85                never: true,
86            },
87        },
88    },
89
90    target: {
91        native_bridge : {
92            header_libs: [
93                "libnativewindow_headers",
94                "media_ndk_headers",
95            ],
96            shared_libs: [
97                "libnative_bridge_guest_libEGL",
98                "libnative_bridge_guest_libGLESv1_CM",
99                "libnative_bridge_guest_libGLESv2",
100                "libnative_bridge_guest_libnativewindow",
101            ],
102            exclude_shared_libs: [
103                "libEGL",
104                "libGLESv1_CM",
105                "libGLESv2",
106                "libnativewindow",
107            ],
108        },
109    },
110}
111
112// Build rsg-generator ====================
113
114cc_binary_host {
115    name: "rsg-generator",
116
117    srcs: [
118        "spec.l",
119        "rsg_generator.c",
120    ],
121
122    cflags: [
123        "-Wno-unused-function",
124    ],
125
126    stl: "none",
127    sanitize: {
128        never: true,
129    },
130}
131
132// Generate custom headers
133gensrcs {
134    name: "rs_generated_headers",
135    tools: ["rsg-generator"],
136    tool_files: [
137        "rs.spec",
138        "rsg.spec",
139    ],
140    cmd: "cat $(location rs.spec) $(location rsg.spec) | $(location rsg-generator) $(in) $(out)",
141    output_extension: "h",
142    srcs: [
143        "rsgApiStructs.h_rsg",
144        "rsgApiFuncDecl.h_rsg",
145    ],
146    export_include_dirs: ["."],
147}
148
149gensrcs {
150    name: "rs_generated_sources",
151    tools: ["rsg-generator"],
152    tool_files: [
153        "rs.spec",
154        "rsg.spec",
155    ],
156    cmd: "cat $(location rs.spec) $(location rsg.spec) | $(location rsg-generator) $(in) $(out)",
157    output_extension: "cpp",
158    srcs: [
159        "rsgApi.cpp_rsg",
160        "rsgApiReplay.cpp_rsg",
161    ],
162}
163
164cc_library_shared {
165    name: "libRS_internal",
166    vendor_available: true,
167    native_bridge_supported: true,
168    double_loadable: true,
169    defaults: ["rs_defaults"],
170
171    srcs: [
172        "rsApiAllocation.cpp",
173        "rsApiContext.cpp",
174        "rsApiDevice.cpp",
175        "rsApiElement.cpp",
176        "rsApiFileA3D.cpp",
177        "rsApiMesh.cpp",
178        "rsApiType.cpp",
179        "rsAllocation.cpp",
180        "rsAnimation.cpp",
181        "rsComponent.cpp",
182        "rsContext.cpp",
183        "rsClosure.cpp",
184        "rsCppUtils.cpp",
185        "rsDevice.cpp",
186        "rsDriverLoader.cpp",
187        "rsElement.cpp",
188        "rsFBOCache.cpp",
189        "rsFifoSocket.cpp",
190        "rsFileA3D.cpp",
191        "rsFont.cpp",
192        "rsGrallocConsumer.cpp",
193        "rsObjectBase.cpp",
194        "rsMatrix2x2.cpp",
195        "rsMatrix3x3.cpp",
196        "rsMatrix4x4.cpp",
197        "rsMesh.cpp",
198        "rsMutex.cpp",
199        "rsProgram.cpp",
200        "rsProgramFragment.cpp",
201        "rsProgramStore.cpp",
202        "rsProgramRaster.cpp",
203        "rsProgramVertex.cpp",
204        "rsSampler.cpp",
205        "rsScript.cpp",
206        "rsScriptC.cpp",
207        "rsScriptC_Lib.cpp",
208        "rsScriptC_LibGL.cpp",
209        "rsScriptGroup.cpp",
210        "rsScriptGroup2.cpp",
211        "rsScriptIntrinsic.cpp",
212        "rsSignal.cpp",
213        "rsStream.cpp",
214        "rsThreadIO.cpp",
215        "rsType.cpp",
216    ],
217
218    generated_sources: ["rs_generated_sources"],
219    generated_headers: ["rs_generated_headers"],
220
221    shared_libs: [
222        "liblog",
223        "libutilscallstack",
224        "libutils",
225        "libEGL",
226        "libGLESv1_CM",
227        "libGLESv2",
228
229        "libdl",
230        "libnativewindow",
231
232        "libft2",
233
234        "libbcinfo",
235        "libmediandk",
236    ],
237
238    static_libs: ["libarect"],
239
240    // These runtime modules are required for RenderScript.
241    required: [
242        "libclcore.bc",
243        "libclcore_debug.bc",
244        "libclcore_debug_g.bc",
245        "libclcore_g.bc",
246    ],
247
248    // Some runtime modules, such as libcompiler_rt, are also
249    // required from non-system variant.
250    runtime_libs: [
251        "libcompiler_rt",
252    ],
253
254    arch: {
255        arm: {
256            required: ["libclcore_neon.bc"],
257        },
258        x86: {
259            required: ["libclcore_x86.bc"],
260        },
261        x86_64: {
262            required: ["libclcore_x86.bc"],
263        },
264    },
265
266    product_variables: {
267        override_rs_driver: {
268            cflags: ["-DOVERRIDE_RS_DRIVER=%s"],
269        },
270    },
271
272    target: {
273        native_bridge: {
274            header_libs: [
275                "libnativewindow_headers",
276                "media_ndk_headers",
277            ],
278            shared_libs: [
279                "libnative_bridge_guest_libEGL",
280                "libnative_bridge_guest_libGLESv1_CM",
281                "libnative_bridge_guest_libGLESv2",
282                "libnative_bridge_guest_libmediandk",
283                "libnative_bridge_guest_libnativewindow",
284            ],
285            exclude_shared_libs: [
286                "libEGL",
287                "libGLESv1_CM",
288                "libGLESv2",
289                "libmediandk",
290                "libnativewindow",
291            ],
292        },
293    },
294}
295
296cc_library_shared {
297    name: "libRS",
298    defaults: ["rs_defaults"],
299    native_bridge_supported: true,
300    llndk: {
301        symbol_file: "libRS.map",
302    },
303    srcs: [
304        "rsApiStubs.cpp",
305        "rsHidlAdaptation.cpp",
306        "rsFallbackAdaptation.cpp",
307    ],
308
309    // Default CPU fallback
310    required: [
311        "libRS_internal",
312        "libRSDriver",
313        "libRSCacheDir",
314    ],
315
316    // Treble configuration
317    shared_libs: [
318        "libhidlbase",
319        "libutilscallstack",
320        "libutils",
321        "android.hardware.renderscript@1.0",
322
323        "liblog",
324        "libcutils",
325    ],
326
327    static_libs: ["libRSDispatch"],
328
329    version_script: "libRS.map",
330}
331
332cc_library_shared {
333    name: "libRSCacheDir",
334    defaults: ["rs_defaults"],
335
336    srcs: ["rsCacheDir.cpp"],
337    shared_libs: [
338        "libandroid_runtime",
339        "liblog",
340    ],
341}
342
343prebuilt_renderscript_bitcode {
344    name: "libclcore.bc",
345    arch: {
346        arm: {
347            src: "driver/runtime/prebuilts/arm/lib/libclcore.bc",
348        },
349        arm64: {
350            src: "driver/runtime/prebuilts/arm/lib64/libclcore.bc",
351        },
352        x86: {
353            src: "driver/runtime/prebuilts/x86/lib/libclcore.bc",
354        },
355        x86_64: {
356            src: "driver/runtime/prebuilts/x86/lib64/libclcore.bc",
357        },
358    },
359}
360
361prebuilt_renderscript_bitcode {
362    name: "libclcore_debug.bc",
363    arch: {
364        arm: {
365            src: "driver/runtime/prebuilts/arm/lib/libclcore_debug.bc",
366        },
367        arm64: {
368            src: "driver/runtime/prebuilts/arm/lib64/libclcore_debug.bc",
369        },
370        x86: {
371            src: "driver/runtime/prebuilts/x86/lib/libclcore_debug.bc",
372        },
373        x86_64: {
374            src: "driver/runtime/prebuilts/x86/lib64/libclcore_debug.bc",
375        },
376    },
377}
378
379prebuilt_renderscript_bitcode {
380    name: "libclcore_x86.bc",
381    arch: {
382        arm: {
383            enabled: false,
384        },
385        arm64: {
386            enabled: false,
387        },
388        x86: {
389            src: "driver/runtime/prebuilts/x86/lib/libclcore_x86.bc",
390        },
391        x86_64: {
392            src: "driver/runtime/prebuilts/x86/lib64/libclcore_x86.bc",
393        },
394    },
395}
396
397prebuilt_renderscript_bitcode {
398    name: "libclcore_neon.bc",
399    arch: {
400        arm: {
401            src: "driver/runtime/prebuilts/arm/lib/libclcore_neon.bc",
402        },
403        arm64: {
404            // These are only 32-bit libraries.
405            enabled: false,
406        },
407        x86: {
408            // Using the ARM version is fine for native_bridge.
409            src: "driver/runtime/prebuilts/arm/lib/libclcore_neon.bc",
410        },
411        x86_64: {
412            // These are only 32-bit libraries.
413            enabled: false,
414        },
415    },
416}
417
418prebuilt_renderscript_bitcode {
419    name: "libclcore_g.bc",
420    arch: {
421        arm: {
422            src: "driver/runtime/prebuilts/arm/lib/libclcore_g.bc",
423        },
424        arm64: {
425            src: "driver/runtime/prebuilts/arm/lib64/libclcore_g.bc",
426        },
427        x86: {
428            src: "driver/runtime/prebuilts/x86/lib/libclcore_g.bc",
429        },
430        x86_64: {
431            src: "driver/runtime/prebuilts/x86/lib64/libclcore_g.bc",
432        },
433    },
434}
435
436prebuilt_renderscript_bitcode {
437    name: "libclcore_debug_g.bc",
438    arch: {
439        arm: {
440            src: "driver/runtime/prebuilts/arm/lib/libclcore_debug_g.bc",
441        },
442        arm64: {
443            src: "driver/runtime/prebuilts/arm/lib64/libclcore_debug_g.bc",
444        },
445        x86: {
446            src: "driver/runtime/prebuilts/x86/lib/libclcore_debug_g.bc",
447        },
448        x86_64: {
449            src: "driver/runtime/prebuilts/x86/lib64/libclcore_debug_g.bc",
450        },
451    },
452}
453
454build = [
455    "support.bp",
456]
457
458subdirs = [
459    "cpp",
460    "cpu_ref",
461    "script_api",
462    "support",
463    "toolkit",
464]
465