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