mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-10 15:39:02 +00:00
7952d38e6c
Using the Debug build in vs2010 is not working because the debug dlls are not loaded when debugging. The reason they are not loaded is that CMAKE_BUILD_TYPE is not defined when doing multiple builds. This in turns causes OGRE_PLUGIN_DEBUG_SUFFIX not to be set. This patch makes sure that OGRE_PLUGIN_DEBUG_SUFFIX is always set but only used when debugging. It also defines DEBUG to make it easier turn things on and off when debugging. There are still other bugs that have broken Debug mode in vs2010 but those will be addressed in other patches.
41 lines
1007 B
C++
41 lines
1007 B
C++
#include "ogreplugin.hpp"
|
|
|
|
#include <OgrePrerequisites.h>
|
|
#include <OgreRoot.h>
|
|
|
|
namespace Files {
|
|
|
|
bool loadOgrePlugin(const std::string &pluginDir, std::string pluginName, Ogre::Root &ogreRoot) {
|
|
// Append plugin suffix if debugging.
|
|
#if defined(DEBUG)
|
|
pluginName = pluginName + OGRE_PLUGIN_DEBUG_SUFFIX;
|
|
#endif
|
|
|
|
#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
|
|
std::ostringstream verStream;
|
|
verStream << "." << OGRE_VERSION_MAJOR << "." << OGRE_VERSION_MINOR << "." << OGRE_VERSION_PATCH;
|
|
pluginName = pluginName + 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;
|
|
if (boost::filesystem::exists(pluginPath)) {
|
|
ogreRoot.loadPlugin(pluginPath);
|
|
return true;
|
|
}
|
|
else {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
} |