标签:
1 LOCAL_SRC_FILES := hellocpp/main.cpp 2 ../../Classes/AppDelegate.cpp 3 ../../Classes/HelloWorldScene.cpp
这样写很麻烦,每增加一个cpp就要添加一行。使用通配符(wildcard)的方式就可以解决
1 SRC_FILES := hellocpp/main.cpp 2 SRC_FILES += $(wildcard $(LOCAL_PATH)/../../Classes/*.cpp) 3 SRC_FILES += $(wildcard $(LOCAL_PATH)/../../Classes/*/*.cpp) 4 SRC_FILES += $(wildcard $(LOCAL_PATH)/../../Classes/*/*/*.cpp) 5 LOCAL_SRC_FILES := $(SRC_FILES:$(LOCAL_PATH)/%=%)
上面相当于搜索Classes目录下的3目录中所有的cpp文件
以上写法参考了 http://blog.163.com/long_wtf/blog/static/18555327020149144495734/
1 LOCAL_PATH := $(call my-dir) 2 3 include $(CLEAR_VARS) 4 5 $(call import-add-path,$(LOCAL_PATH)/../../../cocos2d) 6 $(call import-add-path,$(LOCAL_PATH)/../../../cocos2d/external) 7 $(call import-add-path,$(LOCAL_PATH)/../../../cocos2d/cocos) 8 9 LOCAL_MODULE := cocos2dcpp_shared 10 11 LOCAL_MODULE_FILENAME := libcocos2dcpp 12 13 SRC_FILES := hellocpp/main.cpp 14 SRC_FILES += $(wildcard $(LOCAL_PATH)/../../../Classes/*.cpp) 15 SRC_FILES += $(wildcard $(LOCAL_PATH)/../../../Classes/*/*.cpp) 16 LOCAL_SRC_FILES := $(SRC_FILES:$(LOCAL_PATH)/%=%) 17 18 LOCAL_CFLAGS := -DUSE_FILE32API -DGL_GLEXT_PROTOTYPES=1 19 20 LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../../Classes 21 22 # _COCOS_HEADER_ANDROID_BEGIN 23 # _COCOS_HEADER_ANDROID_END 24 25 26 LOCAL_STATIC_LIBRARIES := cocos2dx_static 27 28 # _COCOS_LIB_ANDROID_BEGIN 29 # _COCOS_LIB_ANDROID_END 30 31 include $(BUILD_SHARED_LIBRARY) 32 33 $(call import-module,.) 34 35 # _COCOS_LIB_IMPORT_ANDROID_BEGIN 36 # _COCOS_LIB_IMPORT_ANDROID_END
标签:
原文地址:http://www.cnblogs.com/little-byte/p/5072654.html