标签:
最近一直Android.mk这是什么一个令人沮丧的夜晚,点击此处记录。 ios你担心更多。不管那么多。xcode自己解决。 文本工具:MACVIM(文本编辑工具 很有用 你可以清楚地分辨tab 和Spaces,为了不写.mk错误) 件是向编译器描写叙述源码文件。便于它去解析。 下面是cocos2dx-3.2新建项目时生成的Android.mk文件 基本的语法: “#” 凝视 “:=” 赋值 “+=” 追加 “$” 引用某变量的值 #宏函数my-dir返回编译系统提供的当前路径,即Android.mk的文件夹 #如(HelloWorld/proj.android/jni/XX) LOCAL_PATH := $(call my-dir) #初始化模块 重置除LOCAL_PATH变量以外的全部变量 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) #模块名,唯一。LOCAL_MODULE := cocos2dcpp_shared #模块文件名称。唯一(可选) LOCAL_MODULE_FILENAME := libcocos2dcpp? #把.cpp .c .cc等实现文件的路径赋值给LOCAL_SRC_FILES 我用的是C++版 所以后缀是.cpp 我们新建文件时,须要在这里加入路径。 LOCAL_SRC_FILES := hellocpp/main.cpp ../../Classes/AppDelegate.cpp ../../Classes/HelloWorldScene.cpp #配置头文件的搜索范围 LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes #获取静态库 LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static #追加静态库 LOCAL_WHOLE_STATIC_LIBRARIES += cocosdenshion_static # LOCAL_WHOLE_STATIC_LIBRARIES += box2d_static # LOCAL_WHOLE_STATIC_LIBRARIES += cocosbuilder_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 #依据编译器提供的变量BUILD_SHARED_LIBRARY生成动态库 include $(BUILD_SHARED_LIBRARY) #导入模块。下面是经常使用的几个模块 $(call import-module,.) $(call import-module,audio/android) # $(call import-module,Box2D) # $(call import-module,editor-support/cocosbuilder) # $(call import-module,editor-support/spine) # $(call import-module,editor-support/cocostudio) # $(call import-module,network) # $(call import-module,extensions)
。
我是个懒人,參考子龙山人的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) LOCAL_MODULE := cocos2dcpp_shared LOCAL_MODULE_FILENAME := libcocos2dcpp #widcard为扩展通配符 #遍历文件夹和子文件夹 define walk $(wildcard $(1)) $(foreach e, $(wildcard $(1)/*), $(call walk, $(e))) endef #遍历路径Classes下得文件夹和子文件夹文件,并存入ALLFILES变量中 ALLFILES = $(call walk, $(LOCAL_PATH)/../../Classes) #从ALLFILES文件夹中提取文件,并存入FILE_LIST中 #.cc是Linux/Unix下为C++源文件的默认扩展名,与.cpp一个意思 #.c 由于我要用到sqlite3.c FILE_LIST := hellocpp/main.cpp FILE_LIST += $(filter %.cpp, $(ALLFILES)) FILE_LIST += $(filter %.c, $(ALLFILES)) FILE_LIST += $(filter %.cc, $(ALLFILES)) #搜索Classes下的子文件夹文件 FILE_INCLUDES += $(shell find $(LOCAL_PATH)/../../Classes -type d) #依据搜索到的文件名称 编译资源文件 LOCAL_SRC_FILES := $(FILE_LIST:$(LOCAL_PATH)/%=%) #提供搜索文件的路径 LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes $(FILE_INCLUDES) #静态库 LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static LOCAL_WHOLE_STATIC_LIBRARIES += cocosdenshion_static #LOCAL_WHOLE_STATIC_LIBRARIES += box2d_static #LOCAL_WHOLE_STATIC_LIBRARIES += cocosbuilder_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,Box2D) #$(call import-module,editor-support/cocosbuilder) #$(call import-module,editor-support/spine) $(call import-module,editor-support/cocostudio) $(call import-module,network) $(call import-module,extensions)
吐槽:这些零碎的东西引擎应该通过软件的开发来解决,或。
版权声明:本文博客原创文章,博客,未经同意,不得转载。
标签:
原文地址:http://www.cnblogs.com/hrhguanli/p/4612599.html