Mike
Mike

Reputation: 55

How To build cocos2dx using emscripten

I have faced with problem when I try to build simple project from source using emscripten. Let me describe my acts step by step:

  1. I am using ubuntu 14.04 LTS
  2. install emscripten (I have followed instructions)
  3. install cocos2dx (I have followed instructions on the github)
  4. I have created new project ( I have followed instructions on github too), build it for linux and run, it work good.
  5. Next step I have tried to build for web using emscripten in directory of project i have entered in console:

    cmake -DCMAKE_CXX_COMPILER=em++ -DCMAKE_CC_COMPILER=emcc

    make

Firstly, I have got error with CC_DLL in tinyxml2.h, I removed CC_DLL, And rerun. Then I have got error on unknown include in directory "unzip" ( I have copied zlib.h and zconf.h to directory) and rerun. Then I have got error with GLubyte -use of undeclared identifier, I have added:

#include <SDL/SDL.h>
#include <GL/gl.h>
#include <GL/glu.h>

and rerun And Then I have got error use of undeclared identifier 'glDeleteBuffers'; in directory /cocos /2d/CCCameraBackgroundBrush.cpp and many same errors, and I do not know what to do...

Could You help me please how to fix it?

Thank you for any help!

Upvotes: 0

Views: 1020

Answers (1)

caiiiycuk
caiiiycuk

Reputation: 1596

You can try to use emscripten-port of cocos2d. Just add -s USE_COCOS2D=3 to your build.

I maintain this port, and I already ported with it couple of cocos2dx games.

Now this port is merged only to incoming branch. Also, you can run cocos2d hello world project with this command:

python tests/runner.py browser.test_cocos2d_hello

Upvotes: 2

Related Questions