//怎样使用 bindings-generator How to Use bindings-generator ================== //windows 环境下 On Windows: ------------ //安装android-ndk-r9b * Make sure that you have installed `android-ndk-r9b`. //下载 python2.7.3 * Download python2.7.3 (32bit) from (http://www.python.org/ftp/python/2.7.3/python-2.7.3.msi). //把python安装路径配置到path(windows 环境变量配置) * Add the installed path of python (e.g. C:\Python27) to windows environment variable named 'PATH'. //下载pyyaml并且安装 * Download pyyaml from http://pyyaml.org/download/pyyaml/PyYAML-3.10.win32-py2.7.exe and install it. //下载 pyCheetah 并且解压到安装python路径的Lib文件夹下的site-packages文件夹下 * Download pyCheetah from https://raw.github.com/dumganhar/my_old_cocos2d-x_backup/download/downloads/Cheetah.zip,unzip it to "C:\Python27\Lib\site-packages" 设置ndk——root合法的环境变量 * Set environment variables (`NDK_ROOT`) * Go to "cocos2d-x/tools/tolua" folder,and run "genbindings.py". The generated codes will be under "cocos\scripting\auto-generated\js-bindings". //mac环境下 On MAC: ---------- //,mac 10.9的系统版本已经默认安装好了python2.7,如果你的mac 没有安装好则使用pip工具安装 * The OSX 10.9 has a built-in python2.7 and if your os don't have python2.7 then use [Homebrew](http://brew.sh/) to install the python and use pip install the python dependencies. <pre> <span style="white-space:pre"> </span>brew install python </pre> //安装python需要用到的库 通过一下命令 * Install python dependices by pip. <pre> <span style="white-space:pre"> </span>//在命令行输入以下命令进行安装 sudo easy_install pip sudo pip install PyYAML <span style="white-space:pre"> </span>sudo pip install Cheetah </pre> //下载 64bit ndk-r9b-x86_64 64位 ndk r9b, * Download [64bit ndk-r9b-x86_64](http://dl.google.com/android/ndk/android-ndk-r9b-darwin-x86_64.tar.bz2) from [google](http://developer.android.com/tools/sdk/ndk/index.html) * Run //配置路径 <pre> <span style="white-space:pre"> </span>export NDK_ROOT=/path/to/android-ndk-r9b ./genbindings.py </pre> //在 linux 12.04 64 位版本 On Ubuntu Linux 12.04 64bit ------------ //通过命令行安装pythson * Install python <pre> <span style="white-space:pre"> </span>sudo apt-get install python2.7 </pre> * Install python dependices by pip. <pre> <span style="white-space:pre"> </span>sudo apt-get install python-pip <span style="white-space:pre"> </span>sudo pip install PyYAML <span style="white-space:pre"> </span>sudo pip install Cheetah </pre> //下载 64bit ndk-r9b-x86_64 64位 ndk r9b,以下同mac 操作系统 * Download [64bit ndk-r9b-x86_64]( https://dl.google.com/android/ndk/android-ndk-r9b-linux-x86_64.tar.bz2) from [google](http://developer.android.com/tools/sdk/ndk/index.html) * Go to "cocos2d-x/tools/tolua",Run <pre> <span style="white-space:pre"> </span>export NDK_ROOT=/path/to/android-ndk-r9b ./genbindings.py </pre>