Wednesday, June 6, 2012

Compile Irrlicht for iPhone(iOS) in XCode 4.2

  1. Run Finder, open Applications/Utilities folder under FAVORITES, or run Launchpad on Dock and open Utilities folder on the first page. Run Terminal in either of them.
    By using 'cd' command, go to the location where you want to put the Irrlicht source files.
    Create a folder called Irrlicht_ogles by typing in and running "mkdir Irrlicht_ogles", which Irrlicht Engine source files will be downloaded into.
    Go into the folder by typing in and running "cd Irrlicht_ogles"

  2. Download the source files by running the next command at the Terminal prompt. Make sure that you put a space and a dot at the end. I got the URL address from here.
    $ svn co -r 4073 http://irrlicht.svn.sourceforge.net/svnroot/irrlicht/branches/ogl-es .

  3. Find the file source/Irrlicht/MacOSX/MacOSX.xcodeproj in the folder. Double-click it to run XCode 4.2 or open it in XCode 4.2

  4. Click Active Scheme button in the topleft corner, which is in the red rectangle in the next picture.
    The scheme popup menu appears. Choose libIrrlicht.a as in the next picture.

  5. Click MacOSX at the top of the left column. To the right, choose MacOSX under PROJECT in the next column. In the table to the right, find Base SDK under Architectures and click the input cell to the right of it. When a popup menu appears, choose Latest iOS as in the next picture. 
    At Architectures entry right above Base SDK, click the input cell to the right of it. Choose Standard in the popup menu as in the next picture.

  6. In the second column from the right, choose libIrricht.a (in the red rectangle) right under TARGETS, the next entry after PROJECT which we just worked in. In the table to the right, find Architectures under Architectures and click the input cell to the right. Choose Standard in the popup menu as in the next picture.
    Find Compiler for C/C++/Objective-C under Build Options, the third section, click the input cell to the right. Choose Default Compiler in the popup menu as in the next picture.

  7. In the toolbar at the top, click right on text "iOS Device" on Active Scheme button on the left part. Choose iPhone 5.0 Simulator in the popup menu.

  8. In the bottom left corner, type "OSX" into the filter box in the red rectangle in the next picture. Some pertinent files appear above in the leftmost column. Right-click OSXClipboard.mm and choose delete. When the dialogbox pops up. choose Remove Reference Only.

  9. Clear the text you typed in the filter box and expand MacOSX in the left-most column to Irrlicht/Engine/irr/device. Create a new group called iOS within "device" and add files CIrrDeviceIPhone.* in the folder source/Irrlicht into the new group. Expand to Irrlicht/Engine/video and create another new group called OpenGL_ES1 within "video", Add files COpenGLES*.* in the folder source/Irrlicht into the new group but don't choose COpenGLES2*.*

  10. Try to build(cmd+B). Some build errors show up with CImageLoaderPNG.cpp and CImageWriterPNG.cpp.
    Change the erroneous line
    longjmp(png_ptr->jmpbuf, 1);
    
    to
    longjmp(png_jmpbuf(png_ptr), 1);
    and the erroneous line
    io::IReadFile* file=(io::IReadFile*)png_ptr->io_ptr;
    to
    io::IReadFile* file=(io::IReadFile*)png_get_io_ptr(png_ptr);
    Now you should see that Build libIrrlicht.a has succeeded.
You can build your first Irrlicht app by working through this guide.

No comments:

Post a Comment