本文介绍了的libjpeg涡轮增压为Android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要的libjpeg涡轮增压为Android NDK。有没有人设法将其编译为.A(静态)LIB?我已经尝试了几次,但它给了我很多的错误而已。

I need libjpeg-turbo for android ndk. Did anyone managed to compile it as .a (static) lib?I have tried a few times, but it gave me a lot of errors only.

推荐答案

安装Android NDK 。下面的说明与被验证的 R8B ,旧版本可能有问题,我不知道。

Install Android NDK. Following instructions were verified with r8b, older versions may have problems, I don't know.

获取Android源从本杰明Gaignard 的libjpeg涡轮增压

Get the Android sources for libjpeg-turbo from Benjamin Gaignard:

git clone git://git.linaro.org/people/tomgall/libjpeg-turbo/libjpeg-turbo.git -b linaro-android

的libjpeg涡轮增压由混帐,编辑文件创建目录 Android.mk :行70后, LOCAL_MODULE:=的libjpeg ,添加以下内容:

In the libjpeg-turbo directory created by git, edit file Android.mk: after line 70, LOCAL_MODULE := libjpeg, add the following:

ifeq ($(notdir $(MAKECMDGOALS)),libjpeg.a)
  LOCAL_SRC_FILES +=  $(libsimd_SOURCES_DIST)
  include $(BUILD_STATIC_LIBRARY)
  include $(CLEAR_VARS)
  LOCAL_MODULE := dummy
endif

运行 NDK建造

ndk-build NDK_PROJECT_PATH=. APP_BUILD_SCRIPT=./Android.mk obj/local/armeabi/libjpeg.a

利润!

PS:您可能希望在 armeabi-V7A 版本:

ndk-build NDK_PROJECT_PATH=. APP_BUILD_SCRIPT=./Android.mk APP_ABI=armeabi-v7a obj/local/armeabi-v7a/libjpeg.a

或者编译 ARM ,以提高性能,添加到命令行:

Or compile for ARM, to improve performance, add to command line:

LOCAL_ARM_MODE=arm

如果你的目标有 NEON 的支持,添加到命令行:

If your target has NEON support, add to command line:

LOCAL_ARM_NEON=true ARCH_ARM_HAVE_NEON=true

这篇关于的libjpeg涡轮增压为Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-15 15:37