What is the proper way to set up a jsbindings class with cocos2d-js?

The documentation explains how to generates jsbindings, but it does not tell the proper way to integrate it into a project.

  • What steps do I must follow?
  • Where should I store my manually written C++ files?
  • Where should I store the generated js and c++ files?
  • What CMakeList.txt files should I edit?

Thank you for your help.

I believe I found some way to do this.
Please confirm me I don’t do anything wrong.

For instance to integrate the js-bindings test samples in a cocos2d-js project.

  • First generate the tests : cd tools/bindings-generator/test && ./test.sh && cd ../../.. (that may need some configuration)
  • Copy files into the project
    cp -R tools/bindings-generator/test/simple_test/ frameworks/runtime-src/Classes
    cp -R tools/bindings-generator/test/simple_test_bindings/ frameworks/runtime-src/Classes
  • Update CMakeLists.txt and frameworks/runtime-src/proj.android/jni/Android.mk and add the added files autogentestbindings.cpp and simple_class.cpp to the target lists.
  • Register the jsb functions in the runtime sources in frameworks/runtime-src/Classes/AppDelegate.cpp by adding sc->addRegisterCallback(register_all_autogentestbindings); in AppDelegate::applicationDidFinishLaunching