1LOCAL_PATH:= $(call my-dir)
2include $(CLEAR_VARS)
3LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
4
5HWUI_NEW_OPS := true
6
7# Enables fine-grained GLES error checking
8# If set to true, every GLES call is wrapped & error checked
9# Has moderate overhead
10HWUI_ENABLE_OPENGL_VALIDATION := false
11
12hwui_src_files := \
13    font/CacheTexture.cpp \
14    font/Font.cpp \
15    hwui/Canvas.cpp \
16    hwui/MinikinSkia.cpp \
17    hwui/MinikinUtils.cpp \
18    hwui/PaintImpl.cpp \
19    hwui/Typeface.cpp \
20    renderstate/Blend.cpp \
21    renderstate/MeshState.cpp \
22    renderstate/OffscreenBufferPool.cpp \
23    renderstate/PixelBufferState.cpp \
24    renderstate/RenderState.cpp \
25    renderstate/Scissor.cpp \
26    renderstate/Stencil.cpp \
27    renderstate/TextureState.cpp \
28    renderthread/CanvasContext.cpp \
29    renderthread/DrawFrameTask.cpp \
30    renderthread/EglManager.cpp \
31    renderthread/RenderProxy.cpp \
32    renderthread/RenderTask.cpp \
33    renderthread/RenderThread.cpp \
34    renderthread/TimeLord.cpp \
35    thread/TaskManager.cpp \
36    utils/Blur.cpp \
37    utils/GLUtils.cpp \
38    utils/LinearAllocator.cpp \
39    utils/NinePatchImpl.cpp \
40    utils/StringUtils.cpp \
41    utils/TestWindowContext.cpp \
42    utils/VectorDrawableUtils.cpp \
43    AmbientShadow.cpp \
44    AnimationContext.cpp \
45    Animator.cpp \
46    AnimatorManager.cpp \
47    AssetAtlas.cpp \
48    Caches.cpp \
49    CanvasState.cpp \
50    ClipArea.cpp \
51    DamageAccumulator.cpp \
52    DeferredDisplayList.cpp \
53    DeferredLayerUpdater.cpp \
54    DeviceInfo.cpp \
55    DisplayList.cpp \
56    DisplayListCanvas.cpp \
57    Dither.cpp \
58    Extensions.cpp \
59    FboCache.cpp \
60    FontRenderer.cpp \
61    FrameInfo.cpp \
62    FrameInfoVisualizer.cpp \
63    GammaFontRenderer.cpp \
64    GlopBuilder.cpp \
65    GpuMemoryTracker.cpp \
66    GradientCache.cpp \
67    Image.cpp \
68    Interpolator.cpp \
69    JankTracker.cpp \
70    Layer.cpp \
71    LayerCache.cpp \
72    LayerRenderer.cpp \
73    LayerUpdateQueue.cpp \
74    Matrix.cpp \
75    OpenGLRenderer.cpp \
76    Patch.cpp \
77    PatchCache.cpp \
78    PathCache.cpp \
79    PathTessellator.cpp \
80    PathParser.cpp \
81    PixelBuffer.cpp \
82    Program.cpp \
83    ProgramCache.cpp \
84    Properties.cpp \
85    PropertyValuesHolder.cpp \
86    PropertyValuesAnimatorSet.cpp \
87    Readback.cpp \
88    RenderBufferCache.cpp \
89    RenderNode.cpp \
90    RenderProperties.cpp \
91    ResourceCache.cpp \
92    ShadowTessellator.cpp \
93    SkiaCanvas.cpp \
94    SkiaCanvasProxy.cpp \
95    SkiaShader.cpp \
96    Snapshot.cpp \
97    SpotShadow.cpp \
98    TessellationCache.cpp \
99    TextDropShadowCache.cpp \
100    Texture.cpp \
101    TextureCache.cpp \
102    VectorDrawable.cpp \
103    protos/hwui.proto
104
105hwui_test_common_src_files := \
106    $(call all-cpp-files-under, tests/common/scenes) \
107    tests/common/TestContext.cpp \
108    tests/common/TestScene.cpp \
109    tests/common/TestUtils.cpp
110
111hwui_cflags := \
112    -DEGL_EGLEXT_PROTOTYPES -DGL_GLEXT_PROTOTYPES \
113    -DATRACE_TAG=ATRACE_TAG_VIEW -DLOG_TAG=\"OpenGLRenderer\" \
114    -Wall -Wno-unused-parameter -Wunreachable-code -Werror
115
116# GCC false-positives on this warning, and since we -Werror that's
117# a problem
118hwui_cflags += -Wno-free-nonheap-object
119
120ifeq (true, $(HWUI_NEW_OPS))
121    hwui_src_files += \
122        BakedOpDispatcher.cpp \
123        BakedOpRenderer.cpp \
124        BakedOpState.cpp \
125        FrameBuilder.cpp \
126        LayerBuilder.cpp \
127        OpDumper.cpp \
128        RecordingCanvas.cpp
129
130    hwui_cflags += -DHWUI_NEW_OPS
131
132endif
133
134ifndef HWUI_COMPILE_SYMBOLS
135    hwui_cflags += -fvisibility=hidden
136endif
137
138ifdef HWUI_COMPILE_FOR_PERF
139    # TODO: Non-arm?
140    hwui_cflags += -fno-omit-frame-pointer -marm -mapcs
141endif
142
143# This has to be lazy-resolved because it depends on the LOCAL_MODULE_CLASS
144# which varies depending on what is being built
145define hwui_proto_include
146$(call local-generated-sources-dir)/proto/$(LOCAL_PATH)
147endef
148
149hwui_c_includes += \
150    external/skia/include/private \
151    external/skia/src/core \
152    external/harfbuzz_ng/src \
153    external/freetype/include
154
155ifneq (false,$(ANDROID_ENABLE_RENDERSCRIPT))
156    hwui_cflags += -DANDROID_ENABLE_RENDERSCRIPT
157    hwui_c_includes += \
158        $(call intermediates-dir-for,STATIC_LIBRARIES,libRS,TARGET,) \
159        frameworks/rs/cpp \
160        frameworks/rs
161endif
162
163ifeq (true, $(HWUI_ENABLE_OPENGL_VALIDATION))
164    hwui_cflags += -include debug/wrap_gles.h
165    hwui_src_files += debug/wrap_gles.cpp
166    hwui_c_includes += frameworks/native/opengl/libs/GLES2
167    hwui_cflags += -DDEBUG_OPENGL=3
168endif
169
170
171# ------------------------
172# static library
173# ------------------------
174
175include $(CLEAR_VARS)
176
177LOCAL_MODULE_CLASS := STATIC_LIBRARIES
178LOCAL_MODULE := libhwui_static
179LOCAL_CFLAGS := $(hwui_cflags)
180LOCAL_SRC_FILES := $(hwui_src_files)
181LOCAL_C_INCLUDES := $(hwui_c_includes) $(call hwui_proto_include)
182LOCAL_EXPORT_C_INCLUDE_DIRS := \
183        $(LOCAL_PATH) \
184        $(hwui_c_includes) \
185        $(call hwui_proto_include)
186
187include $(LOCAL_PATH)/hwui_static_deps.mk
188include $(BUILD_STATIC_LIBRARY)
189
190# ------------------------
191# static library null gpu
192# ------------------------
193
194include $(CLEAR_VARS)
195
196LOCAL_MODULE_CLASS := STATIC_LIBRARIES
197LOCAL_MODULE := libhwui_static_null_gpu
198LOCAL_CFLAGS := \
199        $(hwui_cflags) \
200        -DHWUI_NULL_GPU
201LOCAL_SRC_FILES := \
202        $(hwui_src_files) \
203        debug/nullegl.cpp \
204        debug/nullgles.cpp
205LOCAL_C_INCLUDES := $(hwui_c_includes) $(call hwui_proto_include)
206LOCAL_EXPORT_C_INCLUDE_DIRS := \
207        $(LOCAL_PATH) \
208        $(hwui_c_includes) \
209        $(call hwui_proto_include)
210
211include $(LOCAL_PATH)/hwui_static_deps.mk
212include $(BUILD_STATIC_LIBRARY)
213
214# ------------------------
215# shared library
216# ------------------------
217
218include $(CLEAR_VARS)
219
220LOCAL_MODULE_CLASS := SHARED_LIBRARIES
221LOCAL_MODULE := libhwui
222LOCAL_WHOLE_STATIC_LIBRARIES := libhwui_static
223LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
224
225include $(LOCAL_PATH)/hwui_static_deps.mk
226include $(BUILD_SHARED_LIBRARY)
227
228# ------------------------
229# unit tests
230# ------------------------
231
232include $(CLEAR_VARS)
233
234LOCAL_MODULE := hwui_unit_tests
235LOCAL_MODULE_TAGS := tests
236LOCAL_STATIC_LIBRARIES := libhwui_static_null_gpu
237LOCAL_SHARED_LIBRARIES := libmemunreachable
238LOCAL_CFLAGS := \
239        $(hwui_cflags) \
240        -DHWUI_NULL_GPU
241
242LOCAL_SRC_FILES += \
243    $(hwui_test_common_src_files) \
244    tests/unit/main.cpp \
245    tests/unit/CanvasStateTests.cpp \
246    tests/unit/ClipAreaTests.cpp \
247    tests/unit/DamageAccumulatorTests.cpp \
248    tests/unit/DeviceInfoTests.cpp \
249    tests/unit/FatVectorTests.cpp \
250    tests/unit/FontRendererTests.cpp \
251    tests/unit/GlopBuilderTests.cpp \
252    tests/unit/GpuMemoryTrackerTests.cpp \
253    tests/unit/GradientCacheTests.cpp \
254    tests/unit/LayerUpdateQueueTests.cpp \
255    tests/unit/LinearAllocatorTests.cpp \
256    tests/unit/MatrixTests.cpp \
257    tests/unit/OffscreenBufferPoolTests.cpp \
258    tests/unit/RenderNodeTests.cpp \
259    tests/unit/RenderPropertiesTests.cpp \
260    tests/unit/SkiaBehaviorTests.cpp \
261    tests/unit/SnapshotTests.cpp \
262    tests/unit/StringUtilsTests.cpp \
263    tests/unit/TestUtilsTests.cpp \
264    tests/unit/TextDropShadowCacheTests.cpp \
265    tests/unit/VectorDrawableTests.cpp
266
267ifeq (true, $(HWUI_NEW_OPS))
268    LOCAL_SRC_FILES += \
269        tests/unit/BakedOpDispatcherTests.cpp \
270        tests/unit/BakedOpRendererTests.cpp \
271        tests/unit/BakedOpStateTests.cpp \
272        tests/unit/FrameBuilderTests.cpp \
273        tests/unit/LeakCheckTests.cpp \
274        tests/unit/OpDumperTests.cpp \
275        tests/unit/RecordingCanvasTests.cpp \
276        tests/unit/SkiaCanvasTests.cpp
277endif
278
279include $(LOCAL_PATH)/hwui_static_deps.mk
280include $(BUILD_NATIVE_TEST)
281
282# ------------------------
283# Macro-bench app
284# ------------------------
285
286include $(CLEAR_VARS)
287
288LOCAL_MODULE_PATH := $(TARGET_OUT_DATA)/local/tmp
289LOCAL_MODULE:= hwuitest
290LOCAL_MODULE_TAGS := tests
291LOCAL_MODULE_CLASS := EXECUTABLES
292LOCAL_MULTILIB := both
293LOCAL_MODULE_STEM_32 := hwuitest
294LOCAL_MODULE_STEM_64 := hwuitest64
295LOCAL_CFLAGS := $(hwui_cflags)
296
297# set to libhwui_static_null_gpu to skip actual GL commands
298LOCAL_WHOLE_STATIC_LIBRARIES := libhwui_static
299
300LOCAL_SRC_FILES += \
301    $(hwui_test_common_src_files) \
302    tests/macrobench/TestSceneRunner.cpp \
303    tests/macrobench/main.cpp
304
305include $(LOCAL_PATH)/hwui_static_deps.mk
306include $(BUILD_EXECUTABLE)
307
308# ------------------------
309# Micro-bench app
310# ---------------------
311include $(CLEAR_VARS)
312
313LOCAL_MODULE_PATH := $(TARGET_OUT_DATA)/local/tmp
314LOCAL_MODULE:= hwuimicro
315LOCAL_MODULE_TAGS := tests
316LOCAL_MODULE_CLASS := EXECUTABLES
317LOCAL_MULTILIB := both
318LOCAL_MODULE_STEM_32 := hwuimicro
319LOCAL_MODULE_STEM_64 := hwuimicro64
320LOCAL_CFLAGS := \
321        $(hwui_cflags) \
322        -DHWUI_NULL_GPU
323
324LOCAL_WHOLE_STATIC_LIBRARIES := libhwui_static_null_gpu
325LOCAL_STATIC_LIBRARIES := libgoogle-benchmark
326
327LOCAL_SRC_FILES += \
328    $(hwui_test_common_src_files) \
329    tests/microbench/main.cpp \
330    tests/microbench/DisplayListCanvasBench.cpp \
331    tests/microbench/FontBench.cpp \
332    tests/microbench/LinearAllocatorBench.cpp \
333    tests/microbench/PathParserBench.cpp \
334    tests/microbench/ShadowBench.cpp \
335    tests/microbench/TaskManagerBench.cpp
336
337ifeq (true, $(HWUI_NEW_OPS))
338    LOCAL_SRC_FILES += \
339        tests/microbench/FrameBuilderBench.cpp
340endif
341
342include $(LOCAL_PATH)/hwui_static_deps.mk
343include $(BUILD_EXECUTABLE)
344