kingBook

导航

cocos2d Android.mk自动添加类

打开Android.mk修改以下代码:

 

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

替换成:

#-------------------------------------------------------------------------------------           
# 遍历目录及子目录的函数
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)/%=%)
#-------------------------------------------------------------------------------------

 

posted on 2016-02-01 09:48  kingBook  阅读(571)  评论(0编辑  收藏  举报