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