如何往自己编译的opencore里面添加自己的项目。

本文介绍了如何在Opencore项目中添加自定义的库文件(lib)和可执行程序。具体步骤包括创建必要的目录结构、编写本地构建文件(local.mk),以及修改全局构建配置文件等。适用于需要扩展Opencore功能或集成第三方组件的开发者。

这里分为两种情况来说,

 

如果你要添加lib

假设这里我们要添加一个libtest.so,按一下步骤进行

1,在opencore目录下,新建一个文件夹test,在test目录下添加build目录,在build目录下分别创建android和make两个目录,进入make目录,创建一个新文件local.mk。文件的内容按如下模版进行,也可以去其他的位置copy一份过来:

 

LOCAL_PATH := $(call get_makefile_dir)

include $(MK)/clear.mk

TARGET := test_lib

XINCDIRS +=

SRCDIR :=  ../../

INCSRCDIR :=

SRCS := test.c

LIBS

include $(MK)/library.mk

 

 

2,在build_config/opencore_dynamic/makefile里include $(MK)/cml2_shared.mk之前一行,加上

TARGET_shared += "test"

SOLIBDIRS_test="/test/build/make"

test_so_name='test'

SOLIBS_test=""

 

然后执行make,即可。

 

 

 

如果要添加一个可执行程序,local.mk的最后一行写成:include $(MK)/prog.mk

直接在build_config/opencore_dynamic/makefile里更改TESTAPPS

TESTAPPS="pvplayer_engine_test test_pvauthorengine pv2way_omx_engine_test xxxx"

然后加上

TESTAPP_DIR_xxxx=<directory to your xxxx's local.mk file>

 

执行make。

 

 

# Use XCFLAGS to add extra compiler directives for the C compiler

# if you add any please use "XCFLAGS += ..." not "XCFLAGS = " 

# unless you're sure you want to override the project defaults.

# Please include a comment if you do this.

#

# XCFLAGS += 

 

# Use XCXXFLAGS to add extra compiler directives for the C++ compiler.

# See notes above regarding overriding project defaults.

#

# XCXXFLAGS += -DUSE_UNICODE  -D_POSIX_PTHREAD_SEMANTICS   #-D_POSIX_SOURCE

XCXXFLAGS += $(FLAG_COMPILE_WARNINGS_AS_ERRORS)

 

# Use XCPPFLAGS to add extra preprocessor directives. Use XINCDIRS

# for other include directories, but please only do this if absolutely

# necessary -- let the makefile system find the include directories if 

# possible.

# See notes above regarding overriding project defaults.

#

# XCPPFLAGS +=  

 

# Use XINCDIRS for extra include directories. These should be proceeded 

# with "-I" just as they would be when passing to the compiler.

#

# XINCDIRS += 

 

 

# Use XLIBDIRS for extra library directories. These should be proceeded 

# with "-L" just as they would be when passing to the linker. 

# Used for building executables.

#

# XLIBDIRS += 

 

# Use XLDFLAGS for extra linker directives.

# Used for building executables.

#

# XLDFLAGS += 

 

评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值