MacDotScene         How to build dotScene stuff on Mac

Made with Ogre 1.0.4 | OSX 10.4.2 | XCode 2.1

Introduction : What are we going to do here ?

The goal is here to build both the dotSceneManager plugin AND the octree converter. For that purpose, we will create a project and two targets in it.

Building the dotSceneManager Plugin

First, open XCode and make a new project

Choose a Cocoa Bundle

Then choose your project directory and name : Plugin_DotSceneManager would be easier

Remove :

  • the CoreData framework
  • the Foundation framework
  • the AppKit framework
  • the .pch file


Add 2 new groups in Classes :

  • Plugin
  • Common


Add the existing files in Plugin :

  • from ogreaddons/dotsceneoctree/PlugIns/DotSceneManager/include :
    • DotSceneManager.h
    • SceneMain.h
    • SceneOctree.h
    • SceneOctreeRenderable.h
  • from ogreaddons/dotsceneoctree/PlugIns/DotSceneManager/src
    • DotSceneManager.cpp
    • DotSceneManagerDLL.cpp
    • SceneMain.cpp
    • SceneOctree.cpp
    • SceneOctreeRenderable.cpp


Add the existing files in Common :

  • from ogreaddons/dotsceneoctree/PlugIns/DotSceneManager/include :
    • tinystr.h
    • tinyxml.h
  • from ogreaddons/dotsceneoctree/PlugIns/DotSceneManager/src
    • tinystr.cpp
    • tinyxml.cpp
    • tinyxmlerror.cpp
    • tinyxmlparser.cpp


Add the frameworks :

  • Cocoa from /System/Library/
  • Ogre, SDL & zzip from ~/Library/


In tinyxml.h, add #define TIXML_USE_STL on the first line to avoid conversion errors with Ogre::String

Then go to your project options

  • in header search paths put : $(HOME)/Library/Frameworks/Ogre.framework/Versions/A/Headers
  • in framework search path put : $(HOME)/Library/Frameworks
  • delete the "Prefix Header" entry
  • uncheck the "Precompile Prefix Header"


Hit Build and you already have you DotSceneManager Plugin !

Building the dotScene converter

Create a new target on the same project : BSD => Shell Tool

Name it dotSceneConverter

Add a new group : Converter

Add it the files (when adding, be sure to add the files to the dotSceneConverter target) :

  • from ogrenew/Mac/XCode/Classes :
    • SDLMain.h
    • SDLMain.m
  • from ogreaddons/dotsceneoctree/Tools/ExampleSceneConverter/include/
    • SceneConverter.h
    • SceneConverterOctree.h
    • SceneConverterOctreeObjects.h
  • from ogreaddons/dotsceneoctree/Tools/ExampleSceneConverter/src
    • main.cpp
    • SceneConverter.cpp
    • SceneConverterOctree.cpp
    • SceneConverterOctreeObjects.cpp


In your target :

  • add the *.cpp from the Common group we created earlier to the "Compile Sources" build phase
  • add Cocoa, Ogre, SDL and zzip frameworks to the "Link Binary With Library" build phase


In main.cpp, wrap the main function with : extern "C" { }

This should be like this then :

{CODE(wrap="1", colors="c++")}extern "C"
{

main (int numargs, char** args)

{

...

}
}{CODE}

Then go to your project options

in header search paths put : $(HOME)/Library/Frameworks/Ogre.framework/Versions/A/Headers

in framework search path put : $(HOME)/Library/Frameworks

Change the current target to build, hit build and enjoy !

Conclusion : How to use this now ?

You have to ways now for the bundle :

  • either you copy the new bundle to $(HOME)/Library/Frameworks/Ogre.framework/Versions/A/Resources. In that case, you'll be sure to have for any new Ogre project,
  • or you just link your projects with the bundle when you really need it.


For the converter, just use it with the terminal, as usual.

Any remarks ? please pm fp12 on the forum ;)