Aqif Hamid
Aqif Hamid

Reputation: 3521

Creating a FILE_LIST of all .cpp files in a directory and sub directories in android.mk

I am trying to include all .cpp in Classes,EasyLib and EasyLibUsedirectories and all .cpp file sin there sub directories. But I am unable to do so, Kindly check my blow android.mk file.

I am doing this to include my .cpp files of cocos2dx game for android.

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := game_shared

LOCAL_MODULE_FILENAME := libgame

FILE_LIST := $(wildcard $(LOCAL_PATH)/../../Classes/*.cpp)
FILE_LIST += $(wildcard $(LOCAL_PATH)/../../EasyLib/**/*.cpp)
FILE_LIST += $(wildcard $(LOCAL_PATH)/../../EasyLibUse/**/*.cpp)

LOCAL_SRC_FILES := hellocpp/main.cpp \
                   $(FILE_LIST:$(LOCAL_PATH)/%=%)

LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes                   
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../Lib  
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../LibUse  

LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static cocosdenshion_static cocos_extension_static

include $(BUILD_SHARED_LIBRARY)

$(call import-module,CocosDenshion/android) \
$(call import-module,cocos2dx) \
$(call import-module,extensions)

EDIT:

FILE_LIST += $(wildcard $(LOCAL_PATH)/../../EasyLib/**/*.cpp)

FILE_LIST += $(wildcard $(LOCAL_PATH)/../../EasyLibUse/**/*.cpp)

This two fails to build .cpp files in sub directories.

regards, Aqif

Upvotes: 0

Views: 2130

Answers (1)

Marina.Eariel
Marina.Eariel

Reputation: 163

This is my Android.mk, I think this is what you're looking for:

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := game_shared

LOCAL_MODULE_FILENAME := libgame

cppfiles := $(shell find $(LOCAL_PATH) -name "*.cpp" -printf "%P \n")

LOCAL_SRC_FILES := $(cppfiles)


folders := $(shell find $(LOCAL_PATH) -type d -printf "%P \n")

LOCAL_C_INCLUDES := $(folders)     

LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static cocosdenshion_static cocos_extension_static


include $(BUILD_SHARED_LIBRARY)

$(call import-module,CocosDenshion/android) \
$(call import-module,cocos2dx) \
$(call import-module,extensions) 

Upvotes: 1

Related Questions