1cc_defaults {
2    name: "rs_support_defaults",
3    product_variables: {
4        unbundled_build: {
5            // Unbundled builds use prebuilts in prebuilts/sdk/renderscript instead
6            enabled: false,
7        },
8    },
9    cflags: [
10        "-Wno-deprecated-declarations",
11    ],
12}
13
14// Generate custom headers
15gensrcs {
16    name: "rs_generated_headers_support",
17    tools: ["rsg-generator"],
18    tool_files: [
19        "rs.spec",
20        "rs_compat.spec",
21    ],
22    cmd: "cat $(location rs.spec) $(location rs_compat.spec) | $(location rsg-generator) $(in) $(out)",
23    output_extension: "h",
24    srcs: [
25        "rsgApiStructs.h_rsg",
26        "rsgApiFuncDecl.h_rsg",
27    ],
28    export_include_dirs: ["."],
29}
30
31gensrcs {
32    name: "rs_generated_sources_support",
33    tools: ["rsg-generator"],
34    tool_files: [
35        "rs.spec",
36        "rs_compat.spec",
37    ],
38    cmd: "cat $(location rs.spec) $(location rs_compat.spec) | $(location rsg-generator) $(in) $(out)",
39    output_extension: "cpp",
40    srcs: [
41        "rsgApi.cpp_rsg",
42        "rsgApiReplay.cpp_rsg",
43    ],
44}
45
46cc_defaults {
47    name: "libRSSupport_defaults",
48    defaults: ["rs_support_defaults"],
49    srcs: [
50        "rsAllocation.cpp",
51        "rsApiAllocation.cpp",
52        "rsApiContext.cpp",
53        "rsApiDevice.cpp",
54        "rsApiElement.cpp",
55        "rsApiType.cpp",
56        "rsClosure.cpp",
57        "rsComponent.cpp",
58        "rsContext.cpp",
59        "rsCppUtils.cpp",
60        "rsDevice.cpp",
61        "rsDriverLoader.cpp",
62        "rsElement.cpp",
63        "rsFifoSocket.cpp",
64        "rsObjectBase.cpp",
65        "rsMatrix2x2.cpp",
66        "rsMatrix3x3.cpp",
67        "rsMatrix4x4.cpp",
68        "rsMutex.cpp",
69        "rsSampler.cpp",
70        "rsScript.cpp",
71        "rsScriptC.cpp",
72        "rsScriptC_Lib.cpp",
73        "rsScriptGroup.cpp",
74        "rsScriptGroup2.cpp",
75        "rsScriptIntrinsic.cpp",
76        "rsSignal.cpp",
77        "rsStream.cpp",
78        "rsThreadIO.cpp",
79        "rsType.cpp",
80        "driver/rsdAllocation.cpp",
81        "driver/rsdBcc.cpp",
82        "driver/rsdCore.cpp",
83        "driver/rsdElement.cpp",
84        "driver/rsdRuntimeStubs.cpp",
85        "driver/rsdSampler.cpp",
86        "driver/rsdScriptGroup.cpp",
87        "driver/rsdType.cpp",
88        "cpu_ref/rsCpuCore.cpp",
89        "cpu_ref/rsCpuExecutable.cpp",
90        "cpu_ref/rsCpuScript.cpp",
91        "cpu_ref/rsCpuRuntimeMath.cpp",
92        "cpu_ref/rsCpuScriptGroup.cpp",
93        "cpu_ref/rsCpuScriptGroup2.cpp",
94        "cpu_ref/rsCpuIntrinsic.cpp",
95        "cpu_ref/rsCpuIntrinsic3DLUT.cpp",
96        "cpu_ref/rsCpuIntrinsicBlend.cpp",
97        "cpu_ref/rsCpuIntrinsicBlur.cpp",
98        "cpu_ref/rsCpuIntrinsicBLAS.cpp",
99        "cpu_ref/rsCpuIntrinsicColorMatrix.cpp",
100        "cpu_ref/rsCpuIntrinsicConvolve3x3.cpp",
101        "cpu_ref/rsCpuIntrinsicConvolve5x5.cpp",
102        "cpu_ref/rsCpuIntrinsicHistogram.cpp",
103        "cpu_ref/rsCpuIntrinsicLUT.cpp",
104        "cpu_ref/rsCpuIntrinsicResize.cpp",
105        "cpu_ref/rsCpuIntrinsicYuvToRGB.cpp",
106    ],
107
108    generated_sources: ["rs_generated_sources_support"],
109    generated_headers: ["rs_generated_headers_support"],
110
111    arch: {
112        arm: {
113            cflags: [
114                "-DARCH_ARM_HAVE_NEON",
115                "-DARCH_ARM_HAVE_VFP",
116                "-DARCH_ARM_USE_INTRINSICS",
117            ],
118            srcs: [
119                "cpu_ref/rsCpuIntrinsics_neon_3DLUT.S",
120                "cpu_ref/rsCpuIntrinsics_neon_Blend.S",
121                "cpu_ref/rsCpuIntrinsics_neon_Blur.S",
122                "cpu_ref/rsCpuIntrinsics_neon_ColorMatrix.S",
123                "cpu_ref/rsCpuIntrinsics_neon_Convolve.S",
124                "cpu_ref/rsCpuIntrinsics_neon_Resize.S",
125                "cpu_ref/rsCpuIntrinsics_neon_YuvToRGB.S",
126            ],
127        },
128
129        arm64: {
130            cflags: [
131                "-DARCH_ARM_USE_INTRINSICS",
132                "-DARCH_ARM64_USE_INTRINSICS",
133                "-DARCH_ARM64_HAVE_NEON",
134            ],
135            srcs: [
136                "cpu_ref/rsCpuIntrinsics_advsimd_3DLUT.S",
137                "cpu_ref/rsCpuIntrinsics_advsimd_Blend.S",
138                "cpu_ref/rsCpuIntrinsics_advsimd_Blur.S",
139                "cpu_ref/rsCpuIntrinsics_advsimd_ColorMatrix.S",
140                "cpu_ref/rsCpuIntrinsics_advsimd_Convolve.S",
141                "cpu_ref/rsCpuIntrinsics_advsimd_Resize.S",
142                "cpu_ref/rsCpuIntrinsics_advsimd_YuvToRGB.S",
143            ],
144        },
145
146        x86: {
147            cflags: ["-DARCH_X86_HAVE_SSSE3"],
148            srcs: ["cpu_ref/rsCpuIntrinsics_x86.cpp"],
149        },
150
151        x86_64: {
152            cflags: ["-DARCH_X86_HAVE_SSSE3"],
153            srcs: ["cpu_ref/rsCpuIntrinsics_x86.cpp"],
154        },
155    },
156
157    required: ["libblasV8"],
158    static_libs: ["libbnnmlowpV8"],
159    shared_libs: [
160        "liblog",
161        "libdl",
162    ],
163    ldflags: [
164        "-Wl,--exclude-libs,libc++_static.a",
165        "-Wl,--hash-style=sysv",
166    ],
167    stl: "c++_static",
168
169    cflags: [
170        "-Werror",
171        "-Wall",
172        "-Wextra",
173        "-Wno-unused-parameter",
174        "-Wno-unused-variable",
175        "-Wno-overloaded-virtual",
176        "-DRS_COMPATIBILITY_LIB",
177
178        "-DGEMMLOWP_USE_STLPORT",
179
180        // Allow implicit fallthrough in rsContext.cpp:414 until it is fixed.
181        "-Wno-error=implicit-fallthrough",
182    ],
183}
184
185cc_library_shared {
186    name: "libRSSupport",
187    defaults: ["libRSSupport_defaults"],
188    sdk_version: "9",
189
190    target: {
191        platform: {
192            shared_libs: ["libnativewindow"],
193        },
194    },
195}
196
197// Note: libnative_bridge_guest libraries don't support "sdk_version" - and we
198// must use libnative_bridge_guest_libnativewindow instead of libnativewindow
199// when we are doing native_bridge build.
200cc_library_shared {
201    name: "libnative_bridge_guest_libRSSupport",
202    stem: "libRSSupport",
203    defaults: ["libRSSupport_defaults"],
204
205    // Import headers not provided by libnative_bridge_guest_libnativewindow.
206    header_libs: [
207        "libarect_headers",
208        "libnativewindow_headers"
209    ],
210
211    shared_libs: [
212        "libnative_bridge_guest_libnativewindow",
213    ],
214
215    enabled: false,
216    native_bridge_supported: true,
217    target: {
218       native_bridge: {
219           enabled: true,
220       }
221    },
222}
223