Android.mk revision 3acf0382da22cda88234e599cd81b1ff5441cc35
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/StringUtils.cpp \
42    utils/TestWindowContext.cpp \
43    utils/VectorDrawableUtils.cpp \
44    AmbientShadow.cpp \
45    AnimationContext.cpp \
46    Animator.cpp \
47    AnimatorManager.cpp \
48    BakedOpDispatcher.cpp \
49    BakedOpRenderer.cpp \
50    BakedOpState.cpp \
51    Caches.cpp \
52    CanvasState.cpp \
53    ClipArea.cpp \
54    DamageAccumulator.cpp \
55    DeferredLayerUpdater.cpp \
56    DeviceInfo.cpp \
57    DisplayList.cpp \
58    Extensions.cpp \
59    FboCache.cpp \
60    FontRenderer.cpp \
61    FrameBuilder.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    LayerBuilder.cpp \
73    LayerUpdateQueue.cpp \
74    Matrix.cpp \
75    OpDumper.cpp \
76    Patch.cpp \
77    PatchCache.cpp \
78    PathCache.cpp \
79    PathParser.cpp \
80    PathTessellator.cpp \
81    PixelBuffer.cpp \
82    ProfileRenderer.cpp \
83    Program.cpp \
84    ProgramCache.cpp \
85    Properties.cpp \
86    PropertyValuesAnimatorSet.cpp \
87    PropertyValuesHolder.cpp \
88    Readback.cpp \
89    RecordingCanvas.cpp \
90    RenderBufferCache.cpp \
91    RenderNode.cpp \
92    RenderProperties.cpp \
93    ResourceCache.cpp \
94    ShadowTessellator.cpp \
95    SkiaCanvas.cpp \
96    SkiaCanvasProxy.cpp \
97    SkiaDisplayList.cpp \
98    SkiaShader.cpp \
99    Snapshot.cpp \
100    SpotShadow.cpp \
101    TessellationCache.cpp \
102    TextDropShadowCache.cpp \
103    Texture.cpp \
104    TextureCache.cpp \
105    VectorDrawable.cpp \
106    protos/hwui.proto
107
108hwui_test_common_src_files := \
109    $(call all-cpp-files-under, tests/common/scenes) \
110    tests/common/LeakChecker.cpp \
111    tests/common/TestListViewSceneBase.cpp \
112    tests/common/TestContext.cpp \
113    tests/common/TestScene.cpp \
114    tests/common/TestUtils.cpp
115
116hwui_debug_common_src_files := \
117    debug/wrap_gles.cpp \
118    debug/DefaultGlesDriver.cpp \
119    debug/GlesErrorCheckWrapper.cpp \
120    debug/GlesDriver.cpp \
121    debug/FatalBaseDriver.cpp \
122    debug/NullGlesDriver.cpp
123
124hwui_cflags := \
125    -DEGL_EGLEXT_PROTOTYPES -DGL_GLEXT_PROTOTYPES \
126    -DATRACE_TAG=ATRACE_TAG_VIEW -DLOG_TAG=\"OpenGLRenderer\" \
127    -Wall -Wno-unused-parameter -Wunreachable-code -Werror
128
129ifeq ($(TARGET_USES_HWC2),true)
130    hwui_cflags += -DUSE_HWC2
131endif
132
133# TODO: Linear blending should be enabled by default, but we are
134# TODO: making it an opt-in while it's a work in progress
135# TODO: The final test should be:
136# TODO: ifneq ($(TARGET_ENABLE_LINEAR_BLENDING),false)
137ifeq ($(TARGET_ENABLE_LINEAR_BLENDING),true)
138    hwui_cflags += -DANDROID_ENABLE_LINEAR_BLENDING
139endif
140
141# GCC false-positives on this warning, and since we -Werror that's
142# a problem
143hwui_cflags += -Wno-free-nonheap-object
144
145# clang's warning is broken, see: https://llvm.org/bugs/show_bug.cgi?id=21629
146hwui_cflags += -Wno-missing-braces
147
148ifeq (true, $(BUGREPORT_FONT_CACHE_USAGE))
149    hwui_src_files += \
150        font/FontCacheHistoryTracker.cpp
151    hwui_cflags += -DBUGREPORT_FONT_CACHE_USAGE
152endif
153
154ifndef HWUI_COMPILE_SYMBOLS
155    hwui_cflags += -fvisibility=hidden
156endif
157
158ifdef HWUI_COMPILE_FOR_PERF
159    # TODO: Non-arm?
160    hwui_cflags += -fno-omit-frame-pointer -marm -mapcs
161endif
162
163# This has to be lazy-resolved because it depends on the LOCAL_MODULE_CLASS
164# which varies depending on what is being built
165define hwui_proto_include
166$(call local-generated-sources-dir)/proto/$(LOCAL_PATH)
167endef
168
169hwui_c_includes += \
170    external/skia/include/private \
171    external/skia/src/core \
172    external/harfbuzz_ng/src \
173    external/freetype/include
174
175ifneq (false,$(ANDROID_ENABLE_RENDERSCRIPT))
176    hwui_cflags += -DANDROID_ENABLE_RENDERSCRIPT
177    hwui_c_includes += \
178        $(call intermediates-dir-for,STATIC_LIBRARIES,libRS,TARGET,) \
179        frameworks/rs/cpp \
180        frameworks/rs
181endif
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)
193
194ifeq (true, $(HWUI_ENABLE_OPENGL_VALIDATION))
195    LOCAL_CFLAGS += -include debug/wrap_gles.h
196    LOCAL_CFLAGS += -DDEBUG_OPENGL=3
197    LOCAL_SRC_FILES += $(hwui_debug_common_src_files)
198endif
199
200LOCAL_C_INCLUDES := $(hwui_c_includes) $(call hwui_proto_include)
201LOCAL_EXPORT_C_INCLUDE_DIRS := \
202        $(LOCAL_PATH) \
203        $(call hwui_proto_include)
204
205include $(LOCAL_PATH)/hwui_static_deps.mk
206include $(BUILD_STATIC_LIBRARY)
207
208# ------------------------
209# static library null gpu
210# ------------------------
211
212include $(CLEAR_VARS)
213
214LOCAL_MODULE_CLASS := STATIC_LIBRARIES
215LOCAL_MODULE := libhwui_static_debug
216LOCAL_CFLAGS := \
217        $(hwui_cflags) \
218        -include debug/wrap_gles.h \
219        -DHWUI_NULL_GPU
220LOCAL_SRC_FILES := \
221        $(hwui_src_files) \
222        $(hwui_debug_common_src_files) \
223        debug/nullegl.cpp
224LOCAL_C_INCLUDES := $(hwui_c_includes) $(call hwui_proto_include)
225LOCAL_EXPORT_C_INCLUDE_DIRS := \
226        $(LOCAL_PATH) \
227        $(call hwui_proto_include)
228
229include $(LOCAL_PATH)/hwui_static_deps.mk
230include $(BUILD_STATIC_LIBRARY)
231
232# ------------------------
233# shared library
234# ------------------------
235
236include $(CLEAR_VARS)
237
238LOCAL_MODULE_CLASS := SHARED_LIBRARIES
239LOCAL_MODULE := libhwui
240LOCAL_WHOLE_STATIC_LIBRARIES := libhwui_static
241LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
242
243include $(LOCAL_PATH)/hwui_static_deps.mk
244include $(BUILD_SHARED_LIBRARY)
245
246# ------------------------
247# unit tests
248# ------------------------
249
250include $(CLEAR_VARS)
251
252LOCAL_MODULE := hwui_unit_tests
253LOCAL_MODULE_TAGS := tests
254LOCAL_STATIC_LIBRARIES := libgmock libhwui_static_debug
255LOCAL_SHARED_LIBRARIES := libmemunreachable
256LOCAL_CFLAGS := \
257        $(hwui_cflags) \
258        -include debug/wrap_gles.h \
259        -DHWUI_NULL_GPU
260LOCAL_C_INCLUDES := $(hwui_c_includes)
261
262LOCAL_SRC_FILES += \
263    $(hwui_test_common_src_files) \
264    tests/unit/main.cpp \
265    tests/unit/BakedOpDispatcherTests.cpp \
266    tests/unit/BakedOpRendererTests.cpp \
267    tests/unit/BakedOpStateTests.cpp \
268    tests/unit/CanvasContextTests.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/RenderNodeBench.cpp \
353    tests/microbench/ShadowBench.cpp \
354    tests/microbench/TaskManagerBench.cpp
355
356
357include $(LOCAL_PATH)/hwui_static_deps.mk
358include $(BUILD_NATIVE_BENCHMARK)
359