After googled a lot, I figured out how to include existing prebuilt libs.
You have to add local modules (static or shared), and let your main module to call them in the android.mk.
#Here is the format for static libs. The shared ones work in the similar way.
#I use libpng as an example
include $(CLEAR_VARS)
LOCAL_MODULE := libpng
LOCAL_SRC_FILES := PATH/TO/YOUR/LIB/libpng.a
LOCAL_EXPORT_C_INCLUDES := PATH/TO/YOUR/INCLUDE
include $(PREBUILT_STATIC_LIBRARY)
#call it in your main module
include $(CLEAR_VARS)
LOCAL_C_INCLUDES := $(ANDROID_TOOLCHAIN)/include/
LOCAL_C_INCLUDES += $(ANDROID_SYSROOT)/include/
LOCAL_MODULE := YourModuleName
LOCAL_CFLAGS := -Wall -Wextra
LOCAL_CPPFLAGS += -std=c++11
LOCAL_SRC_FILES := YourModule.cpp
#add your external static modules
LOCAL_STATIC_LIBRARIES := libpng
LOCAL_LDLIBS := -llog -lGLESv2 -lEGL -landroid
include $(BUILD_SHARED_LIBRARY)
No comments:
Post a Comment