1. Installation dependencies
Dependencies include:
libx11-devlibxmu-devlibglu1-mesa-devlibgl2ps-devlibxi-devg++ Libzip-devlibpng12-devlibcurl4-gnutls-devlibfontconfig1-devlibsqlite3-devlibglew*-devlibssl-dev
If your system is Ubuntu/debian, you can install the dependency by executing the install-deps-linux.sh script under the build directory, or you can install it yourself
$ cd cocos2d-x-3.1.1$ CD build$./install-deps-linux.sh
2. After the dependency installation is complete, go to the build directory and execute the cmake command to generate the makefile file
$ cd build$ mkdir linux-build$ CD linux-build$ cmake. /..
3.cmake after successful completion, a lot of files will be generated in the Build/linux-build directory
Perform make compilation
Make
If the compilation is correct, the project will be generated under the build/linux-build/bin/cpp-tests/directory
4. Run cpp-tests to verify that the compilation was successful
$ cd bin/cpp-tests/$./cpp-tests
5. Create a project
Enter the Tools/cocos2d-console/bin path
$ python install.py
The path to the console installation is displayed in the installation, for example
Cocos New project name-L language-p package name-D path
For example
Cocos New Game1-p com.games.demo-l cpp-d/home/liyuhen/projects
6. Switch to the project path, compile and execute
Cocos Run-p Linux