Makefile文件需要编译作品codeC为Android [英] Makefile needed for compiling the Opus Codec for Android

查看:113
本文介绍了Makefile文件需要编译作品codeC为Android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图编译巨著音频codeC( HTTP://www.opus-$c $ cc.org /下载/ )在Android应用程序中使用。我使用的Andr​​oid NDK(第6版)编译我的库。到现在为止,我已经编译我的应用程序的本机C库已经pretty简单,我已经能够立足大多教程或其他例子JNI我Android.mk文件。然而,作品汇编看起来是有些复杂。将tar.gz压缩文件包含解决方案文件编译为Windows图书馆和它也包含了一个标准的Unix实现一些Makefile文件,但这些转换成一个Android.mk的Makefile的是Android NDK的使用是一个小小的挑战。

I am trying to compile the opus audio codec (http://www.opus-codec.org/downloads/) for use in an Android application. I am using Android NDK (release 6) to compile my libraries. Up to now, the native C libraries that I had to compile for my application has been pretty straightforward and I have been able to base my Android.mk files in jni mostly on tutorials or other examples. However, the compilation of Opus looks to be somewhat more complex. The tar.gz archive contains a solution file for compiling the libraries for Windows and it also contains some Makefiles for a standard Unix implementation, but translating these into an Android.mk makefile for use by the Android NDK is a bit of a challenge.

我已搜查,但一直无法找到为Android makefile编译libopus在线版本。有人可以或许连结我一个makefile文件?另外,我可能失去了一些东西简单?它是也许可以使用Automake的或某种转换器,以生成可能从已经包含在tar.gz的Unix的makefile文件对我Android.mk文件?

I have searched, but have been unable to find an online version for the Android makefile to compile libopus. Can someone perhaps link me to such a makefile? Alternatively, I might be missing something simpler? Is it perhaps possible to use Automake or some kind of converter to maybe generate the Android.mk file for me from the unix makefile that is already included in the tar.gz?

推荐答案

以下是Android.mk生成文件,最终为我工作。我希望这可以帮助别人太未来的人。请注意,在包含在作品存档Unix的makefile文件,是否使用固定或浮动丝绸来源的决定被定义为IFDEF,而我在这里使用固定。 (要使用浮动将是简单 - 只需更新路径丝/固定,指向丝/浮动,并更新CFLAGS

The following is the Android.mk makefile that eventually worked for me. I hope this can help someone else too in future. Do take note that in the unix makefile included in the Opus Archive, the decision of whether to use the fixed or float silk sources is defined as an "ifdef" whereas here I am using "fixed". (To use "float" would be simple - simply update the paths "silk/fixed" to point to "silk/float" and update the CFLAGS.

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

MY_MODULE_DIR       := opus

LOCAL_MODULE        := $(MY_MODULE_DIR)
LOCAL_SRC_FILES     := \
    $(subst $(ROOT_DIR)/$(MY_MODULE_DIR)/,,$(wildcard $(ROOT_DIR)/$(MY_MODULE_DIR)/src/*.c*)) \
    $(subst $(ROOT_DIR)/$(MY_MODULE_DIR)/,,$(wildcard $(ROOT_DIR)/$(MY_MODULE_DIR)/celt/*.c*)) \
    $(subst $(ROOT_DIR)/$(MY_MODULE_DIR)/,,$(wildcard $(ROOT_DIR)/$(MY_MODULE_DIR)/silk/*.c*)) \
    $(subst $(ROOT_DIR)/$(MY_MODULE_DIR)/,,$(wildcard $(ROOT_DIR)/$(MY_MODULE_DIR)/silk/fixed/*.c*))
LOCAL_LDLIBS        := -lm -llog
LOCAL_C_INCLUDES    := \
    $(ROOT_DIR)/$(MY_MODULE_DIR)/include \
    $(ROOT_DIR)/$(MY_MODULE_DIR)/silk \
    $(ROOT_DIR)/$(MY_MODULE_DIR)/silk/fixed \
    $(ROOT_DIR)/$(MY_MODULE_DIR)/celt
LOCAL_CFLAGS        := -DNULL=0 -DSOCKLEN_T=socklen_t -DLOCALE_NOT_USED -D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64
LOCAL_CFLAGS    += -Drestrict='' -D__EMX__ -DOPUS_BUILD -DFIXED_POINT -DUSE_ALLOCA -DHAVE_LRINT -DHAVE_LRINTF -O3 -fno-math-errno
LOCAL_CPPFLAGS      := -DBSD=1 
LOCAL_CPPFLAGS          += -ffast-math -O3 -funroll-loops

include $(BUILD_STATIC_LIBRARY)

这篇关于Makefile文件需要编译作品codeC为Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆