之前的配置的是beta版本(http://blog.csdn.net/cabxyz/article/details/21164215),现在的rc版本有些改变,记录一下....
1.为了更方便的安装一些环境,先下载安装一个工具,control+space 在spotlight里输入terminal,拷贝
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
安装brew ,官网地址:
http://brew.sh/index_zh-cn.html
2.brew安装完成
3.安装java、python、ant已安装的跳过该步骤 ,注意python要用3.0以下的版本,否则脚本运行有错
brew install java
brew install python
brew install ant
安装完成后检查一下版本
4.安装Android的环境,sdk可以通过eclipse的adt安装,ndk必须手动下载。具体步骤可以参考官网文档
eclipse下载地址:http://www.eclipse.org/downloads/
sdk下载地址:http://developer.android.com/sdk/index.html
ndk下载地址:http://developer.android.com/tools/sdk/ndk/index.html
下载ndk直接解压即可
7.xcode的下载地址:https://itunes.apple.com/us/app/id497799835?mt=12
6下载cocos2dx3.0 rc0 下载地址:http://www.cocos2d-x.org/download
6.cd 到 cocos2d-x-3.0rc0的根目录 运行 setup.py ,设置root、ndk、sdk、ant等一些目录。如果遇到NOT FOUND,手工复制路径enter即可,注意最后要执行如下命令保存配置
source /Users/anbaochen/.bash_profile
7.用cocos new 命令创建项目
HelloGame :是你的项目名
-p是包名
-l 是语言 cpp或lua(备注:js项目好像是分离出去了)
-d是项目根目录
更详细的帮助,运行
anbaomatombp:~ anbaochen$ cocos new --help
7.用cocos run命令 编译 运行项目,时间有点长,慢慢等待....
-s是项目根目录
-p是运行平台类型,可选类型有 ios 、mac、linux、win32、android
更详细的帮助,运行
anbaomatombp:~ anbaochen$ cocos run --help
8.build完成后直接启动模拟器运行
9. cocos还有一些其他的命令如 deploy
anbaomatombp:~ anbaochen$ cocos deploy --help
usage: cocos deploy [-h] [-s SRC_DIR] [-q] [-p PLATFORM] [-m MODE]
Depoly a project to the target
optional arguments:
-h, --help show this help message and exit
-s SRC_DIR, --src SRC_DIR
project base directory
-q, --quiet less output
-p PLATFORM, --platform PLATFORM
select a platform (android, ios, mac, web, win32,
linux)
-m MODE, --mode MODE Set the deploy mode, should be debug|release, default
is debug.
anbaomatombp:~ anbaochen$
编译像项目,具体的看帮助解释anbaomatombp:~ anbaochen$ cocos compile --help
usage: cocos compile [-h] [-s SRC_DIR] [-q] [-p PLATFORM] [-m MODE] [-j JOBS]
[--ap ANDROID_PLATFORM] [--source-map]
Compiles the current project to binary
optional arguments:
-h, --help show this help message and exit
-s SRC_DIR, --src SRC_DIR
project base directory
-q, --quiet less output
-p PLATFORM, --platform PLATFORM
select a platform (android, ios, mac, web, win32,
linux)
-m MODE, --mode MODE Set the compile mode, should be debug|release, default
is debug.
-j JOBS, --jobs JOBS Allow N jobs at once.
Android Options:
--ap ANDROID_PLATFORM
parameter for android-update.Without the parameter,the
script just build dynamic library for project. Valid
android-platform are:[10|11|12|13|14|15|16|17|18|19]
Web Options:
--source-map Enable source-map
anbaomatombp:~ anbaochen$