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