From Mike Wittman and Robert Osfield, added support for SO_VERSION number in

runtime version info.  Added checks for OpenThreads version.
This commit is contained in:
Robert Osfield 2007-09-11 10:10:43 +00:00
parent 269a3956e3
commit bea07b5f72
3 changed files with 50 additions and 5 deletions

View File

@ -1,6 +1,7 @@
#include <osg/Version>
#include <osg/ArgumentParser>
#include <osg/ApplicationUsage>
#include <OpenThreads/Version>
#include <set>
#include <vector>
@ -649,6 +650,9 @@ int main( int argc, char **argv)
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information");
arguments.getApplicationUsage()->addCommandLineOption("--entries","Print out number of entries into the ChangeLog file for each contributor.");
arguments.getApplicationUsage()->addCommandLineOption("--version-number","Print out version number only");
arguments.getApplicationUsage()->addCommandLineOption("--soversion-number","Print out shared object version number only");
arguments.getApplicationUsage()->addCommandLineOption("--openthreads-version-number","Print out version number for OpenThreads only");
arguments.getApplicationUsage()->addCommandLineOption("--openthreads-soversion-number","Print out shared object version number for OpenThreads only");
arguments.getApplicationUsage()->addCommandLineOption("-r <file> or --read <file>","Read the ChangeLog to generate an estimated contributors list.");
if (arguments.read("--version-number"))
@ -657,6 +661,24 @@ int main( int argc, char **argv)
return 0;
}
if (arguments.read("--soversion-number"))
{
std::cout<<osgGetSOVersion()<<std::endl;
return 0;
}
if (arguments.read("--openthreads-version-number"))
{
std::cout<<OpenThreadsGetVersion()<<std::endl;
return 0;
}
if (arguments.read("--openthreads-soversion-number"))
{
std::cout<<OpenThreadsGetSOVersion()<<std::endl;
return 0;
}
std::cout<<osgGetLibraryName()<< " "<< osgGetVersion()<<std::endl<<std::endl;
bool printContributors = false;

View File

@ -18,12 +18,11 @@
extern "C" {
#define OSG_VERSION_MAJOR 2
#define OSG_VERSION_MINOR 1
#define OSG_VERSION_PATCH 9
#define OSG_VERSION_RELEASE OSG_VERSION_PATCH
#define OSG_VERSION_REVISION 0
#define OPENSCENEGRAPH_MAJOR_VERSION 2
#define OPENSCENEGRAPH_MINOR_VERSION 1
#define OPENSCENEGRAPH_PATCH_VERSION 9
#define OPENSCENEGRAPH_SOVERSION 20
/**
* osgGetVersion() returns the library version number.
@ -43,9 +42,21 @@ extern "C" {
*/
extern OSG_EXPORT const char* osgGetVersion();
/** The osgGetSOVersion() method returns the OpenSceneGraph soversion number. */
extern OSG_EXPORT const char* osgGetSOVersion();
/** The osgGetLibraryName() method returns the library name in human-friendly form. */
extern OSG_EXPORT const char* osgGetLibraryName();
// old defines for backwards compatibility.
#define OSG_VERSION_MAJOR OPENSCENEGRAPH_MAJOR_VERSION
#define OSG_VERSION_MINOR OPENSCENEGRAPH_MINOR_VERSION
#define OSG_VERSION_PATCH OPENSCENEGRAPH_PATCH_VERSION
#define OSG_VERSION_RELEASE OSG_VERSION_PATCH
#define OSG_VERSION_REVISION 0
}
#endif

View File

@ -37,6 +37,18 @@ const char* osgGetVersion()
return osg_version;
}
const char* osgGetSOVersion()
{
static char osg_soversion[32];
static int osg_soversion_init = 1;
if (osg_soversion_init)
{
sprintf(osg_soversion,"%d",OPENSCENEGRAPH_SOVERSION);
osg_soversion_init = 0;
}
return osg_soversion;
}
const char* osgGetLibraryName()
{