如何为多库本机c项目编写Android.mk文件?

时间:2011-08-23 06:29:46

标签: c++ android-ndk freetype

我有一个 seGraphics 库,它有 agg lib和 freetype lib。它们都是源文件 我想生成一个 seGraphics.a 文件。 我应该为每个人写一个Android.mk文件吗?怎么写呢? TIA!

这是我错误的尝试:

#Android.mk for seGraphics
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)

include $(LOCAL_PATH)/../../Agg/Android.mk

LOCAL_CXXFLAGS := -I../../

LOCAL_MODULE := seGraphics

LOCAL_SRC_FILES := ../../seCommonGradientBrush.cpp ../../seHatchBrush.cpp  

LOCAL_CPP_EXTENSION := .cpp

include $(BUILD_STATIC_LIBRARY)

#Android.mk for agg
LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := agg

LOCAL_LDFLAGS :=  
LOCAL_CFLAGS := -O3

LOCAL_C_INCLUDES := /home/maadiah/android-ndk-r6/platforms/android-9/arch-arm/usr/include \
        $(LOCAL_PATH)/font_freetype \
        $(LOCAL_PATH)/gpc \
            $(LOCAL_PATH)/include \
            $(LOCAL_PATH)/include/utils

AGG_SRCS := \
    $(LOCAL_PATH)/font_freetype/agg_font_freetype.cpp \
    $(LOCAL_PATH)/gpc/gpc.cpp \
    $(LOCAL_PATH)/src/*.cpp \

LOCAL_CPP_EXTENSION := .cpp     

include $(BUILD_STATIC_LIBRARY)

1 个答案:

答案 0 :(得分:0)

我发现最好独立构建每个lib(即freetype和agg)。然后通过使用以下内容链接freetype和agg来构建seGraphics:LD_FLAGS + = -lfreetype -lagg。