Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Main: add debug build guard on Ogre::Root #3246

Merged
merged 1 commit into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions OgreMain/include/OgrePrerequisites.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,17 @@ THE SOFTWARE
#include <string>
#include <memory>

// extra namespace to trigger LNK2019 on binary incompatible builds
// instead of crashing at runtime
#if defined(_MSC_VER) && defined(_DEBUG)
#define OGRE_DEBUG_NS_BEGIN namespace DEBUG_BUILD_REQUIRED {
#define OGRE_DEBUG_NS_END }
namespace Ogre { namespace DEBUG_BUILD_REQUIRED { } using namespace DEBUG_BUILD_REQUIRED; }
#else
#define OGRE_DEBUG_NS_BEGIN
#define OGRE_DEBUG_NS_END
#endif

namespace Ogre {
#define OGRE_TOKEN_PASTE_INNER(x, y) x ## y
#define OGRE_TOKEN_PASTE(x, y) OGRE_TOKEN_PASTE_INNER(x, y)
Expand Down Expand Up @@ -211,7 +222,9 @@ namespace Ogre {
class ResourceGroupManager;
class ResourceManager;
class RibbonTrail;
OGRE_DEBUG_NS_BEGIN
class Root;
OGRE_DEBUG_NS_END
class SceneManager;
class SceneNode;
class SceneQuery;
Expand Down
3 changes: 3 additions & 0 deletions OgreMain/include/OgreRoot.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ namespace Ogre
/// Scene manager instances, indexed by instance name
typedef std::map<String, SceneManager*> SceneManagerInstanceMap;

OGRE_DEBUG_NS_BEGIN

/** The root class of the Ogre system.

The Ogre::Root class represents a starting point for the client
Expand Down Expand Up @@ -925,6 +927,7 @@ namespace Ogre
*/
Real getDefaultMinPixelSize() { return mDefaultMinPixelSize; }
};
OGRE_DEBUG_NS_END
/** @} */
/** @} */
} // Namespace Ogre
Expand Down
Loading