编译 skia
0、准备工作
在 https://android.googlesource.com/ 用 git 代码,当然也可以从skia的官方https://code.google.com/p/skia/ 中获取,但是个人觉得前一种方法与Android适配更好,更方便。
1、依赖关系
动态库libcutils,libz libjpeg ,libexpat ,liblog 去掉 libemoji libutils
静态库 libft2 libpng libgif libwebp-decode libwebp-encode
libcutils 来自systerm/core, 其余在external目录
2、头文件
由于NDK自带的头文件不完整,因此需要关联
libcutils utils (来自framework/native/libs)
另外编libcutils时还需要依赖bionc中的头文件(不需要编译bionic),直接在源代码的更目录下
顺便将framework/base目录也抓下来,因为用到GraphicJNI.h头文件还需要引用其中的一些头文件
3、一些环境相关的宏
见 /build/core/combo/include/arch/linux-arm/AndroidConfig.h
关闭 HAVE_LIBC_SYSTEM_PROPERTIES=1
4、编译过程问题
1)/home/workspace/webos_dalvik/external/skia/src/opts/SkBlitRow_opts_arm.cpp: In function ‘void S32A_Blend_BlitRow32_arm(SkPMColor*, const SkPMColor*, int, U8CPU)’:
/home/workspace/webos_dalvik/external/skia/src/opts/SkBlitRow_opts_arm.cpp:789: error: fp cannot be used in asm here
主要是汇编指令不支持
#ifeq ($(TARGET_ARCH),arm)
#
#ifeq ($(ARCH_ARM_HAVE_NEON),true)
#LOCAL_SRC_FILES += \
# src/opts/memset16_neon.S \
# src/opts/memset32_neon.S
#endif
#
#LOCAL_SRC_FILES += \
# src/opts/opts_check_arm.cpp \
# src/opts/memset.arm.S \
# src/opts/SkBitmapProcState_opts_arm.cpp \
# src/opts/SkBlitRow_opts_arm.cpp
#else
LOCAL_SRC_FILES += \
src/opts/SkBlitRow_opts_none.cpp \
src/opts/SkBitmapProcState_opts_none.cpp \
src/opts/SkUtils_opts_none.cpp
#endif
2)/home/likai/lib/android-ndk-r8d/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: ./obj/local/armeabi/objs-debug/corkscrew/src/backtrace.o: in function unwind_backtrace_thread:jni/libcorkscrew/src/backtrace.c:182: error: undefined reference to '__android_log_print'
需要链接 -llog 或者直接编译liblog模块(来自system/core)
5、Android.mk
BASE_PATH := $(call my-dir)
LOCAL_PATH:= $(call my-dir)
###############################################################################
#
# PROBLEMS WITH SKIA DEBUGGING?? READ THIS...
#
# The debug build results in changes to the Skia headers. This means that those
# using libskia must also be built with the debug version of the Skia headers.
# There are a few scenarios where this comes into play:
#
# (1) You're building debug code that depends on libskia.
# (a) If libskia is built in release, then define SK_RELEASE when building
# your sources.
# (b) If libskia is built with debugging (see step 2), then no changes are
# needed since your sources and libskia have been built with SK_DEBUG.
# (2) You're building libskia in debug mode.
# (a) RECOMMENDED: You can build the entire system in debug mode. Do this by
# updating your buildspec.mk to include TARGET_BUILD_TYPE=debug
# (b) You can update all the users of libskia to define SK_DEBUG when they are
# building their sources.
#
# NOTE: If neither SK_DEBUG or SK_RELEASE are defined then Skia checks NDEBUG to
# determine which build type to use.
###############################################################################
#############################################################
# build the skia+fretype+png+jpeg+zlib+gif+webp library
#
include $(CLEAR_VARS)
LOCAL_ARM_MODE := arm
# need a flag to tell the C side when we're on devices with large memory
# budgets (i.e. larger than the low-end devices that initially shipped)
ifeq ($(ARCH_ARM_HAVE_VFP),true)
LOCAL_CFLAGS += -DANDROID_LARGE_MEMORY_DEVICE
endif
ifeq ($(TARGET_ARCH),x86)
LOCAL_CFLAGS += -DANDROID_LARGE_MEMORY_DEVICE
endif
ifneq ($(ARCH_ARM_HAVE_VFP),true)
LOCAL_CFLAGS += -DSK_SOFTWARE_FLOAT
endif
ifeq ($(ARCH_ARM_HAVE_NEON),true)
LOCAL_CFLAGS += -D__ARM_HAVE_NEON
endif
# special checks for alpha == 0 and alpha == 255 in S32A_Opaque_BlitRow32
# procedures (C and assembly) seriously improve skia performance
LOCAL_CFLAGS += -DTEST_SRC_ALPHA
# using freetype's embolden allows us to adjust fake bold settings at
# draw-time, at which point we know which SkTypeface is being drawn
LOCAL_CFLAGS += -DSK_USE_FREETYPE_EMBOLDEN
LOCAL_SRC_FILES:= \
src/core/Sk64.cpp \
src/core/SkAAClip.cpp \
src/core/SkAdvancedTypefaceMetrics.cpp \
src/core/SkAlphaRuns.cpp \
src/core/SkBitmap.cpp \
src/core/SkBitmapProcShader.cpp \
src/core/SkBitmapProcState.cpp \
src/core/SkBitmapProcState_matrixProcs.cpp \
src/core/SkBitmapSampler.cpp \
src/core/SkBitmap_scroll.cpp \
src/core/SkBlitMask_D32.cpp \
src/core/SkBlitRow_D16.cpp \
src/core/SkBlitRow_D32.cpp \
src/core/SkBlitRow_D4444.cpp \
src/core/SkBlitter.cpp \
src/core/SkBlitter_4444.cpp \
src/core/SkBlitter_A1.cpp \
src/core/SkBlitter_A8.cpp \
src/core/SkBlitter_ARGB32.cpp \
src/core/SkBlitter_RGB16.cpp \
src/core/SkBlitter_Sprite.cpp \
src/core/SkBuffer.cpp \
src/core/SkCanvas.cpp \
src/core/SkChunkAlloc.cpp \
src/core/SkClampRange.cpp \
src/core/SkClipStack.cpp \
src/core/SkColor.cpp \
src/core/SkColorFilter.cpp \
src/core/SkColorTable.cpp \
src/core/SkComposeShader.cpp \
src/core/SkConcaveToTriangles.cpp \
src/core/SkConfig8888.cpp \
src/core/SkCordic.cpp \
src/core/SkCubicClipper.cpp \
src/core/SkData.cpp \
src/core/SkDebug.cpp \
src/core/SkDeque.cpp \
src/core/SkDevice.cpp \
src/core/SkDeviceProfile.cpp \
src/core/SkDither.cpp \
src/core/SkDraw.cpp \
src/core/SkEdgeBuilder.cpp \
src/core/SkEdgeClipper.cpp \
src/core/SkEdge.cpp \
src/core/SkFilterProc.cpp \
src/core/SkFlattenable.cpp \
src/core/SkFloat.cpp \
src/core/SkFloatBits.cpp \
src/core/SkFontHost.cpp \
src/core/SkGeometry.cpp \
src/core/SkGlyphCache.cpp \
src/core/SkGraphics.cpp \
src/core/SkLanguage.cpp \
src/core/SkLineClipper.cpp \
src/core/SkMallocPixelRef.cpp \
src/core/SkMask.cpp \
src/core/SkMaskFilter.cpp \
src/core/SkMath.cpp \
src/core/SkMatrix.cpp \
src/core/SkMetaData.cpp \
src/core/SkMMapStream.cpp \
src/core/SkPackBits.cpp \
src/core/SkPaint.cpp \
src/core/SkPath.cpp \
src/core/SkPathEffect.cpp \
src/core/SkPathHeap.cpp \
src/core/SkPathMeasure.cpp \
src/core/SkPicture.cpp \
src/core/SkPictureFlat.cpp \
src/core/SkPicturePlayback.cpp \
src/core/SkPictureRecord.cpp \
src/core/SkPixelRef.cpp \
src/core/SkPoint.cpp \
src/core/SkProcSpriteBlitter.cpp \
src/core/SkPtrRecorder.cpp \
src/core/SkQuadClipper.cpp \
src/core/SkRasterClip.cpp \
src/core/SkRasterizer.cpp \
src/core/SkRect.cpp \
src/core/SkRefDict.cpp \
src/core/SkRegion.cpp \
src/core/SkRegion_path.cpp \
src/core/SkScalar.cpp \
src/core/SkScalerContext.cpp \
src/core/SkScan.cpp \
src/core/SkScan_AntiPath.cpp \
src/core/SkScan_Antihair.cpp \
src/core/SkScan_Hairline.cpp \
src/core/SkScan_Path.cpp \
src/core/SkShader.cpp \
src/core/SkShape.cpp \
src/core/SkSpriteBlitter_ARGB32.cpp \
src/core/SkSpriteBlitter_RGB16.cpp \
src/core/SkStream.cpp \
src/core/SkString.cpp \
src/core/SkStroke.cpp \
src/core/SkStrokerPriv.cpp \
src/core/SkTSearch.cpp \
src/core/SkTypeface.cpp \
src/core/SkTypefaceCache.cpp \
src/core/SkUnPreMultiply.cpp \
src/core/SkUtils.cpp \
src/core/SkFlate.cpp \
src/core/SkWriter32.cpp \
src/core/SkXfermode.cpp \
src/effects/Sk1DPathEffect.cpp \
src/effects/Sk2DPathEffect.cpp \
src/effects/SkAvoidXfermode.cpp \
src/effects/SkArithmeticMode.cpp \
src/effects/SkBitmapCache.cpp \
src/effects/SkBlurDrawLooper.cpp \
src/effects/SkBlurImageFilter.cpp \
src/effects/SkBlurMask.cpp \
src/effects/SkBlurMaskFilter.cpp \
src/effects/SkColorFilters.cpp \
src/effects/SkColorMatrixFilter.cpp \
src/effects/SkCornerPathEffect.cpp \
src/effects/SkDashPathEffect.cpp \
src/effects/SkDiscretePathEffect.cpp \
src/effects/SkEffects.cpp \
src/effects/SkEmbossMask.cpp \
src/effects/SkEmbossMaskFilter.cpp \
src/effects/SkGradientShader.cpp \
src/effects/SkGroupShape.cpp \
src/effects/SkKernel33MaskFilter.cpp \
src/effects/SkLayerDrawLooper.cpp \
src/effects/SkLayerRasterizer.cpp \
src/effects/SkMorphologyImageFilter.cpp \
src/effects/SkPaintFlagsDrawFilter.cpp \
src/effects/SkPixelXorXfermode.cpp \
src/effects/SkPorterDuff.cpp \
src/effects/SkRectShape.cpp \
src/effects/SkTableColorFilter.cpp \
src/effects/SkTableMaskFilter.cpp \
src/effects/SkTestImageFilters.cpp \
src/effects/SkTransparentShader.cpp \
src/images/bmpdecoderhelper.cpp \
src/images/SkBitmapRegionDecoder.cpp \
src/images/SkCreateRLEPixelRef.cpp \
src/images/SkFDStream.cpp \
src/images/SkFlipPixelRef.cpp \
src/images/SkImageDecoder.cpp \
src/images/SkImageDecoder_Factory.cpp \
src/images/SkImageDecoder_libbmp.cpp \
src/images/SkImageDecoder_libgif.cpp \
src/images/SkImageDecoder_libico.cpp \
src/images/SkImageDecoder_libjpeg.cpp \
src/images/SkImageDecoder_libpng.cpp \
src/images/SkImageDecoder_libwebp.cpp \
src/images/SkImageDecoder_wbmp.cpp \
src/images/SkImageEncoder.cpp \
src/images/SkImageEncoder_Factory.cpp \
src/images/SkImageRef.cpp \
src/images/SkImageRefPool.cpp \
src/images/SkImageRef_GlobalPool.cpp \
src/images/SkJpegUtility.cpp \
src/images/SkMovie.cpp \
src/images/SkMovie_gif.cpp \
src/images/SkPageFlipper.cpp \
src/images/SkScaledBitmapSampler.cpp \
src/ports/FontHostConfiguration_android.cpp \
src/ports/SkDebug_android.cpp \
src/ports/SkGlobalInitialization_default.cpp \
src/ports/SkFontHost_FreeType.cpp \
src/ports/SkFontHost_sandbox_none.cpp \
src/ports/SkFontHost_android.cpp \
src/ports/SkFontHost_gamma.cpp \
src/ports/SkFontHost_tables.cpp \
src/ports/SkImageRef_ashmem.cpp \
src/ports/SkMemory_malloc.cpp \
src/ports/SkOSFile_stdio.cpp \
src/ports/SkThread_pthread.cpp \
src/ports/SkTime_Unix.cpp \
src/utils/SkBase64.cpp \
src/utils/SkBoundaryPatch.cpp \
src/utils/SkCamera.cpp \
src/utils/SkColorMatrix.cpp \
src/utils/SkCubicInterval.cpp \
src/utils/SkCullPoints.cpp \
src/utils/SkDeferredCanvas.cpp \
src/utils/SkDumpCanvas.cpp \
src/utils/SkInterpolator.cpp \
src/utils/SkLayer.cpp \
src/utils/SkMatrix44.cpp \
src/utils/SkMeshUtils.cpp \
src/utils/SkNinePatch.cpp \
src/utils/SkNWayCanvas.cpp \
src/utils/SkOSFile.cpp \
src/utils/SkParse.cpp \
src/utils/SkParseColor.cpp \
src/utils/SkParsePath.cpp \
src/utils/SkProxyCanvas.cpp \
src/utils/SkSfntUtils.cpp \
src/utils/SkUnitMappers.cpp
#ifeq ($(TARGET_ARCH),arm)
#
#ifeq ($(ARCH_ARM_HAVE_NEON),true)
#LOCAL_SRC_FILES += \
# src/opts/memset16_neon.S \
# src/opts/memset32_neon.S
#endif
#
#LOCAL_SRC_FILES += \
# src/opts/opts_check_arm.cpp \
# src/opts/memset.arm.S \
# src/opts/SkBitmapProcState_opts_arm.cpp \
# src/opts/SkBlitRow_opts_arm.cpp
#else
LOCAL_SRC_FILES += \
src/opts/SkBlitRow_opts_none.cpp \
src/opts/SkBitmapProcState_opts_none.cpp \
src/opts/SkUtils_opts_none.cpp
#endif
LOCAL_SRC_FILES := $(subst $(BASE_PATH),.,$(LOCAL_SRC_FILES))
# these are for emoji support, needed by webkit
#LOCAL_SRC_FILES += \
# emoji/EmojiFont.cpp
LOCAL_SHARED_LIBRARIES := \
libcutils \
libz \
libjpeg \
libexpat \
liblog
#libemoji
#libutils
LOCAL_STATIC_LIBRARIES := \
libft2 \
libpng \
libgif \
libwebp-decode \
libwebp-encode
LOCAL_C_INCLUDES += \
$(LOCAL_PATH)/src/core \
$(LOCAL_PATH)/include/core \
$(LOCAL_PATH)/include/config \
$(LOCAL_PATH)/include/effects \
$(LOCAL_PATH)/include/images \
$(LOCAL_PATH)/include/ports \
$(LOCAL_PATH)/include/utils \
$(LOCAL_PATH)/include/xml \
$(LOCAL_PATH)/../../libcutils \
$(LOCAL_PATH)/../../utils \
$(LOCAL_PATH)/../freetype/include \
$(LOCAL_PATH)/../zlib \
$(LOCAL_PATH)/../libpng \
$(LOCAL_PATH)/../giflib \
$(LOCAL_PATH)/../jpeg \
$(LOCAL_PATH)/../webp/include\
$(LOCAL_PATH)/../expat/lib
#frameworks/opt/emoji \
# Android's -D_FORTIFY_SOURCE=2 extensions are incompatibile with SkString.
# Revert to -D_FORTIFY_SOURCE=1
LOCAL_CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
LOCAL_CXXFLAGS += \
-DHAVE_POSIX_CLOCKS \
-DHAVE_PTHREADS \
-DHAVE_ANDROID_PTHREAD_SETNAME_NP \
-DHAVE_FUTEX \
-DHAVE_FUTEX_WRAPPERS=1 \
-DHAVE_FORKEXEC \
-DHAVE_OOM_ADJ \
-DHAVE_ANDROID_IPC \
-DHAVE_POSIX_FILEMAP \
-DHAVE_TERMIO_H=1 \
-DHAVE_SYS_SENDFILE_H=1 \
-DHAVE_SYS_UIO_H=1 \
-DHAVE_SYMLINKS \
-DHAVE_IOCTL \
-DHAVE_TIMEDWAIT_MONOTONIC \
-DHAVE_EPOLL \
-DHAVE_ENDIAN_H \
-DHAVE_LITTLE_ENDIAN \
-DHAVE_OFF64_T \
-DHAVE_BACKTRACE=0 \
-DHAVE_DLADDR=1 \
-DHAVE_CXXABI=0 \
-DHAVE_GETTID \
-DHAVE_SCHED_SETSCHEDULER \
-DHAVE_MALLOC_H \
-DHAVE_ANDROID_OS=1 \
-DHAVE_LINUX_LOCAL_SOCKET_NAMESPACE=1 \
-DHAVE_INOTIFY=1 \
-DHAVE_MADVISE=1 \
-DHAVE_TM_GMTOFF=1 \
-DHAVE_DIRENT_D_TYPE=1 \
-DARCH_ARM \
-DHAVE__MEMCMP16=1 \
-DHAVE_SA_NOCLDWAIT \
-DOS_PATH_SEPARATOR=\'/\' \
-DOS_CASE_SENSITIVE \
-DHAVE_SYS_SOCKET_H=1 \
-DHAVE_STRLCPY=1 \
-DHAVE_FUNOPEN=1 \
-DHAVE_PRCTL=1 \
-DHAVE_WRITEV=1 \
-DHAVE_STDINT_H=1 \
-DHAVE_STDBOOL_H=1 \
-DHAVE_SCHED_H=1 \
-DHAVE_PREAD=1 \
-DHAVE_STAT_ST_MTIM=1 \
-DHAVE_PRINTF_ZD=1 \
-DHAVE_BSD_QSORT_R=0 \
-DHAVE_GNU_QSORT_R=0
ifeq ($(NO_FALLBACK_FONT),true)
LOCAL_CFLAGS += -DNO_FALLBACK_FONT
endif
#LOCAL_LDLIBS += -lpthread #默认已经有了
LOCAL_MODULE:= libskia
include $(BUILD_SHARED_LIBRARY)
编译 skia的更多相关文章
- 编译skia静态库时,图片解码库无法注册的问题
转载:http://www.cnblogs.com/imlucky/archive/2012/08/01/2617851.html 今天编译skia库,增加图片解码库时总是无效.按照此博客的方法修改后 ...
- Windows下从源代码编译Skia
在PPAPI里面画图,能够结合第三方的图形库.比方Cairo.Skia. Google Chrome.Chromium和Android都使用Skia作为画图引擎.我也来试试Skia,先过编译关. fo ...
- Skia构建系统与编译脚本分析
分析下Skia的构建系统,详细编译过程參看Windows下从源代码编译Skia.这里以ninja为例来分析.运行以下三条命令就能够完毕编译: SET "GYP_GENERATORS=ninj ...
- 载入DLL中的图片资源生成Skia中的SkBitmap对象
PPAPI Plugin在Windows下是DLL,能够嵌入图片文件.使用Skia画图时须要依据DLL里的图片文件生成SkBitmap对象. 以下是代码: #include "utils.h ...
- Android图片编码机制深度解析(Bitmap,Skia,libJpeg)
问题 工作中遇到了Android中有关图片压缩保存的问题,发现这个问题还挺深,而且网上资料比较有限,因此自己深入研究了一下,算是把这个问题自顶至下全部搞懂了,在此记录. 相关的几个问题如下: 1.An ...
- PPAPI+Skia实现的涂鸦板
在PPAPI插件中使用Skia画图介绍了怎样在PPAPI中使用Skia,文末说回头要提供一个简单的涂鸦板插件,这次我来兑现承诺了. foruok原创,关注微信订阅号"程序视界"可联 ...
- Python 爬取CSDN博客频道
初次接触python,写的很简单,开发工具PyCharm,python 3.4很方便 python 部分模块安装时需要其他的附属模块之类的,可以先 pip install wheel 然后可以直接下载 ...
- Chromium与CEF的多进程模型及相关參数
CEF基于Chromium,也是多进程模型.关于进程模型.參考这里:https://www.chromium.org/developers/design-documents/process-model ...
- CEF中JavaScript与C++交互
在CEF里,JS和Native(C/C++)代码能够非常方便的交互,这里https://bitbucket.org/chromiumembedded/cef/wiki/JavaScriptIntegr ...
随机推荐
- FBWF和EWF的对比
最近在公司接触了嵌入式的wes7系统,wes7和wes2009是组件化的windows系统,除具有最新版的windows功能之外还具有适用于嵌入式系统的一些嵌入式功能,如例如EWF,FBWF. FBW ...
- web api写api接口时返回
web api写api接口时默认返回的是把你的对象序列化后以XML形式返回,那么怎样才能让其返回为json呢,下面就介绍两种方法: 方法一:(改配置法) 找到Global.asax文件,在Applic ...
- stm32类型cl、vl、xl、ld、md、hd的含义
- startup_stm32f10x_ld_vl.s: for STM32 Low density Value line devices - startup_stm32f10x_ld.s: for ...
- 微信web开发者工具调试
微信web开发者工具调试 前几天写了一篇使用fiddler调试微信端页面的,然后博友评论说使用fiddler太麻烦了,推荐使用微信web开发者工具调试微信页面,这两天弄着玩了一下,很强大.这篇文章只是 ...
- 图片上传并显示(兼容ie),图片大小判断
图片上传并显示(兼容ie),图片大小判断 HTML <div id="swf" style="margin: 0 auto;text-align: center;& ...
- <二> SQL 基础
left (outer) join 结果集包含连接表的匹配行,也包括左连接表的所有行. select a.a, a.b, a.c, b.c b.d b.f from a left out join b ...
- C#解压、压缩RAR文件
using System; using System.Collections.Generic; using System.Text; using System.IO; using Microsoft. ...
- FZU 2140 Forever 0.5
Problem 2140 Forever 0.5 Accept: 36 Submit: 113 Special JudgeTime Limit: 1000 mSec Memory ...
- 总结: Struts2 + Spring 的线程安全问题
1. 首先Struts2 本身是安全的 其原理大概是:Strtus2会获取到用户的http请求,然后负责给每个请求实例化一个Action 对象,但是大家注意,这里的action对象和Struts1里面 ...
- android 业务需求: 先干掉自己, 在重启自己
// 重启应用 public void restartApp() { Intent intent = new Intent(); // 参数1:包名,参数2:程序入口的activity intent. ...