2009-04-22 21:50:31 +08:00
|
|
|
// The majority of the application is dedicated to building the
|
|
|
|
// current contribitors list by parsing the ChangeLog, it just takes
|
|
|
|
// one line in the main itself to report the version number.
|
|
|
|
|
|
|
|
#include <set>
|
|
|
|
#include <vector>
|
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
#include <OpenThreads/Version>
|
|
|
|
|
2008-08-18 20:39:18 +08:00
|
|
|
#include <osg/Notify>
|
2005-03-13 09:47:46 +08:00
|
|
|
#include <osg/Version>
|
2005-11-15 01:07:11 +08:00
|
|
|
#include <osg/ArgumentParser>
|
|
|
|
#include <osg/ApplicationUsage>
|
2008-04-04 02:36:50 +08:00
|
|
|
|
|
|
|
#include <osg/Matrix>
|
|
|
|
#include <osg/Plane>
|
|
|
|
#include <osg/BoundingBox>
|
|
|
|
#include <osg/BoundingSphere>
|
|
|
|
|
2009-05-15 00:24:39 +08:00
|
|
|
#ifdef BUILD_CONTRIBUTORS
|
|
|
|
extern void printContributors(const std::string& changeLog, bool printNumEntries);
|
2005-11-17 23:18:48 +08:00
|
|
|
#endif
|
|
|
|
|
2009-05-15 00:24:39 +08:00
|
|
|
using namespace std;
|
2009-04-22 21:50:31 +08:00
|
|
|
|
|
|
|
int main( int argc, char** argv)
|
2005-11-15 01:07:11 +08:00
|
|
|
{
|
2009-04-22 21:50:31 +08:00
|
|
|
osg::ArgumentParser arguments(&argc, argv);
|
|
|
|
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName() + " [options]");
|
|
|
|
arguments.getApplicationUsage()->addCommandLineOption("-h or --help", "Display this information");
|
|
|
|
arguments.getApplicationUsage()->addCommandLineOption("--version-number", "Print out version number only");
|
|
|
|
arguments.getApplicationUsage()->addCommandLineOption("--major-number", "Print out major version number only");
|
|
|
|
arguments.getApplicationUsage()->addCommandLineOption("--minor-number", "Print out minor version number only");
|
|
|
|
arguments.getApplicationUsage()->addCommandLineOption("--patch-number", "Print out patch version number only");
|
|
|
|
arguments.getApplicationUsage()->addCommandLineOption("--so-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("Matrix::value_type", "Print the value of Matrix::value_type");
|
|
|
|
arguments.getApplicationUsage()->addCommandLineOption("Plane::value_type", "Print the value of Plane::value_type");
|
|
|
|
arguments.getApplicationUsage()->addCommandLineOption("BoundingSphere::value_type", "Print the value of BoundingSphere::value_type");
|
|
|
|
arguments.getApplicationUsage()->addCommandLineOption("BoundingBox::value_type", "Print the value of BoundingBox::value_type");
|
2009-05-15 00:24:39 +08:00
|
|
|
|
|
|
|
#ifdef BUILD_CONTRIBUTORS
|
2009-04-22 21:50:31 +08:00
|
|
|
arguments.getApplicationUsage()->addCommandLineOption("-r <file> or --read <file>", "Read the ChangeLog to generate an estimated contributors list.");
|
2009-05-15 00:24:39 +08:00
|
|
|
arguments.getApplicationUsage()->addCommandLineOption("--entries", "Print out number of entries into the ChangeLog file for each contributor.");
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// if user request help write it out to cout.
|
|
|
|
if (arguments.read("-h") || arguments.read("--help"))
|
|
|
|
{
|
|
|
|
cout << arguments.getApplicationUsage()->getCommandLineUsage() << endl;
|
|
|
|
arguments.getApplicationUsage()->write(cout, arguments.getApplicationUsage()->getCommandLineOptions());
|
|
|
|
return 1;
|
|
|
|
}
|
2005-11-15 01:07:11 +08:00
|
|
|
|
2007-04-23 05:40:46 +08:00
|
|
|
if (arguments.read("--version-number"))
|
|
|
|
{
|
2009-04-22 21:50:31 +08:00
|
|
|
cout << osgGetVersion() << endl;
|
2007-04-23 05:40:46 +08:00
|
|
|
return 0;
|
|
|
|
}
|
2009-04-22 21:50:31 +08:00
|
|
|
|
2007-09-25 20:34:01 +08:00
|
|
|
if (arguments.read("--major-number"))
|
|
|
|
{
|
2009-04-22 21:50:31 +08:00
|
|
|
cout << OPENSCENEGRAPH_MAJOR_VERSION << endl;
|
2007-09-25 20:34:01 +08:00
|
|
|
return 0;
|
|
|
|
}
|
2009-04-22 21:50:31 +08:00
|
|
|
|
2007-09-25 20:34:01 +08:00
|
|
|
if (arguments.read("--minor-number"))
|
|
|
|
{
|
2009-04-22 21:50:31 +08:00
|
|
|
cout << OPENSCENEGRAPH_MINOR_VERSION << endl;
|
2007-09-25 20:34:01 +08:00
|
|
|
return 0;
|
|
|
|
}
|
2009-04-22 21:50:31 +08:00
|
|
|
|
2007-09-25 20:34:01 +08:00
|
|
|
if (arguments.read("--patch-number"))
|
|
|
|
{
|
2009-04-22 21:50:31 +08:00
|
|
|
cout << OPENSCENEGRAPH_PATCH_VERSION << endl;
|
2007-09-25 20:34:01 +08:00
|
|
|
return 0;
|
|
|
|
}
|
2009-04-22 21:50:31 +08:00
|
|
|
|
2008-03-11 04:30:56 +08:00
|
|
|
if (arguments.read("--soversion-number") || arguments.read("--so-number") )
|
2007-09-11 18:10:43 +08:00
|
|
|
{
|
2009-04-22 21:50:31 +08:00
|
|
|
cout << osgGetSOVersion() << endl;
|
2007-09-11 18:10:43 +08:00
|
|
|
return 0;
|
|
|
|
}
|
2007-09-25 20:34:01 +08:00
|
|
|
|
2007-09-11 18:10:43 +08:00
|
|
|
if (arguments.read("--openthreads-version-number"))
|
|
|
|
{
|
2009-04-22 21:50:31 +08:00
|
|
|
cout << OpenThreadsGetVersion() << endl;
|
2007-09-11 18:10:43 +08:00
|
|
|
return 0;
|
|
|
|
}
|
2009-04-22 21:50:31 +08:00
|
|
|
|
2007-09-25 20:34:01 +08:00
|
|
|
if (arguments.read("--openthreads-major-number"))
|
|
|
|
{
|
2009-04-22 21:50:31 +08:00
|
|
|
cout << OPENTHREADS_MAJOR_VERSION << endl;
|
2007-09-25 20:34:01 +08:00
|
|
|
return 0;
|
|
|
|
}
|
2009-04-22 21:50:31 +08:00
|
|
|
|
2007-09-25 20:34:01 +08:00
|
|
|
if (arguments.read("--openthreads-minor-number"))
|
|
|
|
{
|
2009-04-22 21:50:31 +08:00
|
|
|
cout << OPENTHREADS_MINOR_VERSION << endl;
|
2007-09-25 20:34:01 +08:00
|
|
|
return 0;
|
|
|
|
}
|
2009-04-22 21:50:31 +08:00
|
|
|
|
2007-09-25 20:34:01 +08:00
|
|
|
if (arguments.read("--openthreads-patch-number"))
|
|
|
|
{
|
2009-04-22 21:50:31 +08:00
|
|
|
cout << OPENTHREADS_PATCH_VERSION << endl;
|
2007-09-25 20:34:01 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2007-09-11 18:10:43 +08:00
|
|
|
if (arguments.read("--openthreads-soversion-number"))
|
|
|
|
{
|
2009-04-22 21:50:31 +08:00
|
|
|
cout << OpenThreadsGetSOVersion() << endl;
|
2007-09-11 18:10:43 +08:00
|
|
|
return 0;
|
|
|
|
}
|
2008-04-04 02:36:50 +08:00
|
|
|
|
|
|
|
|
|
|
|
if (arguments.read("Matrix::value_type"))
|
|
|
|
{
|
2009-04-22 21:50:31 +08:00
|
|
|
cout << ((sizeof(osg::Matrix::value_type) == 4) ? "float" : "double") << endl;
|
2008-04-04 02:36:50 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (arguments.read("Plane::value_type"))
|
|
|
|
{
|
2009-04-22 21:50:31 +08:00
|
|
|
cout << ((sizeof(osg::Plane::value_type) == 4) ? "float" : "double") << endl;
|
2008-04-04 02:36:50 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (arguments.read("BoundingSphere::value_type"))
|
|
|
|
{
|
2009-04-22 21:50:31 +08:00
|
|
|
cout << ((sizeof(osg::BoundingSphere::value_type) == 4) ? "float" : "double") << endl;
|
2008-04-04 02:36:50 +08:00
|
|
|
return 0;
|
|
|
|
}
|
2009-04-22 21:50:31 +08:00
|
|
|
|
2008-04-04 02:36:50 +08:00
|
|
|
if (arguments.read("BoundingBox::value_type"))
|
|
|
|
{
|
2009-04-22 21:50:31 +08:00
|
|
|
cout << ((sizeof(osg::BoundingBox::value_type) == 4) ? "float" : "double") << endl;
|
2008-04-04 02:36:50 +08:00
|
|
|
return 0;
|
|
|
|
}
|
2009-04-22 21:50:31 +08:00
|
|
|
|
|
|
|
cout << osgGetLibraryName() << " " << osgGetVersion() << endl << endl;
|
2005-11-15 01:07:11 +08:00
|
|
|
|
2009-05-15 00:24:39 +08:00
|
|
|
#ifdef BUILD_CONTRIBUTORS
|
2009-04-22 21:50:31 +08:00
|
|
|
string changeLog;
|
|
|
|
while (arguments.read("-r", changeLog) ||
|
2009-05-15 00:24:39 +08:00
|
|
|
arguments.read("--read", changeLog))
|
2005-11-15 01:07:11 +08:00
|
|
|
{
|
2009-05-15 00:24:39 +08:00
|
|
|
printContributors(changeLog, arguments.read("--entries"));
|
2005-11-15 01:07:11 +08:00
|
|
|
}
|
2009-05-15 00:24:39 +08:00
|
|
|
#endif
|
2005-11-15 01:07:11 +08:00
|
|
|
|
2005-03-13 09:47:46 +08:00
|
|
|
return 0;
|
|
|
|
}
|