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