I have been working on building a cocos2dx application that runs on Windows 7 x64 in Visual Studio, Eclipse, iPhone and MacOS X.
I started with this setup guide:
I had to do a lot of installing ....
- Cocos2d-2.0x (same download for Mac OS X and Win32)
- NDK r8d on Mac OS X and Windows (different downloads for Mac OS X and Win32)
- Newest ADT and Android SDK on Mac OS X and Windows (different downloads)
- Native Development Tools -- Eclipse Plugin
- Android Development Tools -- Eclipse Plugin
- Cygwin on Windows (with : autoconf, automake, binutils, gcc-core, gcc-g++, gcc4-core, gcc4-g++, gdb, pcre, pcre-devel, gawk, make)
- Visual Studio 2010 C++ Language Support
- Eclipse CDT (C++ Development Tools)
- Several Eclipse, Java, Windows and Mac OS X Updates along the way
In the end, I believe that the correct way to configure the application is to have a folder for the project and sub-folders as follows:
- \cocos2d-2.0-x-2.0.4\TileMapGame\Classes
- \cocos2d-2.0-x-2.0.4\TileMapGame\Resources
- \cocos2d-2.0-x-2.0.4\TileMapGame\proj.android
- \cocos2d-2.0-x-2.0.4\TileMapGame\proj.win32
You can get this far using two included .sh scripts
- \cocos2d-2.0-x-2.0.4\create-android-project.bat
- \cocos2d-2.0-x-2.0.4\create-android-project.sh
You will quickly notice that Cocos2d-2.0-x does not come with an easy facility to create an XCode project folder the way it does for Visual Studio and Eclipse.
To create the following folders I used Notepad2 and editing the .xcodeproj files
- \cocos2d-2.0-x-2.0.4\TileMapGame\proj.ios
- \cocos2d-2.0-x-2.0.4\TileMapGame\proj.mac
I started by copying over these folders
- \cocos2d-2.0-x-2.0.4\samples\HelloCpp\proj.ios
- \cocos2d-2.0-x-2.0.4\samples\HelloCpp\proj.mac
Then I made some important changes
- Changed relative paths to 'cocos2dx.xcodeproj'
- Renamed Project
- Reconnected plist file
- Fixed "Header Search Paths" to include correct relative paths
- Converted "Resource" sub-folders to 'groups' by deleting and re-adding
- Added CocosDenshion group and added 'ios' and 'include' folders
- Added missing frameworks
- AudioToolkit
- OpenAL
- AVFoundation
- Set 'version' and deployment targets for iOS and Mac OS X
So at the end I have this structure
- \cocos2d-2.0-x-2.0.4\TileMapGame\Classes
- \cocos2d-2.0-x-2.0.4\TileMapGame\Resources
- \cocos2d-2.0-x-2.0.4\TileMapGame\proj.android
- \cocos2d-2.0-x-2.0.4\TileMapGame\proj.win32
- \cocos2d-2.0-x-2.0.4\TileMapGame\proj.ios
- \cocos2d-2.0-x-2.0.4\TileMapGame\proj.mac
The only two I have not created are 'proj.linux' and 'proj.blackberry' because at this time I do not have any need for them.
I used the following pages for debugging and troubleshooting:
I used the following pages for debugging and troubleshooting:
- Found out you cannot move Visual Studio 2010 Sln file
- Found out you need to add Frameworks for CocosDenshion
- Everyone needs the manual, even if it is way out of date
- How do you add a pesky sub-project (tip: only have it open in one place)
- XCode will not find cocos2d.h if you move the .xcodeproj but don't update header search path
- Never set $SRCROOT yourself
- Some useful hints, but not know I did it
- Dealing with file not found when attempting to debug in XCode (happens a lot)
- http://stackoverflow.com/questions/9987192/xcode-will-run-app-on-simulator-but-not-on-device
- http://dhilipsiva.blogspot.de/2012/07/xcode-could-not-launch-app-no-such-file.html
- Much of the approach above came from reading this
- Under Helios ... to remove plugins ... Help -> Install New Software ... clicked the small blue hyperlink for What is "already installed"; and under the Installed Software tab, this gave me the option to uninstall things.
- Had to install the NDK on both Mac OS X and Windows
- How to build and run
2 comments:
Wow, nice post! And both the links in the section "Dealing with file not found when attempting to debug in XCode (happens a lot)" refers me :)
Your blog has been very helpful. Thanks for the assistance.
Post a Comment