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