Do you remember the writing of the previous Android Mk file? Portal ,
We need to manually add CPP files, if more than one CPP, it is not to be exhausted?
Local_path: = $ (call My-dir) include $ (clear_vars) Local_module: = Cocos2dcpp_sharedlocal_module_filename: = Libcocos2dcpplocal_src_files: = Hellocpp/main.cpp. /.. /classes/appdelegate.cpp. /.. /classes/clipingnodelayer.cpp. /.. /classes/mainscene.cpp. /.. /classes/menutab.cpplocal_c_includes: = $ (Local_path)/. /.. /classeslocal_whole_static_libraries: = cocos2dx_staticlocal_whole_static_libraries + = Cocosdenshion_staticLOCAL_ Whole_static_libraries + = box2d_staticlocal_whole_static_libraries + = cocos_extension_static # add Cocos_extension Static library Local_whole_static_libraries + = cocostudio_static# Add Cocostudio static library include $ (build_shared_library) $ (call IMPORT-MODULE,2D) $ (call Import-module,audio/android) $ (call import-module,box2d) $ (call import-module,extensions) # Import Extensions module $ (call Import-module,editor-support/cocostudio) # import Cocostudio module
read many of the online blog of the Great God, only to find that can also be automated to traverse the CPP, such as the above MK file, only need to
Local_src_files: = Hellocpp/main.cpp . /.. /classes/appdelegate.cpp. /.. /classes/clipingnodelayer.cpp. /.. /classes/mainscene.cpp. /.. /classes/menutab.cpp
Switch
# traversing directories and subdirectories of functions define walk $ (wildcard $ (1)) $ (foreach E, $ (wildcard $ (1)/*), $ (call Walk, $ (e))) endef# Traverse classes Directory Allfi LES = $ (call walk, $ (local_path)/. /.. /classes) file_list: = hellocpp/main.cpp# extracts all. cpp files from all files File_list + = $ (filter%.cpp, $ (allfiles)) local_src_ FILES: = $ (file_list:$ (Local_path)/%=%)
The other parts are unchanged. Well, then it's OK.
After completing the complete Android Mk file as follows:
Local_path: = $ (call My-dir) include $ (clear_vars) Local_module: = Cocos2dcpp_sharedlocal_module_filename: = libcocos2dcpp# functions that traverse directories and subdirectories define walk $ (wildcard $ (1)) $ (foreach E, $ (wildcard $ (1)/*), $ (call Walk, $ (e))) endef# Traverse CLA SSEs Directory Allfiles = $ (call walk, $ (local_path)/. /.. /classes) File_list: = hellocpp/main.cpp# extracts all. cpp files from all files File_list + = $ (filter%.cpp, $ (allfiles)) LOCA L_src_files: = $ (file_list:$ (Local_path)/%=%) Local_c_includes: = $ (local_path)/... /.. /classeslocal_whole_static_libraries: = cocos2dx_staticlocal_whole_static_libraries + = Cocosdenshion_staticLOCAL_ Whole_static_libraries + = box2d_staticlocal_whole_static_libraries + = cocos_extension_static # add Cocos_extension Static library Local_whole_static_libraries + = cocostudio_static# Add Cocostudio static library include $ (build_shared_library) $ (call IMPORT-MODULE,2D) $ (call Import-module,audio/android) $ (call import-module,box2d) $ (call import-module,extensions) # Import Extensions module $ (call Import-module,editor-support/cocostudio) # GuideInto the Cocostudio module