cocos2dx3.0-编译安卓的一些问题

前端之家收集整理的这篇文章主要介绍了cocos2dx3.0-编译安卓的一些问题前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

如何Android.mk自己去寻找Classes下的.cpp文件

  1. LOCAL_PATH := $(call my-dir)
  2.  
  3. include $(CLEAR_VARS)
  4. LOCAL_CPPFLAGS += -fexceptions
  5.  
  6. LOCAL_MODULE := cocos2dcpp_shared
  7.  
  8. LOCAL_MODULE_FILENAME := libcocos2dcpp
  9.  
  10. define walk
  11. $(wildcard $(1)) $(foreach e,$(wildcard $(1)/*),$(call walk,$(e)))
  12. endef
  13.  
  14. ALLFILES = $(call walk,$(LOCAL_PATH)/../../Classes)
  15.  
  16. FILE_LIST := hellocpp/main.cpp
  17. FILE_LIST += $(filter %.cpp,$(ALLFILES))
  18.  
  19. FILE_INCLUDES := $(shell find $(LOCAL_PATH)/../../Classes -type d)
  20.  
  21. LOCAL_SRC_FILES := $(FILE_LIST:$(LOCAL_PATH)/%=%)
  22. LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes
  23.  
  24. LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static
  25. LOCAL_WHOLE_STATIC_LIBRARIES += cocosdenshion_static
  26. LOCAL_WHOLE_STATIC_LIBRARIES += Box2d_static
  27.  
  28.  
  29.  
  30. include $(BUILD_SHARED_LIBRARY)
  31.  
  32. $(call import-module,2d)
  33. $(call import-module,audio/android)
  34. $(call import-module,Box2D)
  35.  

关于添加extensions编译时找不到文件的情况

  1. 在导入cocos-ext.h时不能写成
  2. #include "cocos-ext.h"
  3. 而是要写成
  4. #include "extensions/cocos-ext.h"

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