Using Cocos2d-x C + + Android Static Library

Source: Internet
Author: User

When using Cocos2d-x to do Android development, each clean will need to compile the Coco2d-x library again, very time-consuming.

Here is a way to directly use a static library without compiling the source code each time:

1\ first finds a Cocos2d-x test project (such as Cpp_test) and compiles it once. When finished, all the static library files generated in the intermediate process can be found in the Proj.android/obj/local directory.

Copy these static library files (with the ABI directory) and put them in a new directory (e.g., cclib).

2\ in Cclib to create Android.mk file, the contents of the document is attached to the code 1.

3\ define environment variable Cc_src_root to cocos2d source directory (that is, Cocos and external Upper directory)

Rely on Cclib when compiling your project, no need to rely on ANDROID.MK in the cocos2d directory

Attached CCLIB/ANDROID.MK content:

Local_path: = $ (call My-dir) include $ (clear_vars) Local_module: = cc_staticlocal_module_filename: = LIBCC local_export_c                     _includes: = $ (cc_src_root)/cocos $ (cc_src_root)/cocos/.                     $ (cc_src_root)/cocos/.                     $ (cc_src_root)/cocos/platform $ (cc_src_root)/cocos/base $ (cc_src_root)/external $ (cc_src_root)/EXTERNAL/TINYXML2 $ (cc_src_root)/external/unzip $ (cc_src_root)/external/chipmunk/include/chipmunk $ (cc_src_root)/external/xxhash $ ( Cc_src_root)/external/nslog $ (cc_src_root)/external/poly2tri $ (cc_src_root)/extern     Al/poly2tri/common $ (cc_src_root)/external/poly2tri/sweep $ (cc_src_root)/cocos/platform/android $ (cc_src_root)/cocos/audio/include $ (cc_src_root)/external/curl/include/android $ (cc_src_root)/external/websocke Ts/incluDe/android $ (cc_src_root)/cocos/editor-support $ (cc_src_root)/external/box2d $ (cc_src_root)/external/flatbuffe RS $ (cc_src_root)/external local_cflags: =-duse_file32api-fexceptionslocal_cppflags: =-wno-deprecated-declaratio Ns-wno-extern-c-compatlocal_export_cflags: =-duse_file32api-fexceptionslocal_export_cppflags: =-                        Wno-deprecated-declarations-wno-extern-c-compatlocal_export_ldlibs: =-lglesv2-llog  -landroid-lglesv1_cm-legl-lopensles# define the macro to compile through Support/zip_support/ioapi.clocal_whole_static_libraries: = cocos_freetype2_staticlocal_whole_static_libraries + = Cocos_png_staticlocal_whole_static_libraries + = cocos_jpeg_staticlocal_whole_static_libraries + cocos_tiff_ Staticlocal_whole_static_libraries + = cocos_webp_staticlocal_whole_static_libraries + cocos_chipmunk_staticLOCAL_ Whole_static_libraries + = cocos_zlib_staticlocal_whole_static_libraries + = Cocos_curl_staticlocal_whole_static_libraries + = websockets_staticlocal_whole_static_libraries + Flatbuffers_ Staticlocal_whole_static_libraries + = libaudioengine_staticlocal_whole_static_libraries + libbox2d_staticLOCAL_ Whole_static_libraries + = libcocos2d_staticlocal_whole_static_libraries + Libcocos2dandroid_staticlocal_whole_ Static_libraries + = libcocos2dxinternal_staticlocal_whole_static_libraries + libcocos3d_staticlocal_whole_static_ LIBRARIES + = libcocosbuilder_staticlocal_whole_static_libraries + libcocosdenshion_staticlocal_whole_static_ LIBRARIES + = libcocostudio_staticlocal_whole_static_libraries + libextension_staticlocal_whole_static_libraries + = Libnetwork_staticlocal_whole_static_libraries + = libspine_staticlocal_whole_static_libraries + libui_ Staticinclude $ (build_static_library) include $ (clear_vars) Local_module: = Flatbuffers_staticlocal_src_files: = $ ( Target_arch_abi)/flatbuffers.ainclude $ (prebuilt_static_library) include $ (clear_vars) Local_module: = LibaudioengIne_staticlocal_src_files: = $ (Target_arch_abi)/libaudioengine.ainclude $ (prebuilt_static_library) include $ (CLEAR_ VARS) Local_module: = Libbox2d_staticlocal_src_files: = $ (Target_arch_abi)/libbox2d.ainclude $ (PREBUILT_STATIC_ LIBRARY) include $ (clear_vars) Local_module: = Libcocos2d_staticlocal_src_files: = $ (Target_arch_abi)/ Libcocos2d.ainclude $ (prebuilt_static_library) include $ (clear_vars) Local_module: = Libcocos2dandroid_staticlocal_ Src_files: = $ (Target_arch_abi)/libcocos2dandroid.ainclude $ (prebuilt_static_library) include $ (clear_vars) LOCAL_ MODULE: = libcocos2dxinternal_staticlocal_src_files: = $ (Target_arch_abi)/libcocos2dxinternal.ainclude $ (PREBUILT_ static_library) include $ (clear_vars) Local_module: = Libcocos3d_staticlocal_src_files: = $ (Target_arch_abi)/ Libcocos3d.ainclude $ (prebuilt_static_library) include $ (clear_vars) Local_module: = Libcocosbuilder_staticlocal_src _files: = $ (Target_arch_abi)/libcocosbuilder.ainclude $ (prebuilt_static_library) include $ (clear_vars) LOCAL_MODULE: = Libcocosdenshion_staticlocal_src_files: = $ (Target_arch_abi)/libcocosdenshion.ainclude $ (PREBUILT_STATIC_LIBRARY) Include $ (clear_vars) Local_module: = Libcocostudio_staticlocal_src_files: = $ (Target_arch_abi)/ Libcocostudio.ainclude $ (prebuilt_static_library) include $ (clear_vars) Local_module: = Libcpufeatures_staticlocal_ Src_files: = $ (Target_arch_abi)/libcpufeatures.ainclude $ (prebuilt_static_library) include $ (clear_vars) LOCAL_ MODULE: = libextension_staticlocal_src_files: = $ (Target_arch_abi)/libextension.ainclude $ (prebuilt_static_library) Include $ (clear_vars) Local_module: = Libnetwork_staticlocal_src_files: = $ (Target_arch_abi)/libnetwork.ainclude $ ( prebuilt_static_library) include $ (clear_vars) Local_module: = Libspine_staticlocal_src_files: = $ (TARGET_ARCH_ABI)/ Libspine.ainclude $ (prebuilt_static_library) include $ (clear_vars) Local_module: = Libui_staticlocal_src_files: = $ ( Target_arch_abi)/libui.ainclude $ (prebuilt_static_library) #==================================================== ==========$ (call import-module,freetype2/prebuilt/android) $ (call Import-module,png/prebuilt/android) $ (call Import-module,zlib/prebuilt/android) $ (call Import-module,jpeg/prebuilt/android) $ (Call import-module,tiff/ Prebuilt/android) $ (call Import-module,webp/prebuilt/android) $ (call Import-module,chipmunk/prebuilt/android) $ ( Call Import-module,curl/prebuilt/android) $ (call import-module,websockets/prebuilt/android)

Using Cocos2d-x C + + Android Static Library

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.