Changeset 8593

Show
Ignore:
Timestamp:
07/15/08 21:24:22
Author:
robert
Message:

Changed the version setup code to be consistent with the rest of the OSG

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • OpenSceneGraph/trunk/include/osgWidget/Version

    r8588 r8593  
    99extern "C" { 
    1010 
    11 OSGWIDGET_EXPORT unsigned int osgWidgetGetMajorVersion (); 
    12 OSGWIDGET_EXPORT unsigned int osgWidgetGetMinorVersion (); 
    13 OSGWIDGET_EXPORT unsigned int osgWidgetGetPatchVersion (); 
    14 OSGWIDGET_EXPORT const char*  osgWidgetGetExtraText    (); 
    15 OSGWIDGET_EXPORT const char*  osgWidgetGetVersion      (); 
    16 OSGWIDGET_EXPORT const char*  osgWidgetGetLibraryName  (); 
    17 OSGWIDGET_EXPORT bool         osgWidgetVersionMinimum  (unsigned int, unsigned int, unsigned int); 
    18 OSGWIDGET_EXPORT bool         osgWidgetVersionMaximum  (unsigned int, unsigned int, unsigned int); 
    19 OSGWIDGET_EXPORT bool         osgWidgetVersionRequired (unsigned int, unsigned int, unsigned int); 
     11/** 
     12 * osgWidgetGetVersion() returns the library version number. 
     13 * Numbering convention : OpenSceneGraph-1.0 will return 1.0 from osgWidgetGetVersion. 
     14 * 
     15 * This C function can be also used to check for the existence of the OpenSceneGraph 
     16 * library using autoconf and its m4 macro AC_CHECK_LIB. 
     17 * 
     18 * Here is the code to add to your configure.in: 
     19 \verbatim 
     20 # 
     21 # Check for the OpenSceneGraph (OSG) Util library 
     22 # 
     23 AC_CHECK_LIB(osg, osgWidgetGetVersion, , 
     24    [AC_MSG_ERROR(OpenSceneGraph Util library not found. See http://www.openscenegraph.org)],) 
     25 \endverbatim 
     26*/ 
     27extern OSGWIDGET_EXPORT const char* osgWidgetGetVersion(); 
     28 
     29/** 
     30 * osgWidgetGetLibraryName() returns the library name in human friendly form. 
     31 */ 
     32extern OSGWIDGET_EXPORT const char* osgWidgetGetLibraryName(); 
    2033 
    2134} 
  • OpenSceneGraph/trunk/src/osgWidget/Version.cpp

    r8588 r8593  
    22// $Id: Version.cpp 64 2008-06-30 21:32:00Z cubicool $ 
    33 
    4 #include <sstream> 
    54#include <osgWidget/Version> 
     5#include <osg/Version> 
    66 
    77extern "C" { 
    88 
    9 const unsigned int OSGWIDGET_MAJOR_VERSION = 0; 
    10 const unsigned int OSGWIDGET_MINOR_VERSION = 1; 
    11 const unsigned int OSGWIDGET_PATCH_VERSION = 8; 
    12 const char*        OSGWIDGET_EXTRA_TEXT    = "(pre-merge)"; 
    13  
    14 unsigned int osgWidgetGetMajorVersion() { 
    15         return OSGWIDGET_MAJOR_VERSION; 
     9const char* osgWidgetGetVersion() 
     10
     11    return osgGetVersion(); 
    1612} 
    1713 
    18 unsigned int osgWidgetGetMinorVersion() { 
    19         return OSGWIDGET_MINOR_VERSION; 
    20 
    21  
    22 unsigned int osgWidgetGetPatchVersion() { 
    23         return OSGWIDGET_PATCH_VERSION; 
    24 
    25  
    26 const char* osgWidgetGetExtraText() { 
    27         return OSGWIDGET_EXTRA_TEXT; 
    28 
    29  
    30 const char* osgWidgetGetVersion() { 
    31         static std::string version; 
    32         static bool versionInit = true; 
    33  
    34         if(versionInit) { 
    35                 std::stringstream stream; 
    36                  
    37                 stream.str(std::string()); 
    38  
    39                 stream 
    40                         << OSGWIDGET_MAJOR_VERSION << "." 
    41                         << OSGWIDGET_MINOR_VERSION << "." 
    42                         << OSGWIDGET_PATCH_VERSION << " " 
    43                         << OSGWIDGET_EXTRA_TEXT 
    44                 ; 
    45  
    46                 version     = stream.str(); 
    47                 versionInit = false; 
    48         } 
    49  
    50         return version.c_str(); 
    51 
    52  
    53 const char* osgWidgetGetLibraryName() { 
    54         static std::string name("OpenSceneGraph Widget Library"); 
    55  
    56         return name.c_str(); 
    57 
    58  
    59 bool osgWidgetVersionMinimum(unsigned int major, unsigned int minor, unsigned int patch) { 
    60         return 
    61                 OSGWIDGET_MAJOR_VERSION >= major && 
    62                 OSGWIDGET_MINOR_VERSION >= minor && 
    63                 OSGWIDGET_PATCH_VERSION >= patch 
    64         ; 
    65 
    66  
    67 bool osgWidgetVersionMaximum(unsigned int major, unsigned int minor, unsigned int patch) { 
    68         return  
    69                 // OSGWIDGET_MAJOR_VERSION <= major && 
    70                 OSGWIDGET_MINOR_VERSION <= minor && 
    71                 OSGWIDGET_PATCH_VERSION <= patch 
    72         ; 
    73 
    74  
    75 bool osgWidgetVersionRequired(unsigned int major, unsigned int minor, unsigned int patch) { 
    76         return  
    77                 OSGWIDGET_MAJOR_VERSION == major && 
    78                 OSGWIDGET_MINOR_VERSION == minor && 
    79                 OSGWIDGET_PATCH_VERSION == patch 
    80         ; 
     14const char* osgWidgetGetLibraryName() 
     15
     16        return "OpenSceneGraph Widget Library"; 
    8117} 
    8218