Coco2d-x linux编译

来源:互联网 发布:c语言实战演练 编辑:程序博客网 时间:2024/05/20 19:28

Linux Environment Setup

Linux development can be done either with Eclipse (and its managed make system) or with regular Makefiles. This pages describes the Makefile approach.

The Linux build of cocos2dx is mostly used unser Debian/Ubuntu-based systems. Use on other distributions will probably work fine but YMMV.

To build cocos2dx you need the following packages intalled:

 g++ libx11-dev libxmu-dev libglu1-mesa-dev libgl2ps-dev libxi-dev  libglfw-dev libzip-dev libcurl4-gnutls-dev libfontconfig1-dev libsqlite3-dev libglew*-dev

The top level script "make-all-linux-project.sh" will check for these and attempt to install them for you.

Building

make-all-linux-project.sh will then do a clean build of all projects in both Debug and Release configuration. To build just one configurations you can just use 'make'. e.g.:

$ make -j5 DEBUG=1

This will build all cocos2dx libraries and examples in debug mode. Libraries are build into the 'lib/linux/Debug' folder.

If you just want to build a single library or a single example just run 'make' from the proj.linux folder for that library or example. e.g:

$ cd samples/Cpp/TestCpp/proj.linux && make -j5 DEBUG=1

Remember to add the -j argument when you run make to dramatically speed up your build time.

Running

The makefiles provided include a 'run' target which can be used to run the build executable. e.g.:

$ cd samples/Cpp/TestCpp/proj.linux && make -j5 DEBUG=1 run

Creating a new project

One simple way to create a new project is to copy the 'samples/Cpp/HelloCpp/proj.linux' folder into your project. Once here you will need to edit parts of the Makefile accordingly (at the very least the SOURCES). If you are building outside the cocos2dx tree then you will need to set $COCOS2DX_ROOT either within your Makefile or in your environment.

原创粉丝点击