Page 1 of 1

Ogre Version

Posted: Wed Jul 11, 2018 10:16 pm
by libolt
While I am moving my code to Ogre 1.11 I still need compatability with 1.10. Does ogre have a preprocessor macro that defines the version number?

Re: Ogre Version

Posted: Wed Jul 11, 2018 10:19 pm
by dark_sylinc
See these macros in OgreMain/include/OgrePrerequisites.h

Code: Select all

#define OGRE_VERSION_MAJOR
#define OGRE_VERSION_MINOR
#define OGRE_VERSION_PATCH
#define OGRE_VERSION_SUFFIX
#define OGRE_VERSION_NAME
#define OGRE_VERSION
Cheers

Re: Ogre Version

Posted: Wed Jul 11, 2018 11:28 pm
by paroj

Code: Select all

#if (OGRE_VERSION < ((1 << 16) | (11 << 8) | 0))
// 1.10
# else
// 1.11
#endif
probably we should also provide a OGRE_VERSION_LESS macro with ogre...

Re: Ogre Version

Posted: Mon Jan 28, 2019 1:42 pm
by mmixLinus
As far as I understand, OGRE_VERSION_MAJOR, _MINOR and _PATCH are now (1.12) only available in OgreBuildSettings.h? Or at least removed from Prerequisites.h. Is this from 1.12.0 or already in 1.11.5?

Reason: I am fiddling with FindOgre.cmake in CEGUI v0-8.

Re: Ogre Version

Posted: Mon Jan 28, 2019 3:27 pm
by paroj
you shouldnt have to:
https://bitbucket.org/cegui/cegui/commi ... f7e53163d4

but to answer your question, its in OgreBuildSettings.h since 1.11.5 already.

Re: Ogre Version

Posted: Mon Jan 28, 2019 8:35 pm
by mmixLinus
The problem is that find_package(Ogre) fails because it greps Prerequisites.h, not OgreBuildSettings.h for the major, minor and patch. Anyway, thanks for your help. I'll try to submit a backward compatible fix (to cegui) : )

Re: Ogre Version

Posted: Tue Jan 29, 2019 12:26 am
by paroj
with the linked patch, it should use find_package(OGRE) which does not grep anything, but uses the new cmake findconfig infrastructure.
Only if this fails it falls back to find_package(Ogre).

Maybe you are on a case insensitive FS and the above logic fails. Then the fix is to rename the FindOgre.cmake script to FindOldOgre.cmake and change the according line to find_package(OldOgre)

Re: Ogre Version

Posted: Tue Jan 29, 2019 12:09 pm
by mmixLinus
the new cmake findconfig infrastructure
ah ok, I'll check this. Thanks : )