Cocos2d-x 3.0 Android Mk file auto traverse *.cpp file

Source: Internet
Author: User

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 


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.