Cocos2d-x Android. mk File Auto modifier, cocos2dxandroid

Source: Internet
Author: User

Cocos2d-x Android. mk File Auto modifier, cocos2dxandroid

Do cocos2d-x projects, usually with computer development, and then transplanted to the mobile phone platform. You need to re-compile and package it into an apk file using eclipse or other tools to transplant it to your Android phone. If you use eclipse to package, you need to add the project's cpp file to Android one by one. in mk configuration, it doesn't matter if there are few files, but if there are many files, manual addition is troublesome, especially in some cases, it should be different from the original Andriod. compare the mk configuration. What files are added this time, and then add the new files.

In short, it is difficult to manually modify the Android. mk configuration by packaging it into an apk. So I made an automatic modifier. For example:


My Cocos2d-x Android. mk File Auto modifier:

Http://download.csdn.net/detail/stevenkylelee/8426235


If you use QT5.4 to run it independently, You need to attach the QT dll, so the program size is 16 Mb. Every time I run this program, I use a browser to open my CSDN blog. Hey, I have to pay a price for my work.> _ <

To automatically modify the Android. mk file, you must enter the following three parameters:

   Source code directory path:Points to the source code directory of the cocos2d-x project, typically the path to the project's Classes file. The program traverses all *. cpp files in this directory, finds all cpp files, and generates configuration strings.

   Android. mk file path:Point to the Android. mk file to be modified.

The two parameters correspond to the directory and file of the project, as shown in:



   Search for the replaced regular expression:To locate the replaced content, for example, LOCAL_SRC_FILES: = hellocpp/main. cpp. The program replaces the string in the original Android. mk with the string generated by the program to implement automatic modification.

Here, the regular expression is implemented by QT. The regular expressions of QT are somewhat different from those of C ++ 11 and C. Why use a regular expression? Regular expressions have better scalability. If it is difficult to locate the content to be replaced, you can first write a mark in the original mk file and then replace it with regular matching.

In practice, we found that the LOCAL_SRC_FILES: = field can be used not only to add the configuration of the cpp file, but also to introduce so and reference configurations of other libraries. What we need is to replace the field configured in the source code. "LOCAL_SRC_FILES *: = [a-zA-Z0-9 _/.] + cpp. * (\ r * \ n \ s * \ n)" This regular will match the LOCAL_SRC_FILES in the source code configuration. The program uses this regular expression by default. Of course, it can also be changed to another regular expression.

The three parameters will be saved when the program is closed. The parameter settings of the last saved will be restored when the program is opened next time.

After setting the parameters, click "generate" to modify the specified mk file.

The result of program modification is as follows:














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.