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}
10
11// Generate custom headers
12gensrcs {
13    name: "rs_generated_headers_support",
14    tools: ["rsg-generator"],
15    tool_files: [
16        "rs.spec",
17        "rs_compat.spec",
18    ],
19    cmd: "cat $(location rs.spec) $(location rs_compat.spec) | $(location rsg-generator) $(in) $(out)",
20    output_extension: "h",
21    srcs: [
22        "rsgApiStructs.h_rsg",
23        "rsgApiFuncDecl.h_rsg",
24    ],
25    export_include_dirs: ["."],
26}
27
28gensrcs {
29    name: "rs_generated_sources_support",
30    tools: ["rsg-generator"],
31    tool_files: [
32        "rs.spec",
33        "rs_compat.spec",
34    ],
35    cmd: "cat $(location rs.spec) $(location rs_compat.spec) | $(location rsg-generator) $(in) $(out)",
36    output_extension: "cpp",
37    srcs: [
38        "rsgApi.cpp_rsg",
39        "rsgApiReplay.cpp_rsg",
40    ],
41}
42
43cc_library_shared {
44    name: "libRSSupport",
45    defaults: ["rs_support_defaults"],
46    sdk_version: "9",
47
48    srcs: [
49        "rsAllocation.cpp",
50        "rsApiAllocation.cpp",
51        "rsApiContext.cpp",
52        "rsApiDevice.cpp",
53        "rsApiElement.cpp",
54        "rsApiType.cpp",
55        "rsClosure.cpp",
56        "rsComponent.cpp",
57        "rsContext.cpp",
58        "rsCppUtils.cpp",
59        "rsDevice.cpp",
60        "rsDriverLoader.cpp",
61        "rsElement.cpp",
62        "rsFifoSocket.cpp",
63        "rsObjectBase.cpp",
64        "rsMatrix2x2.cpp",
65        "rsMatrix3x3.cpp",
66        "rsMatrix4x4.cpp",
67        "rsMutex.cpp",
68        "rsSampler.cpp",
69        "rsScript.cpp",
70        "rsScriptC.cpp",
71        "rsScriptC_Lib.cpp",
72        "rsScriptGroup.cpp",
73        "rsScriptGroup2.cpp",
74        "rsScriptIntrinsic.cpp",
75        "rsSignal.cpp",
76        "rsStream.cpp",
77        "rsThreadIO.cpp",
78        "rsType.cpp",
79        "driver/rsdAllocation.cpp",
80        "driver/rsdBcc.cpp",
81        "driver/rsdCore.cpp",
82        "driver/rsdElement.cpp",
83        "driver/rsdRuntimeStubs.cpp",
84        "driver/rsdSampler.cpp",
85        "driver/rsdScriptGroup.cpp",
86        "driver/rsdType.cpp",
87        "cpu_ref/rsCpuCore.cpp",
88        "cpu_ref/rsCpuExecutable.cpp",
89        "cpu_ref/rsCpuScript.cpp",
90        "cpu_ref/rsCpuRuntimeMath.cpp",
91        "cpu_ref/rsCpuScriptGroup.cpp",
92        "cpu_ref/rsCpuScriptGroup2.cpp",
93        "cpu_ref/rsCpuIntrinsic.cpp",
94        "cpu_ref/rsCpuIntrinsic3DLUT.cpp",
95        "cpu_ref/rsCpuIntrinsicBlend.cpp",
96        "cpu_ref/rsCpuIntrinsicBlur.cpp",
97        "cpu_ref/rsCpuIntrinsicBLAS.cpp",
98        "cpu_ref/rsCpuIntrinsicColorMatrix.cpp",
99        "cpu_ref/rsCpuIntrinsicConvolve3x3.cpp",
100        "cpu_ref/rsCpuIntrinsicConvolve5x5.cpp",
101        "cpu_ref/rsCpuIntrinsicHistogram.cpp",
102        "cpu_ref/rsCpuIntrinsicLUT.cpp",
103        "cpu_ref/rsCpuIntrinsicResize.cpp",
104        "cpu_ref/rsCpuIntrinsicYuvToRGB.cpp",
105    ],
106
107    generated_sources: ["rs_generated_sources_support"],
108    generated_headers: ["rs_generated_headers_support"],
109
110    arch: {
111        arm: {
112            cflags: [
113                "-DARCH_ARM_HAVE_VFP",
114                "-DARCH_ARM_USE_INTRINSICS",
115            ],
116            asflags: ["-mfpu=neon"],
117            srcs: [
118                "cpu_ref/rsCpuIntrinsics_neon_3DLUT.S",
119                "cpu_ref/rsCpuIntrinsics_neon_Blend.S",
120                "cpu_ref/rsCpuIntrinsics_neon_Blur.S",
121                "cpu_ref/rsCpuIntrinsics_neon_ColorMatrix.S",
122                "cpu_ref/rsCpuIntrinsics_neon_Convolve.S",
123                "cpu_ref/rsCpuIntrinsics_neon_Resize.S",
124                "cpu_ref/rsCpuIntrinsics_neon_YuvToRGB.S",
125            ],
126
127            neon: {
128                cflags: ["-DARCH_ARM_HAVE_NEON"]
129            },
130        },
131
132        arm64: {
133            cflags: [
134                "-DARCH_ARM_USE_INTRINSICS",
135                "-DARCH_ARM64_USE_INTRINSICS",
136                "-DARCH_ARM64_HAVE_NEON",
137            ],
138            srcs: [
139                "cpu_ref/rsCpuIntrinsics_advsimd_3DLUT.S",
140                "cpu_ref/rsCpuIntrinsics_advsimd_Blend.S",
141                "cpu_ref/rsCpuIntrinsics_advsimd_Blur.S",
142                "cpu_ref/rsCpuIntrinsics_advsimd_ColorMatrix.S",
143                "cpu_ref/rsCpuIntrinsics_advsimd_Convolve.S",
144                "cpu_ref/rsCpuIntrinsics_advsimd_Resize.S",
145                "cpu_ref/rsCpuIntrinsics_advsimd_YuvToRGB.S",
146            ],
147        },
148
149        x86: {
150            cflags: ["-DARCH_X86_HAVE_SSSE3"],
151            srcs: ["cpu_ref/rsCpuIntrinsics_x86.cpp"],
152        },
153
154        x86_64: {
155            cflags: ["-DARCH_X86_HAVE_SSSE3"],
156            srcs: ["cpu_ref/rsCpuIntrinsics_x86.cpp"],
157        },
158    },
159
160    required: ["libblasV8"],
161    static_libs: ["libbnnmlowpV8"],
162    shared_libs: [
163        "liblog",
164        "libdl",
165    ],
166    ldflags: [
167        "-Wl,--exclude-libs,libc++_static.a",
168        "-Wl,--hash-style=sysv",
169    ],
170    stl: "c++_static",
171
172    cflags: [
173        "-Werror",
174        "-Wall",
175        "-Wextra",
176        "-Wno-unused-parameter",
177        "-Wno-unused-variable",
178        "-Wno-overloaded-virtual",
179        "-DRS_COMPATIBILITY_LIB",
180
181        "-DGEMMLOWP_USE_STLPORT",
182        // TODO: why isn't this picked up from the host GLOBAL_CFLAGS?
183        "-D__STDC_FORMAT_MACROS",
184
185        // Allow implicit fallthrough in rsContext.cpp:414 until it is fixed.
186        "-Wno-error=implicit-fallthrough",
187    ],
188
189    target: {
190        platform: {
191            shared_libs: ["libnativewindow"],
192        },
193    },
194}
195