之前在网上找了一些通用的MK文件,但是移植的时候,一直提示FIND参数格式不正确,然后花了一晚的时间,从某某博客解决了这个问题,下边贴出来这个文件:
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/extensions) LOCAL_MODULE := cocos2dcpp_shared LOCAL_MODULE_FILENAME := libcocos2dcpp # ################################################################# define walk $(wildcard $(1))$(foreach e,$(wildcard $(1)/*),$(call walk,$(e))) endef ALLFILES = $(call walk,$(LOCAL_PATH)/../../Classes) FILE_LIST := hellocpp/main.cpp FILE_LIST += $(filter %.cpp,$(ALLFILES)) LOCAL_SRC_FILES := $(FILE_LIST:$(LOCAL_PATH)/%=%) # FILE_INCLUDES := $(shell find $(LOCAL_PATH)/../../Classes -type d) ############################################################### #网上某个大神写的,能够遍历出来目录 rwildcard=$(wildcard $1$2) $(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2)) APP_FILES_PATH := $(LOCAL_PATH) \ $(LOCAL_PATH)/../../Classes APP_ALL_DIRS := $(dir $(foreach src_path,$(APP_FILES_PATH),$(src_path),*/) ) ) APP_ALL_DIRS := $(call uniq,$(APP_ALL_DIRS)) LOCAL_C_INCLUDES := $(APP_ALL_DIRS) #之前一直用这种方式 # LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes \ # $(LOCAL_PATH)/../../Util \ # $(LOCAL_PATH)/../../GameDataObj \ $(info [**********Find Directory**************]) $(info $(LOCAL_C_INCLUDES)) $(info [**********Find Directory**************]) #################################################################### LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static LOCAL_WHOLE_STATIC_LIBRARIES += cocosdenshion_static LOCAL_WHOLE_STATIC_LIBRARIES += cocos_extension_static LOCAL_WHOLE_STATIC_LIBRARIES += cocosbuilder_static # LOCAL_WHOLE_STATIC_LIBRARIES += Box2d_static # LOCAL_WHOLE_STATIC_LIBRARIES += spine_static LOCAL_WHOLE_STATIC_LIBRARIES += cocostudio_static # LOCAL_WHOLE_STATIC_LIBRARIES += cocos_network_static LOCAL_WHOLE_STATIC_LIBRARIES += cocos_extension_static include $(BUILD_SHARED_LIBRARY) $(call import-module,.) $(call import-module,audio/android) $(call import-module,extensions) $(call import-module,editor-support/cocosbuilder) # $(call import-module,Box2D) $(call import-module,editor-support/spine) $(call import-module,editor-support/cocostudio) # $(call import-module,network)原文链接:https://www.f2er.com/cocos2dx/346793.html