cocos2dx 安卓makefile Android.mk,动态引用cpp地址

前端之家收集整理的这篇文章主要介绍了cocos2dx 安卓makefile Android.mk,动态引用cpp地址前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

原因:

每次加一个cpp,都要改写Android.mk 一次,修改了引用脚本,就不用每次都该了。

修改LOCAL_SRC_FILES 的赋值


转自

http://suool.net/


原来的。

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)





LOCAL_MODULE := cocos2dcpp_shared

LOCAL_MODULE_FILENAME := libcocos2dcpp

LOCAL_SRC_FILES := hellocpp/main.cpp \
                   ../../Classes/AppDelegate.cpp \
                   ../../Classes/HelloWorldScene.cpp

LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes

# _COCOS_HEADER_ANDROID_BEGIN
# _COCOS_HEADER_ANDROID_END


LOCAL_STATIC_LIBRARIES := cocos2dx_static

# _COCOS_LIB_ANDROID_BEGIN
# _COCOS_LIB_ANDROID_END

include $(BUILD_SHARED_LIBRARY)

$(call import-module,./prebuilt-mk)

# _COCOS_LIB_IMPORT_ANDROID_BEGIN
# _COCOS_LIB_IMPORT_ANDROID_END



修改后的:

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)





LOCAL_MODULE := cocos2dcpp_shared

LOCAL_MODULE_FILENAME := libcocos2dcpp

# 遍历目录及子目录的函数
define walk
$(wildcard $(1)) $(foreach e,$(wildcard $(1)/*),$(call walk,$(e)))
endef
# 遍历Classes目录
ALLFILES = $(call walk,$(LOCAL_PATH)/../../Classes)
FILE_LIST := hellocpp/main.cpp
# 从所有文件提取出所有.cpp文件
FILE_LIST += $(filter %.cpp,$(ALLFILES))
LOCAL_SRC_FILES := $(FILE_LIST:$(LOCAL_PATH)/%=%)


LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes

# _COCOS_HEADER_ANDROID_BEGIN
# _COCOS_HEADER_ANDROID_END


LOCAL_STATIC_LIBRARIES := cocos2dx_static

# _COCOS_LIB_ANDROID_BEGIN
# _COCOS_LIB_ANDROID_END

include $(BUILD_SHARED_LIBRARY)

$(call import-module,./prebuilt-mk)

# _COCOS_LIB_IMPORT_ANDROID_BEGIN
# _COCOS_LIB_IMPORT_ANDROID_END
原文链接:https://www.f2er.com/cocos2dx/339818.html

猜你在找的Cocos2d-x相关文章