Android std Android.mk && Application.mk
Android.mk
LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := NDKLIBRARY FILE_LIST := $(wildcard $(LOCAL_PATH)/src/SOIL2/*.c) FILE_LIST += $(wildcard $(LOCAL_PATH)/src/yuv/source/*.cc) $(warning FILE_LIST =============> $(FILE_LIST)) #添加跨平台源文件 LOCAL_SRC_FILES := $(FILE_LIST)\ #链接 LOCAL_LDLIBS += -L$(SYSROOT)/usr/lib -llog LOCAL_LDLIBS += -lGLESv3 -lEGL -landroid #链接其他库 #LOCAL_SHARED_LIBRARIES := \ #libcutils \ #libutils \ #工作包含目录 LOCAL_C_INCLUDES += $(SYSROOT)\usr/include/ LOCAL_C_INCLUDES += $(LOCAL_PATH)/src/SOIL2/ LOCAL_C_INCLUDES += $(LOCAL_PATH)/src/yuv/include LOCAL_C_INCLUDES += $(LOCAL_PATH)/src/yuv/include/libyuv $(warning 工作目录 $(LOCAL_PATH) 包含目录 $(LOCAL_C_INCLUDES)) #编译生成动态库 include $(BUILD_SHARED_LIBRARY) #编译生成静态库 #include $(BUILD_STATIC_LIBRARY)
Application.mk
APP_PLATFORM := android-18 #APP_ABI := all APP_ABI := armeabi-v7a #APP_ABI := armeabi APP_STL := c++_static APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -std=c++11 -fsigned-char -Wno-extern-c-compat APP_LDFLAGS := -latomic APP_SHORT_COMMANDS := true LOCAL_ALLOW_UNDEFINED_SYMBOLS := true #ifeq ($(NDK_DEBUG),1) # APP_CPPFLAGS += -DCOCOS2D_DEBUG=1 # APP_OPTIM := debug #else # APP_CPPFLAGS += -DNDEBUG # APP_OPTIM := release #endif
android
Android.mk
{
LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) $(call import-add-path,$(LOCAL_PATH)/../../../cocos2d) $(call import-add-path,$(LOCAL_PATH)/../../../cocos2d/external) $(call import-add-path,$(LOCAL_PATH)/../../../cocos2d/cocos) $(call import-add-path,$(LOCAL_PATH)/../../../cocos2d/cocos/audio/include) LOCAL_MODULE := MyGame_shared LOCAL_MODULE_FILENAME := libMyGame FILE_LIST := $(wildcard $(LOCAL_PATH)/../../../Classes/*.cpp) FILE_LIST += $(wildcard $(LOCAL_PATH)/../../../Classes/*/*.cpp) FILE_LIST += $(wildcard $(LOCAL_PATH)/../../../Classes/*/*/*.cpp) FILE_LIST += $(wildcard $(LOCAL_PATH)/../../../Classes/*/*/*/*.cpp) LOCAL_SRC_FILES := $(LOCAL_PATH)/hellocpp/main.cpp \ $(FILE_LIST)\ #$(LOCAL_PATH)/../../../Classes/AppDelegate.cpp \ #$(LOCAL_PATH)/../../../Classes/FirstScene.cpp\ LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../../Classes LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../../Classes/exter LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../../Classes/exter/libyuv LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../../Classes/exter/iconv LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../../Classes/exter/iconv/iconv LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../../Classes/exter/socket LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../../Classes/exter/socket/Private LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../../Classes/exter/sqlite LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../../Classes/exter/Tools LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../../Classes/exter/xml LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../../Classes/exter/xml/tinyxml # _COCOS_HEADER_ANDROID_BEGIN # _COCOS_HEADER_ANDROID_END LOCAL_STATIC_LIBRARIES := cocos2dx_static # _COCOS_LIB_ANDROID_BEGIN LOCAL_LDLIBS += libs/$(TARGET_ARCH_ABI)/libNDKLIBRARY.so # _COCOS_LIB_ANDROID_END include $(BUILD_SHARED_LIBRARY) $(call import-add-path, $(LOCAL_PATH)/../../../cocos2d) $(call import-module, cocos) # _COCOS_LIB_IMPORT_ANDROID_BEGIN # _COCOS_LIB_IMPORT_ANDROID_END
Application.mk
{
APP_STL := c++_static APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -std=c++11 -fsigned-char -Wno-extern-c-compat APP_LDFLAGS := -latomic APP_ABI := armeabi-v7a APP_SHORT_COMMANDS := true ifeq ($(NDK_DEBUG),1) APP_CPPFLAGS += -DCOCOS2D_DEBUG=1 APP_OPTIM := debug else APP_CPPFLAGS += -DNDEBUG APP_OPTIM := release endif
}
}