首页 > 代码库 > Mac下配置Cocos2d-x3.1环境
Mac下配置Cocos2d-x3.1环境
一、前期准备
1、ADT:百度下就OK
2、NDK:百度下就OK
3、ANT:
http://124.254.47.39/download/55152992/78533365/4/zip/57/132/1388364864569_644/apache-ant-1.9.3-bin.zip 我用的是这个
二、配置环境变量
打开终端,执行:vim ~/.bash_profile
# Add environment variableCOCOS_CONSOLE_ROOT for cocos2d-x
#exportCOCOS_CONSOLE_ROOT=/Users/chen/Desktop/cocos2d-x-3.0/tools/cocos2d-console/bin
#export PATH=$COCOS_CONSOLE_ROOT:$PATH
# Add environment variable NDK_ROOT forcocos2d-x
#export NDK_ROOT=/Users/chen/work_space/Cocos/android-ndk-r9b
#export PATH=$NDK_ROOT:$PATH
export NDK_ROOT=/Users/chen/work_space/Cocos/android-ndk-r9b
export ANDROID_SDK_ROOT=/Users/chen/work_space/Cocos/adt-bundle-mac-x86_64-20130917/sdk
export ANT_ROOT=/Users/chen/work_space/Cocos/apache-ant-1.9.3/bin
export PATH=$ANT_ROOT/bin:$PATH
# Add environment variableCOCOS_CONSOLE_ROOT for cocos2d-x
export COCOS_CONSOLE_ROOT=/Users/chen/Desktop/cocos2d-x-3.1/tools/cocos2d-console/bin
export PATH=$COCOS_CONSOLE_ROOT:$PATH
export PATH=${PATH}:/Users/chen/work_space/Cocos/adt-bundle-mac-x86_64-20130917/sdk/platform-tools
//注:最后一项是设置手机与Mac链接的
红色是需要修改的路径
然后退出viw,执行source ~/.bash_profile保存.bash_profile
三、
然后执行cocos的setup.py,看看环境变量对不对。即可创建新项目了
1、cd /Users/chen/Desktop/cocos2d-x-3.1/tools/cocos2d-console
2、cocos new test -p com.pactera.test -l cpp -d /Users/chen/work_space/projec