2013年9月22日星期日

Adding Cocos2d (2.0) to existing iPhone Project

添加 cocos2d 2.0 到现有的工程

http://www.ggkf.com/xcode/adding-cocos2d-2-0-to-existing-iphone-project

http://www.cocos2d-iphone.org/forums/topic/adding-cocos2d-2-0-to-existing-iphone-project/


步骤:

Step 1.
Create a test project in Cocos2d and find the “libs” folder in finder, and then just copy it into your project’s folder in finder. Then from finder, drag-and-drop the “libs” folder into Xcode’s “Project Navigator” sidebar and check the “add files to destination”.
Step 2.
In Project > Targets > Build Phases > Link Binaries with libraries > Hit the + and Check if following frameworks are there if not add them:

  1. AVFoundation.framework

  2. GameKit.framework

  3. CoreText.framework

  4. AudioToolbox.framework
  5. OpenAL.framework

  6. QuartzCore.framework

  7. CoreGraphics.framework

  8. UIKit.framework

  9. Foundation.framework
  10. OpenGLES.framework
Step 3.
In Project > Targets > Build Settings > Search Paths > Header Search Paths
Add (quotes included) this
“(your Project’s folder name in finder)/libs/kazmath/include”
Step 4.
In Project > Targets > Build Phases > Link Binaries with libraries > Compile Sources
Select all files except classes that are your project already and hit enter and add the Compiler Flag -fno-objc-arc.
By doing that, hopefully all the Cocos2D files are now ARC-disabled.
Try to Build at this moment….
If there are issues then continue
Step 5.
Go to Project > Targets > Build Settings > Linking > “Other linker flags”
Add -lz and -ObjC .
Build again to check any issue still exists…
Step 6.
Go to Project > Targets > Build Settings >Search Paths > User Header Search Paths
Add this
./(your Project’s folder name in finder)/libs/kazmath/include
Now try to build.. The issues might have gone by now.
I got help from the Coco2d forum and would like to thank the forum members..

没有评论:

发表评论