当前位置: 首页 > 工具软件 > dlua > 使用案例 >

如何减小cocos2d-x编译出的libcocos2dlua.so 体积

祁俊拔
2023-12-01

cocos2d-x\cocos\base\ccConfig.h

设置开关 0是不需要 1是需要

#ifndef CC_USE_TIFF
#define CC_USE_TIFF  0 //modify ycc
#endif // CC_USE_TIFF


/** Support webp or not. If your application don't use webp format picture, you can undefine this macro to save package size.
 */
#ifndef CC_USE_WEBP
#if (CC_TARGET_PLATFORM != CC_PLATFORM_WINRT)
#define CC_USE_WEBP  0
#endif
#endif // CC_USE_WEBP


/** Use physics integration API. */

#ifndef CC_USE_PHYSICS
#define CC_USE_PHYSICS 0
#endif


/** Use 3d physics integration API. */
#ifndef CC_USE_3D_PHYSICS
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC || CC_TARGET_PLATFORM == CC_PLATFORM_WIN32 || CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_LINUX || CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
#define CC_USE_3D_PHYSICS 0
#endif
#endif


#if (CC_USE_3D_PHYSICS)
/** Use bullet physics engine. */
#ifndef CC_ENABLE_BULLET_INTEGRATION
#define CC_ENABLE_BULLET_INTEGRATION 0
#endif
#endif


/** Use 3D navigation API */
#ifndef CC_USE_NAVMESH
#define CC_USE_NAVMESH 0

#endif


2.在cocos2d-x\cocos\scripting\lua-bindings\proj.android

#3d
#LOCAL_SRC_FILES += ../manual/3d/lua_cocos2dx_3d_manual.cpp \
#                   ../auto/lua_cocos2dx_3d_auto.cpp


#cocosbuilder
#LOCAL_SRC_FILES += ../manual/cocosbuilder/lua_cocos2dx_cocosbuilder_manual.cpp \
#                  ../manual/cocosbuilder/CCBProxy.cpp \
#                   ../auto/lua_cocos2dx_cocosbuilder_auto.cpp


#spine
#LOCAL_SRC_FILES += ../manual/spine/lua_cocos2dx_spine_manual.cpp \
 #                  ../manual/spine/LuaSkeletonAnimation.cpp \
  #                 ../auto/lua_cocos2dx_spine_auto.cpp


#physics3d
#LOCAL_SRC_FILES += ../manual/physics3d/lua_cocos2dx_physics3d_manual.cpp \
#                   ../auto/lua_cocos2dx_physics3d_auto.cpp \


D:\sample\LuaTest\frameworks\cocos2d-x\cocos\scripting\lua-bindings\auto\lua_cocos2dx_auto.cpp

注释掉

/*int lua_cocos2dx_Node_setPhysicsBody(lua_State* tolua_S)

/*int lua_cocos2dx_Node_getPhysicsBody(lua_State* tolua_S)

/*int lua_cocos2dx_Scene_initWithPhysics(lua_State* tolua_S)

/*int lua_cocos2dx_Scene_stepPhysicsAndNavigation(lua_State* tolua_S)

/*int lua_cocos2dx_Scene_getPhysicsWorld(lua_State* tolua_S)

/*int lua_cocos2dx_Scene_createWithSize(lua_State* tolua_S)

/*int lua_cocos2dx_Scene_createWithPhysics(lua_State* tolua_S


--最后

int lua_module_register(lua_State* L)
{
    //Dont' change the module register order unless you know what your are doing
    register_cocosdenshion_module(L);
    register_network_module(L);
    //register_cocosbuilder_module(L);
    register_cocostudio_module(L);
    register_ui_moudle(L);
    register_extension_module(L);
    //register_spine_module(L);
    //register_cocos3d_module(L);
    register_audioengine_module(L);
#if CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION
    register_physics3d_module(L);
#endif
#if CC_USE_NAVMESH
    register_navmesh_module(L);
#endif
    return 1;
}

 类似资料: