1BASE_PATH := $(call my-dir)
2LOCAL_PATH:= $(call my-dir)
3
4###############################################################################
5#
6# PROBLEMS WITH SKIA DEBUGGING?? READ THIS...
7#
8# The debug build results in changes to the Skia headers. This means that those
9# using libskia must also be built with the debug version of the Skia headers.
10# There are a few scenarios where this comes into play:
11#
12# (1) You're building debug code that depends on libskia.
13#   (a) If libskia is built in release, then define SK_RELEASE when building
14#       your sources.
15#   (b) If libskia is built with debugging (see step 2), then no changes are
16#       needed since your sources and libskia have been built with SK_DEBUG.
17# (2) You're building libskia in debug mode.
18#   (a) RECOMMENDED: You can build the entire system in debug mode. Do this by
19#       updating your buildspec.mk to include TARGET_BUILD_TYPE=debug
20#   (b) You can update all the users of libskia to define SK_DEBUG when they are
21#       building their sources.
22#
23# NOTE: If neither SK_DEBUG or SK_RELEASE are defined then Skia checks NDEBUG to
24#       determine which build type to use.
25###############################################################################
26
27
28#############################################################
29#   build the skia+fretype+png+jpeg+zlib+gif+webp library
30#
31
32include $(CLEAR_VARS)
33
34LOCAL_ARM_MODE := arm
35
36# need a flag to tell the C side when we're on devices with large memory
37# budgets (i.e. larger than the low-end devices that initially shipped)
38ifeq ($(ARCH_ARM_HAVE_VFP),true)
39    LOCAL_CFLAGS += -DANDROID_LARGE_MEMORY_DEVICE
40endif
41
42ifeq ($(TARGET_ARCH),x86)
43    LOCAL_CFLAGS += -DANDROID_LARGE_MEMORY_DEVICE
44endif
45
46ifneq ($(ARCH_ARM_HAVE_VFP),true)
47	LOCAL_CFLAGS += -DSK_SOFTWARE_FLOAT
48endif
49
50ifeq ($(ARCH_ARM_HAVE_NEON),true)
51	LOCAL_CFLAGS += -D__ARM_HAVE_NEON
52endif
53
54# special checks for alpha == 0 and alpha == 255 in S32A_Opaque_BlitRow32
55# procedures (C and assembly) seriously improve skia performance
56LOCAL_CFLAGS += -DTEST_SRC_ALPHA
57
58# using freetype's embolden allows us to adjust fake bold settings at
59# draw-time, at which point we know which SkTypeface is being drawn
60LOCAL_CFLAGS += -DSK_USE_FREETYPE_EMBOLDEN
61
62LOCAL_SRC_FILES:= \
63	src/core/Sk64.cpp \
64	src/core/SkAAClip.cpp \
65	src/core/SkAdvancedTypefaceMetrics.cpp \
66	src/core/SkAlphaRuns.cpp \
67	src/core/SkBitmap.cpp \
68	src/core/SkBitmapProcShader.cpp \
69	src/core/SkBitmapProcState.cpp \
70	src/core/SkBitmapProcState_matrixProcs.cpp \
71	src/core/SkBitmapSampler.cpp \
72	src/core/SkBitmap_scroll.cpp \
73	src/core/SkBlitMask_D32.cpp \
74	src/core/SkBlitRow_D16.cpp \
75	src/core/SkBlitRow_D32.cpp \
76	src/core/SkBlitRow_D4444.cpp \
77	src/core/SkBlitter.cpp \
78	src/core/SkBlitter_4444.cpp \
79	src/core/SkBlitter_A1.cpp \
80	src/core/SkBlitter_A8.cpp \
81	src/core/SkBlitter_ARGB32.cpp \
82	src/core/SkBlitter_RGB16.cpp \
83	src/core/SkBlitter_Sprite.cpp \
84	src/core/SkBuffer.cpp \
85	src/core/SkCanvas.cpp \
86	src/core/SkChunkAlloc.cpp \
87	src/core/SkClampRange.cpp \
88	src/core/SkClipStack.cpp \
89	src/core/SkColor.cpp \
90	src/core/SkColorFilter.cpp \
91	src/core/SkColorTable.cpp \
92	src/core/SkComposeShader.cpp \
93	src/core/SkConcaveToTriangles.cpp \
94	src/core/SkConfig8888.cpp \
95	src/core/SkCordic.cpp \
96	src/core/SkCubicClipper.cpp \
97	src/core/SkData.cpp \
98	src/core/SkDebug.cpp \
99	src/core/SkDeque.cpp \
100	src/core/SkDevice.cpp \
101	src/core/SkDeviceProfile.cpp \
102	src/core/SkDither.cpp \
103	src/core/SkDraw.cpp \
104  src/core/SkEdgeBuilder.cpp \
105	src/core/SkEdgeClipper.cpp \
106  src/core/SkEdge.cpp \
107	src/core/SkFilterProc.cpp \
108	src/core/SkFlattenable.cpp \
109	src/core/SkFloat.cpp \
110	src/core/SkFloatBits.cpp \
111	src/core/SkFontHost.cpp \
112	src/core/SkGeometry.cpp \
113	src/core/SkGlyphCache.cpp \
114	src/core/SkGraphics.cpp \
115	src/core/SkLanguage.cpp \
116	src/core/SkLineClipper.cpp \
117	src/core/SkMallocPixelRef.cpp \
118	src/core/SkMask.cpp \
119	src/core/SkMaskFilter.cpp \
120	src/core/SkMath.cpp \
121	src/core/SkMatrix.cpp \
122	src/core/SkMetaData.cpp \
123	src/core/SkMMapStream.cpp \
124	src/core/SkPackBits.cpp \
125	src/core/SkPaint.cpp \
126	src/core/SkPath.cpp \
127	src/core/SkPathEffect.cpp \
128	src/core/SkPathHeap.cpp \
129	src/core/SkPathMeasure.cpp \
130	src/core/SkPicture.cpp \
131	src/core/SkPictureFlat.cpp \
132	src/core/SkPicturePlayback.cpp \
133	src/core/SkPictureRecord.cpp \
134	src/core/SkPixelRef.cpp \
135	src/core/SkPoint.cpp \
136	src/core/SkProcSpriteBlitter.cpp \
137	src/core/SkPtrRecorder.cpp \
138	src/core/SkQuadClipper.cpp \
139	src/core/SkRasterClip.cpp \
140	src/core/SkRasterizer.cpp \
141	src/core/SkRect.cpp \
142	src/core/SkRefDict.cpp \
143	src/core/SkRegion.cpp \
144	src/core/SkRegion_path.cpp \
145  src/core/SkScalar.cpp \
146  src/core/SkScalerContext.cpp \
147	src/core/SkScan.cpp \
148	src/core/SkScan_AntiPath.cpp \
149	src/core/SkScan_Antihair.cpp \
150	src/core/SkScan_Hairline.cpp \
151	src/core/SkScan_Path.cpp \
152	src/core/SkShader.cpp \
153	src/core/SkShape.cpp \
154	src/core/SkSpriteBlitter_ARGB32.cpp \
155	src/core/SkSpriteBlitter_RGB16.cpp \
156	src/core/SkStream.cpp \
157	src/core/SkString.cpp \
158	src/core/SkStroke.cpp \
159	src/core/SkStrokerPriv.cpp \
160	src/core/SkTSearch.cpp \
161	src/core/SkTypeface.cpp \
162	src/core/SkTypefaceCache.cpp \
163	src/core/SkUnPreMultiply.cpp \
164	src/core/SkUtils.cpp \
165	src/core/SkFlate.cpp \
166	src/core/SkWriter32.cpp \
167	src/core/SkXfermode.cpp \
168	src/effects/Sk1DPathEffect.cpp \
169	src/effects/Sk2DPathEffect.cpp \
170	src/effects/SkAvoidXfermode.cpp \
171	src/effects/SkArithmeticMode.cpp \
172	src/effects/SkBitmapCache.cpp \
173	src/effects/SkBlurDrawLooper.cpp \
174	src/effects/SkBlurImageFilter.cpp \
175	src/effects/SkBlurMask.cpp \
176	src/effects/SkBlurMaskFilter.cpp \
177	src/effects/SkColorFilters.cpp \
178	src/effects/SkColorMatrixFilter.cpp \
179	src/effects/SkCornerPathEffect.cpp \
180	src/effects/SkDashPathEffect.cpp \
181	src/effects/SkDiscretePathEffect.cpp \
182	src/effects/SkEffects.cpp \
183	src/effects/SkEmbossMask.cpp \
184	src/effects/SkEmbossMaskFilter.cpp \
185	src/effects/SkGradientShader.cpp \
186	src/effects/SkGroupShape.cpp \
187	src/effects/SkKernel33MaskFilter.cpp \
188	src/effects/SkLayerDrawLooper.cpp \
189	src/effects/SkLayerRasterizer.cpp \
190	src/effects/SkMorphologyImageFilter.cpp \
191	src/effects/SkPaintFlagsDrawFilter.cpp \
192	src/effects/SkPixelXorXfermode.cpp \
193	src/effects/SkPorterDuff.cpp \
194	src/effects/SkRectShape.cpp \
195	src/effects/SkTableColorFilter.cpp \
196  src/effects/SkTableMaskFilter.cpp \
197  src/effects/SkTestImageFilters.cpp \
198	src/effects/SkTransparentShader.cpp \
199	src/images/bmpdecoderhelper.cpp \
200	src/images/SkBitmapRegionDecoder.cpp \
201	src/images/SkCreateRLEPixelRef.cpp \
202	src/images/SkFDStream.cpp \
203	src/images/SkFlipPixelRef.cpp \
204	src/images/SkImageDecoder.cpp \
205	src/images/SkImageDecoder_Factory.cpp \
206	src/images/SkImageDecoder_libbmp.cpp \
207	src/images/SkImageDecoder_libgif.cpp \
208	src/images/SkImageDecoder_libico.cpp \
209	src/images/SkImageDecoder_libjpeg.cpp \
210	src/images/SkImageDecoder_libpng.cpp \
211	src/images/SkImageDecoder_libwebp.cpp \
212	src/images/SkImageDecoder_wbmp.cpp \
213	src/images/SkImageEncoder.cpp \
214	src/images/SkImageEncoder_Factory.cpp \
215	src/images/SkImageRef.cpp \
216	src/images/SkImageRefPool.cpp \
217	src/images/SkImageRef_GlobalPool.cpp \
218	src/images/SkJpegUtility.cpp \
219	src/images/SkMovie.cpp \
220	src/images/SkMovie_gif.cpp \
221	src/images/SkPageFlipper.cpp \
222	src/images/SkScaledBitmapSampler.cpp \
223	src/ports/FontHostConfiguration_android.cpp \
224	src/ports/SkDebug_android.cpp \
225	src/ports/SkGlobalInitialization_default.cpp \
226	src/ports/SkFontHost_FreeType.cpp \
227	src/ports/SkFontHost_sandbox_none.cpp	\
228	src/ports/SkFontHost_android.cpp \
229	src/ports/SkFontHost_gamma.cpp \
230	src/ports/SkFontHost_tables.cpp \
231	src/ports/SkImageRef_ashmem.cpp \
232	src/ports/SkMemory_malloc.cpp \
233	src/ports/SkOSFile_stdio.cpp \
234	src/ports/SkThread_pthread.cpp \
235	src/ports/SkTime_Unix.cpp \
236	src/utils/SkBase64.cpp \
237	src/utils/SkBoundaryPatch.cpp \
238	src/utils/SkCamera.cpp \
239	src/utils/SkColorMatrix.cpp \
240  src/utils/SkCubicInterval.cpp \
241	src/utils/SkCullPoints.cpp \
242	src/utils/SkDeferredCanvas.cpp \
243	src/utils/SkDumpCanvas.cpp \
244	src/utils/SkInterpolator.cpp \
245	src/utils/SkLayer.cpp \
246	src/utils/SkMatrix44.cpp \
247	src/utils/SkMeshUtils.cpp \
248	src/utils/SkNinePatch.cpp \
249	src/utils/SkNWayCanvas.cpp \
250	src/utils/SkOSFile.cpp \
251	src/utils/SkParse.cpp \
252	src/utils/SkParseColor.cpp \
253	src/utils/SkParsePath.cpp \
254	src/utils/SkProxyCanvas.cpp \
255	src/utils/SkSfntUtils.cpp \
256	src/utils/SkUnitMappers.cpp
257
258ifeq ($(TARGET_ARCH),arm)
259
260ifeq ($(ARCH_ARM_HAVE_NEON),true)
261LOCAL_SRC_FILES += \
262	src/opts/memset16_neon.S \
263	src/opts/memset32_neon.S
264endif
265
266LOCAL_SRC_FILES += \
267	src/opts/opts_check_arm.cpp \
268	src/opts/memset.arm.S \
269	src/opts/SkBitmapProcState_opts_arm.cpp \
270	src/opts/SkBlitRow_opts_arm.cpp
271else
272LOCAL_SRC_FILES += \
273	src/opts/SkBlitRow_opts_none.cpp \
274	src/opts/SkBitmapProcState_opts_none.cpp \
275	src/opts/SkUtils_opts_none.cpp
276endif
277
278# these are for emoji support, needed by webkit
279LOCAL_SRC_FILES += \
280	emoji/EmojiFont.cpp
281
282LOCAL_SHARED_LIBRARIES := \
283	libcutils \
284	libemoji \
285	libjpeg \
286	libutils \
287	libz \
288	libexpat
289
290LOCAL_STATIC_LIBRARIES := \
291	libft2 \
292	libpng \
293	libgif \
294	libwebp-decode \
295	libwebp-encode
296
297LOCAL_C_INCLUDES += \
298	$(LOCAL_PATH)/src/core \
299	$(LOCAL_PATH)/include/core \
300	$(LOCAL_PATH)/include/config \
301	$(LOCAL_PATH)/include/effects \
302	$(LOCAL_PATH)/include/images \
303	$(LOCAL_PATH)/include/ports \
304	$(LOCAL_PATH)/include/utils \
305	$(LOCAL_PATH)/include/xml \
306	external/freetype/include \
307	external/zlib \
308	external/libpng \
309	external/giflib \
310	external/jpeg \
311	external/webp/include \
312	frameworks/opt/emoji \
313	external/expat/lib
314
315ifeq ($(NO_FALLBACK_FONT),true)
316	LOCAL_CFLAGS += -DNO_FALLBACK_FONT
317endif
318
319LOCAL_LDLIBS += -lpthread
320
321LOCAL_MODULE:= libskia
322
323include $(BUILD_SHARED_LIBRARY)
324
325#############################################################
326# Build the skia gpu (ganesh) library
327#
328
329include $(CLEAR_VARS)
330
331LOCAL_ARM_MODE := arm
332
333ifneq ($(ARCH_ARM_HAVE_VFP),true)
334       LOCAL_CFLAGS += -DSK_SOFTWARE_FLOAT
335endif
336
337ifeq ($(ARCH_ARM_HAVE_NEON),true)
338       LOCAL_CFLAGS += -DGR_ANDROID_BUILD=1
339endif
340
341LOCAL_SRC_FILES:= \
342  src/gpu/GrPrintf_skia.cpp \
343  src/gpu/SkGpuCanvas.cpp \
344  src/gpu/SkGpuDevice.cpp \
345  src/gpu/SkGr.cpp \
346  src/gpu/SkGrFontScaler.cpp \
347  src/gpu/SkGrTexturePixelRef.cpp \
348  src/gpu/android/SkNativeGLContext_android.cpp \
349  src/gpu/gl/SkGLContext.cpp \
350  src/gpu/gl/SkNullGLContext.cpp
351
352LOCAL_SRC_FILES += \
353  src/gpu/GrAAHairLinePathRenderer.cpp \
354  src/gpu/GrAAConvexPathRenderer.cpp \
355  src/gpu/GrAddPathRenderers_default.cpp \
356  src/gpu/GrAllocPool.cpp \
357  src/gpu/GrAtlas.cpp \
358  src/gpu/GrBufferAllocPool.cpp \
359  src/gpu/GrClip.cpp \
360  src/gpu/GrContext.cpp \
361  src/gpu/GrDefaultPathRenderer.cpp \
362  src/gpu/GrDrawTarget.cpp \
363  src/gpu/GrGpu.cpp \
364  src/gpu/GrGpuFactory.cpp \
365  src/gpu/GrInOrderDrawBuffer.cpp \
366  src/gpu/GrMatrix.cpp \
367  src/gpu/GrMemory.cpp \
368  src/gpu/GrPathRendererChain.cpp \
369  src/gpu/GrPathRenderer.cpp \
370  src/gpu/GrPathUtils.cpp \
371  src/gpu/GrRectanizer.cpp \
372  src/gpu/GrRenderTarget.cpp \
373  src/gpu/GrResource.cpp \
374  src/gpu/GrResourceCache.cpp \
375  src/gpu/GrStencil.cpp \
376  src/gpu/GrStencilBuffer.cpp \
377  src/gpu/GrTesselatedPathRenderer.cpp \
378  src/gpu/GrTextContext.cpp \
379  src/gpu/GrTextStrike.cpp \
380  src/gpu/GrTexture.cpp \
381  src/gpu/gr_unittests.cpp \
382  src/gpu/android/GrGLCreateNativeInterface_android.cpp
383
384LOCAL_SRC_FILES += \
385  src/gpu/gl/GrGLCaps.cpp \
386  src/gpu/gl/GrGLContextInfo.cpp \
387  src/gpu/gl/GrGLCreateNullInterface.cpp \
388  src/gpu/gl/GrGLDefaultInterface_native.cpp \
389  src/gpu/gl/GrGLIndexBuffer.cpp \
390  src/gpu/gl/GrGLInterface.cpp \
391  src/gpu/gl/GrGLProgram.cpp \
392  src/gpu/gl/GrGLRenderTarget.cpp \
393  src/gpu/gl/GrGLSL.cpp \
394  src/gpu/gl/GrGLStencilBuffer.cpp \
395  src/gpu/gl/GrGLTexture.cpp \
396  src/gpu/gl/GrGLUtil.cpp \
397  src/gpu/gl/GrGLVertexBuffer.cpp \
398  src/gpu/gl/GrGpuGL.cpp \
399  src/gpu/gl/GrGpuGLShaders.cpp
400  
401LOCAL_STATIC_LIBRARIES := libskiatess
402LOCAL_SHARED_LIBRARIES := \
403  libcutils \
404  libutils \
405  libskia \
406  libEGL \
407  libGLESv2
408
409LOCAL_C_INCLUDES += \
410  $(LOCAL_PATH)/include/core \
411  $(LOCAL_PATH)/include/config \
412  $(LOCAL_PATH)/include/gpu \
413  $(LOCAL_PATH)/src/core \
414  $(LOCAL_PATH)/src/gpu \
415  $(LOCAL_PATH)/third_party/glu \
416  frameworks/base/opengl/include
417
418LOCAL_LDLIBS += -lpthread
419
420LOCAL_MODULE:= libskiagpu
421LOCAL_MODULE_TAGS := optional
422
423include $(BUILD_STATIC_LIBRARY)
424
425#############################################################
426# Build the skia gpu (ganesh) library
427#
428
429include $(CLEAR_VARS)
430
431LOCAL_ARM_MODE := arm
432
433LOCAL_SRC_FILES := \
434  third_party/glu/libtess/dict.c \
435  third_party/glu/libtess/geom.c \
436  third_party/glu/libtess/memalloc.c \
437  third_party/glu/libtess/mesh.c \
438  third_party/glu/libtess/normal.c \
439  third_party/glu/libtess/priorityq.c \
440  third_party/glu/libtess/render.c \
441  third_party/glu/libtess/sweep.c \
442  third_party/glu/libtess/tess.c \
443  third_party/glu/libtess/tessmono.c
444
445LOCAL_SHARED_LIBRARIES := \
446  libcutils \
447  libutils \
448  libEGL \
449  libGLESv2
450
451LOCAL_C_INCLUDES += \
452  $(LOCAL_PATH)/third_party/glu \
453  $(LOCAL_PATH)/third_party/glu/libtess \
454  frameworks/base/opengl/include
455
456LOCAL_LDLIBS += -lpthread
457
458LOCAL_MODULE:= libskiatess
459LOCAL_MODULE_TAGS := optional
460
461include $(BUILD_STATIC_LIBRARY)
462
463#############################################################
464# Build the skia tools
465#
466
467# benchmark (timings)
468include $(BASE_PATH)/bench/Android.mk
469
470# golden-master (fidelity / regression test)
471include $(BASE_PATH)/gm/Android.mk
472
473# unit-tests
474include $(BASE_PATH)/tests/Android.mk
475