2011-05-04

android: link third party static libraries with PREBUILT_STATIC_LIBRARY

You have to declare each library as LOCAL_MODULE.
And each LOCAL_SRC_FILES should have only one .a file.

Android.mk:

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE    := foo
LOCAL_SRC_FILES := libfoo.a
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include

include $(PREBUILT_STATIC_LIBRARY)

And link this LOCAL_MODULE using LOCAL_STATIC_LIBRARIES

Android.mk(continue)


include $(CLEAR_VARS)

LOCAL_MODULE := bar
LOCAL_LDLIBS := -llog -ldl
LOCAL_SRC_FILES := bar.c
LOCAL_STATIC_LIBRARIES := foo

include $(BUILD_SHARED_LIBRARY)


Now libbar.so will be built with third party library libfoo.a.

For the details, see ndk docs(ANDROID-MK.html and PREBUILTS.html).


p.s. You can NOT link static library to built a new static library in ndk.

댓글 없음:

댓글 쓰기