Skip to content

Instantly share code, notes, and snippets.

@zilongshanren
Last active April 1, 2017 04:56
Show Gist options
  • Save zilongshanren/6060595 to your computer and use it in GitHub Desktop.
Save zilongshanren/6060595 to your computer and use it in GitHub Desktop.
Android Makefile , support box2d
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := game_shared
LOCAL_MODULE_FILENAME := libgame
#traverse all the directory and subdirectory
define walk
$(wildcard $(1)) $(foreach e, $(wildcard $(1)/*), $(call walk, $(e)))
endef
#traverse Classes Directory
ALLFILES = $(call walk, $(LOCAL_PATH)/../../Classes)
FILE_LIST := hellocpp/main.cpp
FILE_LIST += $(filter %.cpp, $(ALLFILES))
FILE_INCLUDES := $(shell find $(LOCAL_PATH)/../../Classes -type d)
#source file will be compiled
LOCAL_SRC_FILES := $(FILE_LIST:$(LOCAL_PATH)/%=%)
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../../external/Box2D/ \
$(FILE_INCLUDES) \
LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static cocosdenshion_static cocos_extension_static box2d_static
include $(BUILD_SHARED_LIBRARY)
$(call import-module,CocosDenshion/android) \
$(call import-module,cocos2dx) \
$(call import-module,extensions) \
$(call import-module,external/Box2D)
@Zhangzhiyi
Copy link

请问用你这个mk文件怎么过滤掉我不想编译的文件

@zilongshanren
Copy link
Author

使用正则表达式过滤吧。

@sundarchen
Copy link

你好,我把你的这字配置copy到我项目里面,但是报了find:参数格式不正确

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment