Linking the plugin on the Mac.

psychopath

22-05-2009 14:31:03

I posted as a secondary-question to a thread on the main forums, but I figure it might get more attention here.

I've got the latest Mac source compiling, with the change suggested here in order to get the plugin to load. However, in order to actually use the plugin, I've found I need to include OgrePCZSceneManager.h (as in the test app...which doesn't even get compiled with the other samples on the mac). This I found, required changing most of the header files as they include Ogre headers as if they are in the same project (not as if Ogre is in a framework). So I removed these includes, and #included <Ogre/Ogre.h> before the PCZ header. This compiles, but I then get a link error, regarding PCZSceneManager::init() not being found. You can't link a bundle on the mac though - it has to be dynamically loaded. So, what do you do in order to load this plugin, and "link" it properly on the mac?

Thanks!

Llarlen

14-07-2009 13:16:50

What we did in our project is to compile the plugin as a framework instead of a bundle, then link the application to the framework and instantiate and install the plugin manually. Uninstalling is done automatically by Ogre when Ogre::Root is shut down.

edit:
additional code required
// Manually load the PCZ plugins on OSX since a compile-time linked library cannot be loaded at
// runtime as a plugin by Ogre.
#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
// Create new PCZ scene manager plugin
Ogre::PCZPlugin *pczPlugin = OGRE_NEW Ogre::PCZPlugin();
// Register it
mRoot->installPlugin(pczPlugin);

// Create a new OctreeZone scene manager plugin
Ogre::OctreeZonePlugin *ozPlugin = OGRE_NEW Ogre::OctreeZonePlugin();
// Register it
mRoot->installPlugin(ozPlugin);
#endif