mirror of https://github.com/OpenMW/openmw.git
bug #348: fixed OS X deployment
just enable CMake option "OPENMW_OSX_DEPLOYMENT" and it will search plugins inside application bundle instead of Ogre prefixpull/21/head
parent
94ce95c679
commit
fbe9a94568
@ -0,0 +1,37 @@
|
||||
#include "ogreplugin.h"
|
||||
|
||||
#include <OgrePrerequisites.h>
|
||||
#include <OgreRoot.h>
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
|
||||
bool loadOgrePlugin(std::string pluginDir, std::string pluginName, Ogre::Root &ogreRoot) {
|
||||
#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
|
||||
std::ostringstream verStream;
|
||||
verStream << "." << OGRE_VERSION_MAJOR << "." << OGRE_VERSION_MINOR << "." << OGRE_VERSION_PATCH;
|
||||
pluginName = pluginName + OGRE_PLUGIN_DEBUG_SUFFIX + verStream.str();
|
||||
#endif
|
||||
|
||||
std::string pluginExt;
|
||||
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
|
||||
pluginExt = ".dll";
|
||||
#endif
|
||||
#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
|
||||
pluginExt = ".dylib";
|
||||
#endif
|
||||
#if OGRE_PLATFORM == OGRE_PLATFORM_LINUX
|
||||
pluginExt = ".so";
|
||||
#endif
|
||||
|
||||
std::string pluginPath = pluginDir + "/" + pluginName + pluginExt;
|
||||
|
||||
std::cout << "loading plugin: " << pluginPath << std::endl;
|
||||
|
||||
if (boost::filesystem::exists(pluginPath)) {
|
||||
ogreRoot.loadPlugin(pluginPath);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
#ifndef OGREPLUGIN_H
|
||||
#define OGREPLUGIN_H
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace Ogre {
|
||||
class Root;
|
||||
}
|
||||
|
||||
extern bool loadOgrePlugin(std::string pluginDir, std::string pluginName, Ogre::Root &ogreRoot);
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue