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

来源:百度文库 编辑:神马文学网 时间:2024/03/29 17:28:57

这里分为两种情况来说,

如果你要添加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=

执行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 +=