Cocos2d-x about Android. mk automatically read CPP, cocos2dandroid. mk

Source: Internet
Author: User
Tags android games

Cocos2d-x about Android. mk automatically read CPP, cocos2dandroid. mk

* *********************************** Please specify the source: bytes ********************************************


I know the development of cocos2d-x games,

When everything is done,

The last step is to generate the APK,

In the past, we used NDK and so on, which is very complicated to do,

After 3.0, you can directly create it in the command line cocos compile.

It is much simpler.

However, there is still something to do manually,

For example, fill in the. cpp file in the Android. mk file,

In this file, we need to add all the. cpp files used in our program.

If there are few files, you can also, but there are more files, it is very painful.


This can be solved in just three lines!

This is simple:

LOCAL_PATH := $(call my-dir)include $(CLEAR_VARS)LOCAL_MODULE := cocos2dcpp_sharedLOCAL_MODULE_FILENAME := libcocos2dcppFILE_LIST := hellocpp/main.cpp FILE_LIST += $(wildcard $(LOCAL_PATH)/../../Classes/*.cpp)LOCAL_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_staticinclude $(BUILD_SHARED_LIBRARY)$(call import-module,2d)$(call import-module,audio/android)$(call import-module,Box2D)

That's right. There are three rows in the middle:

FILE_LIST := hellocpp/main.cpp FILE_LIST += $(wildcard $(LOCAL_PATH)/../../Classes/*.cpp)LOCAL_SRC_FILES := $(FILE_LIST:$(LOCAL_PATH)/%=%)

Well, in the future, mom will no longer have to worry about making cocos games!




* *********************************** Please specify the source: bytes ********************************************


Problems with COCOS2DX packaging android

What is cygwin compiled by you?

Now developing android games with cocos2d-x22, ask how to breakpoint debug to cpp file c ++ code

I am debugging in the win32 project. After debugging, I can go to android for testing. Debugging c ++ directly in android has not been tried yet.
 

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.