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