Simplify inclusion of cocos2d in Android NDK projects: Cocos2DX is the only module that importing projects need to add. Requires Android NDK r7.

* Uses NDK modules as the basis of the build system for Android NDK
 * Add a cocos2dx module to generate a shared library named cocos2dx_shared. Library name is still libcocos2d.so
 * The dependencies of this module are also Android NDK modules
 * ... which are prebuilt static libraries from the png, jpeg and xml2 modules.
 * Dependency library names set to libjpeg, libpng, etc. even though we are building variants with names like jpeg_shared.
This commit is contained in:
folecr 2012-01-27 16:37:32 -08:00
parent e6fddbc047
commit b0b5790e06
4 changed files with 41 additions and 13 deletions

View File

@ -1,8 +1,10 @@
LOCAL_PATH := $(call my-dir)
# compile cocos2d.so
include $(CLEAR_VARS)
LOCAL_MODULE := libcocos2d
LOCAL_MODULE := cocos2dx_shared
LOCAL_MODULE_FILENAME := cocos2d
LOCAL_SRC_FILES := \
CCConfiguration.cpp \
@ -106,19 +108,21 @@ touch_dispatcher/CCTouchHandler.cpp
LOCAL_C_INCLUDES := $(LOCAL_PATH)/ \
$(LOCAL_PATH)/include \
$(LOCAL_PATH)/platform \
$(LOCAL_PATH)/platform/third_party/android/iconv \
$(LOCAL_PATH)/platform/third_party/android/libpng \
$(LOCAL_PATH)/platform/third_party/android/libxml2 \
$(LOCAL_PATH)/platform/third_party/android/libjpeg
$(LOCAL_PATH)/platform
LOCAL_LDLIBS := -L$(call host-path, $(LOCAL_PATH)/platform/third_party/android/libraries/$(TARGET_ARCH_ABI)) \
-lGLESv1_CM -llog -lz \
-lpng \
-lxml2 \
-ljpeg
LOCAL_LDLIBS := -lGLESv1_CM \
-llog \
-lz
LOCAL_STATIC_LIBRARIES := png_static_prebuilt
LOCAL_STATIC_LIBRARIES += xml2_static_prebuilt
LOCAL_STATIC_LIBRARIES += jpeg_static_prebuilt
# define the macro to compile through support/zip_support/ioapi.c
LOCAL_CFLAGS := -DUSE_FILE32API
include $(BUILD_SHARED_LIBRARY)
$(call import-module,platform/third_party/android/modules/libpng)
$(call import-module,platform/third_party/android/modules/libxml2)
$(call import-module,platform/third_party/android/modules/libjpeg)

View File

@ -0,0 +1,8 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := jpeg_static_prebuilt
LOCAL_MODULE_FILENAME := jpeg
LOCAL_SRC_FILES := libs/$(TARGET_ARCH_ABI)/libjpeg.a
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
include $(PREBUILT_STATIC_LIBRARY)

View File

@ -0,0 +1,8 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := png_static_prebuilt
LOCAL_MODULE_FILENAME := png
LOCAL_SRC_FILES := libs/$(TARGET_ARCH_ABI)/libpng.a
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
include $(PREBUILT_STATIC_LIBRARY)

View File

@ -0,0 +1,8 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := xml2_static_prebuilt
LOCAL_MODULE_FILENAME := xml2
LOCAL_SRC_FILES := libs/$(TARGET_ARCH_ABI)/libxml2.a
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
include $(PREBUILT_STATIC_LIBRARY)