编译环境
python2.7(mac自带)
1.安装PyYAML
mac: sudo easy_install pyyaml
win: pip install pyyaml
2.安装Cheetah
下载:http://pythonhosted.org/Cheetah/
进入目录执行
sudo python setup.py install
3.下载NDK,r16b,解压后添加环境变量
vi ~/.bash_profile
export NDK_ROOT=/Users/anger/Downloads/dev/android-ndk-r16b
PATH=$PATH:$NDK_ROOT
或者直接终端执行
export NDK_ROOT=/Users/anger/Downloads/dev/android-ndk-r16b
4./Applications/CocosCreator.app/Resources/是安装目录
在/cocos2d-x/创建custom目录,并创建文件:
// jsbTest.h
#ifndef __JSB_TEST_H__
#define __JSB_TEST_H__
#include "cocos2d.h”
class jsbTest {
public: static void testlog();
};
#endif
// jsbTest.cpp
#include "jsbTest.h”