COCOS2DX android.mk in a universal template

Source: Internet
Author: User
<span id="Label3"></p><span data-wiz-span="data-wiz-span"><span data-wiz-span="data-wiz-span">· Eclipse Engineering</span></span><span data-wiz-span="data-wiz-span"><span data-wiz-span="data-wiz-span">in the Android.mk file in the project Proj.android\jni directory, you need to assign a value to the local_src_files, write the CPP files used in the project, and create the project with the template as follows</span></span><pre><pre><span style="color: #008080;">1</span> <span style="color: #008080;">2</span> <span style="color: #008080;">3</span> .. /.. /classes/helloworldscene.cpp</pre></pre><p><p></p></p><p><p>It's a hassle to write, adding a line to each additional cpp. Use wildcard characters (wildcard) to resolve</p></p><p><p></p></p><pre><pre><span style="color: #008080;">1</span> src_files: = hellocpp/main.cpp<span style="color: #008080;">2</span> src_files + = $ (wildcard $ (local_path)/... /.. /classes/*<span style="color: #000000;">. Cpp)</span><span style="color: #008080;">3</span> src_files + = $ (wildcard $ (local_path)/. /.. /classes/*/<span style="color: #008000;">*</span><span style="color: #008000;">. Cpp)</span><span style="color: #008080;">4</span><span style="color: #008000;">src_files + = $ (wildcard $ (local_path)/... /.. /classes/</span><span style="color: #008000;"></span>*/<span style="color: #008000;"></span>*/*<span style="color: #008000;">cpp)</span><span style="color: #008080;">5</span><span style="color: #008000;">local_src_files: = $ (src_files:$ (local_ PATH)/%=%)</span></pre></pre><p><p></p></p><p><p>This is equivalent to searching all the CPP files in the 3 directory under the classes directory</p></p><p><p></p></p><span style="color: #5d5d5d;"><span style="color: #5d5d5d;">the above reference</span></span>http://blog.163.com/long_wtf/blog/static/18555327020149144495734/<br><strong><strong>then in the project directory folder, Press and hold shift+ right mouse button, Select the popup menu "here to pop up command line window", enter</strong></strong><strong><strong> <span style="color: #ff0000;">Cocos run-p Android</span> can compile and run the Android project, if the code is not wrong and the Android device is already connected, it will compile and run the program directly on the Device. </strong></strong><strong><strong>----------------------------------------------------------------------------------------------------------- -----------------------------------</strong></strong><span data-wiz-span="data-wiz-span"><span data-wiz-span="data-wiz-span">· Android-studio Engineering</span></span><span data-wiz-span="data-wiz-span">in <span data-wiz-span="data-wiz-span">Project proj.android-studio, because the Jni folder is placed <span style="color: #5d5d5d; font-family: ‘Hiragino Sans GB W3‘, ‘Hiragino Sans GB‘, Arial, Helvetica, simsun, u5b8bu4f53;">in proj.android-studio\app, add a layer of fallback </span> <strong><span style="color: #ff0000;">/... </span></strong>to the above Template. </span></span>So the final template is as Follows:<pre><span style="color: #008080;"><span style="color: #008080;">1</span></span>Local_path: = $ (call my-<span style="color: #000000;"><span style="color: #000000;">Dir)</span></span><span style="color: #008080;"><span style="color: #008080;">2</span></span> <span style="color: #008080;"><span style="color: #008080;">3</span></span> <span style="color: #000000;"><span style="color: #000000;">include $ (clear_vars)</span></span><span style="color: #008080;"><span style="color: #008080;">4</span></span> <span style="color: #008080;"><span style="color: #008080;">5</span></span>$ (call import-add-path,$ (local_path)/. /.. /.. /<span style="color: #000000;"><span style="color: #000000;">Cocos2d)</span></span><span style="color: #008080;"><span style="color: #008080;">6</span></span>$ (call import-add-path,$ (local_path)/. /.. /.. /cocos2d/external)<span style="color: #008080;"><span style="color: #008080;">7</span></span>$ (call import-add-path,$ (local_path)/. /.. /.. /cocos2d/cocos)<span style="color: #008080;"><span style="color: #008080;">8</span></span> <span style="color: #008080;"><span style="color: #008080;">9</span></span>Local_module: =<span style="color: #000000;"><span style="color: #000000;">cocos2dcpp_shared</span></span><span style="color: #008080;"><span style="color: #008080;">Ten</span></span> <span style="color: #008080;"><span style="color: #008080;"></span> one</span>Local_module_filename: =<span style="color: #000000;"><span style="color: #000000;">Libcocos2dcpp</span></span><span style="color: #008080;"><span style="color: #008080;"></span> a</span> <span style="color: #008080;"><span style="color: #008080;"></span> -</span>Src_files: = Hellocpp/main.cpp<span style="color: #008080;"><span style="color: #008080;"></span> -</span>Src_files + = $ (wildcard $ (local_path)/.. /.. /.. /classes<span style="color: #008000;"><span style="color: #008000;">/*</span></span><span style="color: #008000;"><span style="color: #008000;">. Cpp)</span></span><span style="color: #008080;"><span style="color: #008080;"></span> the</span> <span style="color: #008000;"><span style="color: #008000;">Src_files + = $ (wildcard $ (local_path)/.. /.. /.. /classes/</span></span><span style="color: #008000;"><span style="color: #008000;">*/</span></span>*<span style="color: #000000;"><span style="color: #000000;">. Cpp)</span></span><span style="color: #008080;"><span style="color: #008080;"></span> -</span>Local_src_files: = $ (src_files:$ (local_path)/%=%)<span style="color: #008080;"><span style="color: #008080;"></span> -</span> <span style="color: #008080;"><span style="color: #008080;"></span> -</span>Local_cflags: =-duse_file32api-dgl_glext_prototypes=1<span style="color: #008080;"><span style="color: #008080;"></span> +</span> <span style="color: #008080;"><span style="color: #008080;"></span> -</span>Local_c_includes: = $ (local_path)/. /.. /.. /<span style="color: #000000;"><span style="color: #000000;">Classes</span></span><span style="color: #008080;"><span style="color: #008080;"></span> +</span> <span style="color: #008080;"><span style="color: #008080;"></span> a</span> <span style="color: #000000;"><span style="color: #000000;"># _cocos_header_android_begin</span></span><span style="color: #008080;"><span style="color: #008080;"></span> at</span> <span style="color: #000000;"><span style="color: #000000;"># _cocos_header_android_end</span></span><span style="color: #008080;"><span style="color: #008080;"></span> -</span> <span style="color: #008080;"><span style="color: #008080;"></span> -</span> <span style="color: #008080;"><span style="color: #008080;"></span> -</span>Local_static_libraries: =<span style="color: #000000;"><span style="color: #000000;">cocos2dx_static</span></span><span style="color: #008080;"><span style="color: #008080;"></span> -</span> <span style="color: #008080;"><span style="color: #008080;"></span> -</span> <span style="color: #000000;"><span style="color: #000000;"># _cocos_lib_android_begin</span></span><span style="color: #008080;"><span style="color: #008080;"></span> in</span> <span style="color: #000000;"><span style="color: #000000;"># _cocos_lib_android_end</span></span><span style="color: #008080;"><span style="color: #008080;"></span> -</span> <span style="color: #008080;"><span style="color: #008080;"></span> to</span> <span style="color: #000000;"><span style="color: #000000;">include $ (build_shared_library)</span></span><span style="color: #008080;"><span style="color: #008080;"></span> +</span> <span style="color: #008080;"><span style="color: #008080;"></span> -</span>$ (call import-<span style="color: #000000;"><span style="color: #000000;">Module,.)</span></span><span style="color: #008080;"><span style="color: #008080;"></span> the</span> <span style="color: #008080;"><span style="color: #008080;"></span> *</span> <span style="color: #000000;"><span style="color: #000000;"># _cocos_lib_import_android_begin</span></span><span style="color: #008080;"><span style="color: #008080;"></span> $</span># _cocos_lib_import_android_end</pre><span style="font-size: 16px;"><span style="font-size: 16px;"><small><small><strong><span data-wiz-span="data-wiz-span">at compile time, the input command is <span style="color: #ff0000;"> <span style="font-size: 14pt;">Cocos run-p android--android-studio</span> </span>. </span></strong></small></small></span></span><small><small><small><span style="font-family: 宋体;"><strong><span data-wiz-span="data-wiz-span"><span style="color: #ff0000;"> </span></span></strong></span></small></small></small><p><p>COCOS2DX android.mk in a universal template</p></p></span>

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.