标签:
操作系统:Windows7(64-bit)
VS版本号:2013
Cocos2d-x版本号:3.0
project路径:E:\cocos2d-prj\
1.从github下载libpomelo代码
E:\cocos2d-prj\cocos2d\external> git clone https://github.com/NetEase/libpomelo.git
2.创建libpomelo的VSproject
E:\cocos2d-prj\cocos2d\external>cd libpomelo E:\cocos2d-prj\cocos2d\external\libpomelo>mkdir build E:\cocos2d-prj\cocos2d\external\libpomelo>git clone https://github.com/martine/gyp.git build/gyp E:\cocos2d-prj\cocos2d\external\libpomelo>build\gyp\gyp.bat --depth=. pomelo.gyp -Dlibrary=static_library -DTO=pc
假设遇到报错(一个VS版本号问题)
改动E:\snake\code\client\libpomelo\build\gyp\pylib\gyp\MSVSVersion.py文件第188行
return versions[str(name)]
改为
return versions[“2010”]
E:\cocos2d-prj\cocos2d\external\libpomelo>build\gyp\gyp.bat --depth=. pomelo.gyp -Dlibrary=static_library -DTO=pc
3.创建libuv的VSproject(运行E:\cocos2d-prj\libpomelo\deps\uv\vcbuild.bat脚本就可以)
E:\cocos2d-prj\cocos2d\external>cd libpomelo\deps\uv E:\cocos2d-prj\cocos2d\external\libpomelo\deps\uv>vcbuild.bat
4.打开cocos2dproject。将下列vs项目增加project(add existing project)
E:\cocos2d-prj\cocos2d\external\libpomelo\libpomelo.vcxproj E:\cocos2d-prj\cocos2d\external\libpomelo\deps\jansson\jansson.vcxproj E:\cocos2d-prj\cocos2d\external\libpomelo\deps\uv\libuv.vcxproj5.改动project版本号
vs中右键上述project。选择菜单 Upgrade VC++ Compiler and Libraries
6.加入project依赖
在cocos2d-prjproject上邮件,选择 属性 菜单项,将上述三个project加入为依赖,例如以下图
7.加入Include
8.加入系统lib引用Psapi.lib;Iphlpapi.lib;。例如以下图
操作系统:Windows7(64-bit)
NDK版本号:r9d (64-bit)
Cocos2d-x版本号:3.0
project路径:E:\cocos2d-prj\
Android平台相对简单,仅仅要改动E:\cocos2d-prj\proj.android\jni\Android.mk文件就能够了。总共三处例如以下图
操作系统:MAC MINI
XCODE版本号:3.1.1
iphonesimulator : 6.1
Cocos2d-x版本号:3.0
Python : 2.7
gyp工具
cd pomelo gyp --depth=. pomelo.gyp -Dlibrary=static_library -DTO=ios cd deps/uv gyp --depth=. uv.gyp -Dlibrary=static_library -DTO=ios cd ../jansson gyp --depth=. jansson.gyp -Dlibrary=static_library -DTO=ios
cd pomelo xcodebuild -project deps/jansson/jansson.xcodeproj xcodebuild -project deps/uv/uv.xcodeproj xcodebuild -project pomelo.xcodeproj xcodebuild -project deps/jansson/jansson.xcodeproj -sdk iphonesimulator6.1 -arch i386 xcodebuild -project deps/uv/uv.xcodeproj -sdk iphonesimulator6.1 -arch i386 xcodebuild -project pomelo.xcodeproj -sdk iphonesimulator6.1 -arch i386
cd pomelo lipo -create ./build/Default-iphoneos/libpomelo.a ./build/Default-iphonesimulator/libpomelo.a -output libpomelo.a lipo -create ./deps/jansson/build/Default-iphoneos/libjansson.a ./deps/jansson/build/Default-iphonesimulator/libjansson.a -output libjansson.a lipo -create ./deps/uv/build/Default-iphoneos/libuv.a ./deps/uv/build/Default-iphonesimulator/libuv.a -output libuv.a
在"Build Settings" 的 “Header Search Paths” 里增加三个文件夹:
libpomelo/include
libpomelo/deps/jansson/src
libpomelo/deps/uv/include
注意文件夹的绝对和相对位置
这样就能够同一时候在真机和模拟器里调用libpomelo静态库了。
版权声明:本文博客原创文章,博客,未经同意,不得转载。
教你pomeloclient包libpomelo增加cocos2d-x 3.0工程(Windows、Android、IOS平台)
标签:
原文地址:http://www.cnblogs.com/hrhguanli/p/4624994.html