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