Environment
Xcode 7.3Cocos2d-x 3.10
1. Create new project
Open terminal.app, then excute command like this below.$ cocos new TestingProject -p com.Testing.TestingProject -l cpp
2. Open project for cocos2d library
Open the project folder you made, and also you will find sub folder named "cocos2d". Into the folder, there is "build", then open cocos2d_libs.xcodeproj in the folder.TestingProject/cocos2d/build/cocos2d_libs.xcodeproj
3. Change Preferences in Xcode
Open Xcode -> Preferences... in top menu.Choose Locations tab, and change Derived Data from Default to Relative.
4. Change one of Build Settings
TARGETS -> Build Settings -> Architectures -> Build Active Architecture Only -> DebugChange this value to No.
5. Build for devices
Set the scheme libcocos2d iOS > Generic iOS Device. Build it and wait several minutes until done.6. Build for simulators
Set the scheme libcocos2d iOS > any simulator. Build it and wait.7. Confirm these files you made
You can find DerivedData folder at the same location as cocos2d_libs.xcodeproj.Check existing these 2 files below.
DerivedData/cocos2d_libs/Build/Products/Debug-iphoneos/libcocos2d iOS.a DerivedData/cocos2d_libs/Build/Products/Debug-iphonesimulator/libcocos2d iOS.a
8. Open terminal and change directory
Input command to move Products in DerivedData. Such as,$ cd /Users/username/TestingProject/cocos2d/build/DerivedData/cocos2d_libs/Build/Products
9. Merge these files
Execute create command like this.lipo -create -output "libcocos2d-x 3.10 iOS.a" "Debug-iphoneos/libcocos2d iOS.a" "Debug-iphonesimulator/libcocos2d iOS.a"* You can change "libcocos2d-x 3.10 iOS.a", it's conclusive library name.
10. Move new library
Put new library to out of DerivedData folder. It does not need actually but it will be better to move common place.11. Return the settings
It's the same as section 3. Just return the setting to Default.12. Delete cocos2d project into the base project
Open the project you made first, and then Delete cocos2d sub-project.13. Add your new library to the project
Add libcocos2d-x 3.10 iOS.a to the project.14. Set the library path
Add the path where libcocos2d-x 3.10 iOS.a is to the below.TARGETS -> Build Settings -> Search Paths -> Library Search Paths