The document will show you how to compile & run cpp-tests
on Linux.
In the document, the variable cocos2dx_root
means the root path of cocos2d-x.
The document is suitable for version v3.0rc or newer.
-
Install Dependences
The depended libraries are:
libx11-dev libxmu-dev libglu1-mesa-dev libgl2ps-dev libxi-dev g++ libzip-dev libpng12-dev libcurl4-gnutls-dev libfontconfig1-dev libsqlite3-dev libglew*-dev libssl-dev
If you are using Ubuntu/Debian, there is a shell script (build/install-deps-linux.sh) for you to install the dependences easily. Run commands below in terminal:
$ cd $cocos2dx_root/build $ ./install-deps-linux.sh
Otherwise, you should install the dependencies by yourself.
-
Generate makefile
After the depended libs are installed, run
cmake
to generatemakefile
:$ mkdir linux-build $ cd linux-build $ cmake ../..
When
cmake
returns correctly, many files & folders will be generated incoocs2dx_root/build/linux-build
: -
Compiling
Run
make
to compile$ make
Application will be generated in
cocos2dx_root/build/linux-build/bin/cpp-tests/
if compile correctly. -
Run cpp-tests
$ cd bin/cpp-tests/ $ ./cpp-tests