[COCOS2DX] Cross-compiling Practice + speed optimization (vs2012 modify Win32 code + modify Makefile+ build Android Project package + Deploy Android Project package to eclipse+ run APK)

Source: Internet
Author: User

You can tell by the previous deployment process that the COCOS2DX development process is as follows:

1.vs2012 Complete Changes

2. Because the CPP file location is specified, the NDK can complete the compilation of C + + files by JNI, and run the following command to complete the compilation of Proj.android:

CD C:\ComputerScience\workspace-cocos\HelloWorld\proj.android

Python build_native.py

3. Import the compiled Android project into eclipse for compiling and running

But these steps are all running under the official Website Toolkit, and cross-compiling takes a lot of time (developing the Win32 Platform for HelloWorld single project, cross-compiling the Android project package, Eclipse compiling the Android project package, running the APK), The following begins with an official website toolkit as a basis for exploring the optimal speed of the solution.

1.cocos new Helloworld-p com.cocos2dx.org-l cpp-d C:\ComputerScience\workspace-cocos

2. See the following script in build_naitive.py:

Command = ' Cocos compile-p android-s%s-m%s '% (App_android_root, Build_mode)

Where App_android_root points to C:\ComputerScience\workspace-cocos\HelloWorld

The relevant parameter explanation is described in Http://www.cocos2d-x.org/wiki/Cocos_compile:

Modify the command to: Command = ' Cocos compile-p android-j 4-s%s-m%s '% (App_android_root, build_mode),-J4 Multi-core compilation added to speed up compilation

Try compiling the Android Project package:

CD C:\ComputerScience\workspace-cocos\FirstDemo\proj.android

Python build_native.py

The entire compilation process takes only 7 seconds, a lot faster.

Analyze the Android.mk file for the JNI directory:

You can find that the file specifies the CPP file that needs to be compiled.

2. Next, modify the name of the project to be displayed at vs2012, then use

CD C:\ComputerScience\workspace-cocos\HelloWorld\proj.android

Python build_native.py

Compile the Android project package to run on your phone.

2.1vs2012 Modify the name to "My HelloWorld":

At the same time, to speed up the compilation speed to cancel incremental links:

Operation Result:

Compile the Android project package to run the following results:

CD C:\ComputerScience\workspace-cocos\HelloWorld\proj.android

Python build_native.py

In eclipse compile run on Android phone:

At this point the entire cross-compilation process is straightened out.

[COCOS2DX] Cross-compiling Practice + speed optimization (vs2012 modify Win32 code + modify Makefile+ build Android Project package + Deploy Android Project package to eclipse+ run APK)

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.