Macintosh

Welcome to the Irrlicht Engine Macintosh Wiki Page


This page is dedicated to Irrlicht users who are developing on the macintosh platform and aims to provide complete comprehensive documentation on installation procedures, work arounds and known issues. As you come across issues and solve them feel free to add them to the documentation.

Table of Contents

  1. Installing Irrlicht on Macintosh
  2. Creating A Project
  3. List of Bugs and Workarounds

1.1 Installing Irrlicht on Macintosh

Installing Irrlicht on the Macintosh is a slightly convoluted procedure which will require you to build the library from source. However this section will guide you through how to build and install irrlicht with both Cocoa and via X11 with OS 10.6. This section won't show you how to create a project please refer further down in the documentation for that.

1.1.1 Compiling From Source With The Native Cocoa Framework

Steps for Installation

  1. Download Irrlicht
  2. Unzip Irrlicht to a folder in this case we are unziping it at /Users/username/Code/irrlicht-1.7.2/
  3. Navigate to /Users/username/Code/irrlicht-1.7.2/source/Irrlicht/MacOSX/
  4. Open MacOSX.xcodeproj
  5. Set Active Configuration to Release.
  6. Set Active SDK: Project->Edit Project Settings->General Tab->Base SDK For All Configurations: 10.6
  7. Set Active SDK: i386
  8. Build: Command+B

1.1.2 Compiling From Source With X11

Steps for Compilation

  1. No Current Documentation

1.2 Creating A Project

There are two ways common ways that most users desire to create a project on the OSX platform, either through the default IDE XCode or via the more traditional UNIX command line makefile. Feel free to add additional build procedures below as you work them out.

1.2.1 Creating A Project With XCode

This build procedure will generate warnings. This procedure was originally outlined in this blog post.

Steps for Creating a Project

  1. Start a New Empty XCode Project
  2. Control+Click Targets. Add New Target -> Select Cocoa Application
  3. Add /Users/username/Code/irrlicht-1.7.2/include to header search paths
  4. Target You Created -> Add Existing File -> /Users/username/Code/irrlicht-1.7.2/source/Irrlicht/MacOSX/MainMenu.nib
  5. Target You Created -> Add Existing Framework -> Cocoa, Carbon, IOKit, and OpenGL
  6. Target You Created -> Add Exisiting File -> /Users/username/Code/irrlicht-1.7.2/source/Irrlicht/MacOSX/build/Release/libIrrlicht.a
  7. Add new file -> C++ File -> Rename main.mm (to comply with objective C which is used in the native framework)
  8. Note if you are trying to compile an example press the GBD icon which will pop up a terminal and select opengl for the rendering type. Also remember absolute paths need to be used instead of relative paths since your xcode project is in a seperate location.

1.2.2 Creating A Makefile

Steps to create a makefile

  1. With Native Cocoa: g++ main.cpp -o progam -arch i386 /Users/username/Code/irrlicht-1.7.2/lib/MacOSX/libIrrlicht.a -I/Users/username/Code/irrlicht-1.7.2/include -framework OpenGL -framework Cocoa -framework Carbon -framework IOKit
  2. With X11: g++ file.cpp -o file -Llib/MacOSX -lIrrlicht -I./include /usr/X11R6/lib/libX11.dylib /usr/X11R6/lib/libXxf86vm.dylib /usr/X11R6/lib/libGL.dylib /usr/X11R6/lib/libGLU.dylib

When creating applications with a Makefile like this, there are some problems: keyboard inputs are not recognized, mouse movement is only recognized while the mouse button is pressed, relative paths do not work, and the application cannot be quit using Apple-Q. The following additional steps solve these problems:

  1. Mac-Application Folders: create (on the same level as your Makefile) a folder "mygame.app"; it will appear in the finder as an application icon, named just "mygame". Create a subdirector "Contents" which in turn has two subdirectories "MacOS" and "Resources".
  2. Resources: You may put files for textures and sounds that your game uses into the Resources folder. You can refer to them with local paths (use the directory structure at compile time). These local paths then also work if the application file is moved or installed on a different computer.
  3. MainMenu.nib: If you have compiled any of the IrrLicht examples with X-Code, the respective "....app" contains in its Resources folder MainMenu.nib. Just make a copy of it into your Resources folder. This enables the Apple-Q and probably other standard Apple-Things.
  4. Lipo: Assuming your binary from above is called "program" use the following additional call: lipo -create program -output mygame.app/Contents/MacOS/mygame . This step creates a new version of the binary inside your app-folder where the problem of inputs and relative paths are solved. This line should be added to your Makefile as this must be done after every compilation.

1.2.3 Creating A Project With Eclipse

Following are the steps to create a C++ project using Irrlicht in Eclipse.

Steps for Creating a Project

  1. Create a new C++ project (File->New->C++ Project)
  2. Right Click on the Project Folder in Project Explorer and add a new source file (and a header file if you prefer). (Right Click->New->Source File)
  3. Get sample code published here. Alternatively from My GitHub
  4. Go to Project build settings (Right click->Properties->C/C++ Build->Settings).
  5. Set C++ Linker Libraries. Add Irrlicht under Libraries (-l).
  6. Under Library search paths (-L) add <irrlicht path>/irrlicht-1.7.2/source/Irrlicht/MacOSX/build/Release and /Developer/SDKs/MacOSX10.6.sdk/usr/X11/lib (X11 lib path whatever it is based on you machine)
  7. Under Linker->Miscellaneous, add these linker flags -arch i386 -framework OpenGL -framework Carbon -framework Cocoa -framework IOKit (i386 since you created your lib file as 32bit arch).
  8. Under GCC C++ Compiler, add under Includes section add <irrlicht path>/irrlicht-1.7.2/include
  9. Under GCC C++ Compiler, add under Miscellaneous->Other flags,add to the existing -arch i386 -fvisibility=hidden
  10. Edit the code to set correct path for sydney.md2 and sydney.bmp

1.3 List of Bugs and Workarounds

Add bugs as you come across them, and please make sure they are bugs. Please list the version or SVN revision it occurs in and if possible link to a new page with a workaround. If the bug is exceptionally bad please post it in red.

List of Bugs and Workarounds

  1. None Reported.

1.4 External sources

Nothing has been reported.