标签:
打开用户文件夹下.bash_profile文件,配置环境
vim ~/.bash_profile //按键i,进行插入编辑(假设输错d进行删除一行)
环境配置过程例如以下:
1、首先配置下android sdk,我的是在opt文件夹下
#sdk export ANDROID_SDK_ROOT=/opt/android-sdk-macosx export PATH=$PATH:$ANDROID_SDK_ROOT export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools
2、ndk
#ndk export NDK_ROOT=/opt/android-ndk-r9b export PATH=$PATH:$NDK_ROOT
3、ant
#ant export ANT_ROOT=/opt/apache-ant-1.9.3/bin export PATH=$PATH:$ANT_ROOT
等一切都配置好之后,我们如今就应该到终端下cocos2d-x3.0的文件夹下运行下面命令:
./setup.py
运行过之后终端会显示下面内容
???mcbookpro:cocos2d-x-3.0$ ./setup.py Setting up cocos2d-x... ->Check environment variable COCOS_CONSOLE_ROOT ->Find environment variable COCOS_CONSOLE_ROOT... ->COCOS_CONSOLE_ROOT is found : /Project/cocos2d-x-3.0/tools/cocos2d-console/bin ->Configuration for Android platform only, you can also skip and manually edit "/Users/你的username/.bash_profile" ->Check environment variable NDK_ROOT ->Find environment variable NDK_ROOT... ->NDK_ROOT is found : /opt/android-ndk-r9b ->Check environment variable ANDROID_SDK_ROOT ->Find environment variable ANDROID_SDK_ROOT... ->ANDROID_SDK_ROOT is found : /opt/android-sdk-macosx ->Check environment variable ANT_ROOT ->Find environment variable ANT_ROOT... ->ANT_ROOT is found : /opt/apache-ant-1.9.3/bin Please execute command: "source /Users/你的username/.bash_profile" to make added system variables take effect
假设出现以上内容我们的配置就成功了,你到你的 /Users/你的username/.bash_profile文件里看一下,会默觉得我们加入下面两行代码
# Add environment variable COCOS_CONSOLE_ROOT for cocos2d-x export COCOS_CONSOLE_ROOT=/Project/cocos2d-x-3.0/tools/cocos2d-console/bin export PATH=$COCOS_CONSOLE_ROOT:$PATH
这时候你再重新启动或运行下面代码:
source /Users/你的username/.bash_profile
运行完毕后没有不论什么提示。没关系,linux下没有消息,就是好消息。
完毕以上之后,你在终端下敲以cocos new 命令,你会惊奇的发现
mcbookpro:cocos2d-x-3.0$ cocos new Runing command: new usage: cocos new [-h] [-p PACKAGE_NAME] -l {cpp,lua,js} [-d DIRECTORY] [-t TEMPLATE_NAME] [--no-native] [PROJECT_NAME] cocos new: error: argument -l/--language is required你能够敲下面命令创建自己的project:
cocos new WXYCocosTemplate -p com.game.study -l cpp -d /Users/more2010wei/Documents/more2010wei/cocos2dproj/
WXYCocosTemplate//project名 -p 后跟你的包名 -l cpp 这是一个cppproject -d 后跟的是你要建的project路径
命令运行完之后终端下出现:
Runing command: new > Copy template into /Users/more2010wei/Documents/more2010wei/cocos2dproj/WXYCocosTemplate > Copying cocos2d-x files... > Rename project name from 'HelloCpp' to 'WXYCocosTemplate1' > Replace the project name from 'HelloCpp' to 'WXYCocosTemplate1' > Replace the project package name from 'org.cocos2dx.hellocpp' to 'com.game.study'
配置到如今就完毕了。開始享受游戏开发的乐趣吧。
cocos2d-x 3.x游戏开发学习笔记(1)--mac下配置cocos2d-x 3.x开发环境
标签:
原文地址:http://www.cnblogs.com/gcczhongduan/p/5136274.html