diff --git a/Make/makedefs b/Make/makedefs index 0626d8bb1..d47cfbf58 100644 --- a/Make/makedefs +++ b/Make/makedefs @@ -205,50 +205,84 @@ endif #### IRIX Specific definitions ifeq ($(OS),IRIX) - LINKARGS = -L${TOPDIR}/lib -LANG:std -OPT:Olimit=0 - C++ = CC - DEPARG = -M - INC += -I${TOPDIR}/include -I/usr/freeware/include - DEF += -LANG:std -OPT:Olimit=0 \ - -DEBUG:woff=1681 -DEBUG:woff=1682 -DEBUG:woff=3303\ - -MDupdate $(MAKEDEPEND) - OPTF = -O2 - DBGF = -g -DOSG_COMPILE_UNIT_TESTS - SHARED = -shared - PFLIBS = \ - -lpf3ds -lpfdem -lpfdted -lpfdwb -lpfdxf -lpfevt \ - -lpfflt -lpfgds -lpfgfo -lpfim -lpflsa -lpflsb \ - -lpfnff -lpfobj -lpfpegg -lpfpfb -lpfphd -lpfpts \ - -lpfrot -lpfscale -lpfsgf -lpfsgo -lpfsphere -lpfsv \ - -lpftri -lpfunc -lpfvct -lpfdu -lpfutil -lpf -all -limage - FREETYPE_LIB = -lfreetype - ARCH = 32 - ifeq ($(ARCH),64) - ARCHARGS = -64 -DARCH64 - ARCHINST = 64 - LINKARGS += -L/usr/freeware/lib64 - PF_XTRA_LIBS = -L/usr/lib64/libpfdb -rpath /usr/lib64/libpfdb \ - $(PFLIBS) - else - ARCHARGS = -n32 - ARCHINST = 32 - LINKARGS += -L/usr/freeware/lib32 - PF_XTRA_LIBS = -L/usr/lib32/libpfdb -rpath /usr/lib32/libpfdb \ - $(PFLIBS) - endif + CXX = CC + ifeq ($(CXX),CC) + LINKARGS = -L${TOPDIR}/lib -LANG:std -OPT:Olimit=0 + C++ = CC + DEPARG = -M + INC += -I${TOPDIR}/include -I/usr/freeware/include + DEF += -LANG:std -OPT:Olimit=0 \ + -DEBUG:woff=1681 -DEBUG:woff=1682 -DEBUG:woff=3303\ + -MDupdate $(MAKEDEPEND) + OPTF = -O2 + DBGF = -g -DOSG_COMPILE_UNIT_TESTS + SHARED = -shared + PFLIBS = \ + -lpf3ds -lpfdem -lpfdted -lpfdwb -lpfdxf -lpfevt \ + -lpfflt -lpfgds -lpfgfo -lpfim -lpflsa -lpflsb \ + -lpfnff -lpfobj -lpfpegg -lpfpfb -lpfphd -lpfpts \ + -lpfrot -lpfscale -lpfsgf -lpfsgo -lpfsphere -lpfsv \ + -lpftri -lpfunc -lpfvct -lpfdu -lpfutil -lpf -all -limage + FREETYPE_LIB = -lfreetype + ARCH = 32 + ifeq ($(ARCH),64) + ARCHARGS = -64 -DARCH64 + ARCHINST = 64 + LINKARGS += -L/usr/freeware/lib64 + PF_XTRA_LIBS = -L/usr/lib64/libpfdb -rpath /usr/lib64/libpfdb \ + $(PFLIBS) + else + ARCHARGS = -n32 + ARCHINST = 32 + LINKARGS += -L/usr/freeware/lib32 + PF_XTRA_LIBS = -L/usr/lib32/libpfdb -rpath /usr/lib32/libpfdb \ + $(PFLIBS) + endif + else + LIBS = -lstdc++ + LINKARGS = -L${TOPDIR}/lib + C++ = g++ + INC += -I${TOPDIR}/include -I/usr/freeware/include + DEF += -fPIC -W -Wno-unused + OPTF = -O2 + DBGF = -g -gstabs+ -DOSG_COMPILE_UNIT_TESTS + SHARED = -shared + PFLIBS = \ + -lpf3ds -lpfdem -lpfdted -lpfdwb -lpfdxf -lpfevt \ + -lpfflt -lpfgds -lpfgfo -lpfim -lpflsa -lpflsb \ + -lpfnff -lpfobj -lpfpegg -lpfpfb -lpfphd -lpfpts \ + -lpfrot -lpfscale -lpfsgf -lpfsgo -lpfsphere -lpfsv \ + -lpftri -lpfunc -lpfvct -lpfdu -lpfutil -lpf -all -limage + FREETYPE_LIB = -lfreetype + ARCH = 32 + ifeq ($(ARCH),64) + ARCHARGS = -mabi=64 -mips4 -DARCH64 + ARCHINST = 64 + LINKARGS += -L/usr/freeware/lib64 + PF_XTRA_LIBS = -L/usr/lib64/libpfdb -rpath /usr/lib64/libpfdb \ + $(PFLIBS) + else + ARCHARGS = -mabi=n32 -mips4 + ARCHINST = 32 + LINKARGS += -L/usr/freeware/lib32 + PF_XTRA_LIBS = -L/usr/lib32/libpfdb -rpath /usr/lib32/libpfdb \ + $(PFLIBS) + endif + endif + + DYNAMICLIBRARYLIB = + OSG_LIBS = -losgGA -losgDB -losgUtil -losg + GL_LIBS = -lGLU -lGL + X_INC = -I/usr/X11R6/include + X_LIBS = -lXext -lXi -lXmu -lX11 + SOCKET_LIBS = + OTHER_LIBS = -lm -lOpenThreads + PNG_LIBS = -lpng + JPEG_LIBS = -ljpeg + TIFF_LIB = -ltiff + GIF_LIBS = -lungif + MAKEDIST = $(TOPDIR)/Make/makeirixdist - DYNAMICLIBRARYLIB = - OSG_LIBS = -losgGA -losgDB -losgUtil -losg - GL_LIBS = -lGLU -lGL - X_INC = -I/usr/X11R6/include - X_LIBS = -lXext -lXi -lXmu -lX11 - SOCKET_LIBS = - OTHER_LIBS = -lm -lOpenThreads - PNG_LIBS = -lpng - JPEG_LIBS = -ljpeg - TIFF_LIB = -ltiff - GIF_LIBS = -lungif - MAKEDIST = $(TOPDIR)/Make/makeirixdist endif #### Linux specific definitions diff --git a/examples/osgscalarbar/GNUmakefile b/examples/osgscalarbar/GNUmakefile index 76fa4e81c..331b5827d 100644 --- a/examples/osgscalarbar/GNUmakefile +++ b/examples/osgscalarbar/GNUmakefile @@ -12,7 +12,6 @@ INSTFILES = \ EXEC = osgscalarbar -INC += $(PRODUCER_INCLUDE_DIR) -I/usr/X11R6/include -LDFLAGS += $(PRODUCER_LIB_DIR) +INC += $(X_INC) include $(TOPDIR)/Make/makerules diff --git a/examples/osgscalarbar/GNUmakefile.inst b/examples/osgscalarbar/GNUmakefile.inst index d5ad41e70..57f5d2af9 100644 --- a/examples/osgscalarbar/GNUmakefile.inst +++ b/examples/osgscalarbar/GNUmakefile.inst @@ -8,7 +8,6 @@ LIBS += -losgText -losgProducer -lProducer -losgDB -losgText -losgUtil -losg EXEC = osgscalarbar -INC += $(PRODUCER_INCLUDE_DIR) -I/usr/X11R6/include -LDFLAGS += $(PRODUCER_LIB_DIR) +INC += $(X_INC) include $(TOPDIR)/Make/makerules diff --git a/examples/osgspheresegment/GNUmakefile b/examples/osgspheresegment/GNUmakefile index 2c57545d9..fd8ab76d9 100644 --- a/examples/osgspheresegment/GNUmakefile +++ b/examples/osgspheresegment/GNUmakefile @@ -12,7 +12,6 @@ INSTFILES = \ EXEC = osgspheresegment -INC += $(PRODUCER_INCLUDE_DIR) -I/usr/X11R6/include -LDFLAGS += $(PRODUCER_LIB_DIR) +INC += $(X_INC) include $(TOPDIR)/Make/makerules diff --git a/examples/osgspheresegment/GNUmakefile.inst b/examples/osgspheresegment/GNUmakefile.inst index ba5898a9b..1e1c96bd3 100644 --- a/examples/osgspheresegment/GNUmakefile.inst +++ b/examples/osgspheresegment/GNUmakefile.inst @@ -8,7 +8,6 @@ LIBS += -losgText -losgProducer -lProducer -losgDB -losgText -losgUtil -losg EXEC = osgspheresegment -INC += $(PRODUCER_INCLUDE_DIR) -I/usr/X11R6/include -LDFLAGS += $(PRODUCER_LIB_DIR) +INC += $(X_INC) include $(TOPDIR)/Make/makerules diff --git a/examples/osgviewer/GNUmakefile.inst b/examples/osgviewer/GNUmakefile.inst index 9e5e0ac91..11834bc69 100644 --- a/examples/osgviewer/GNUmakefile.inst +++ b/examples/osgviewer/GNUmakefile.inst @@ -8,7 +8,6 @@ LIBS += -losgProducer -lProducer -losgDB -losgText -losgUtil -losg $(GL_LIBS EXEC = osgviewer -INC += $(PRODUCER_INCLUDE_DIR) $(X_INC) -LDFLAGS += $(PRODUCER_LIB_DIR) +INC += $(X_INC) include $(TOPDIR)/Make/makerules diff --git a/include/osg/Timer b/include/osg/Timer index a8b94e7c7..da898ce99 100644 --- a/include/osg/Timer +++ b/include/osg/Timer @@ -18,30 +18,30 @@ #if defined(_MSC_VER) - namespace osg { - typedef __int64 Timer_t; - } + namespace osg { + typedef __int64 Timer_t; + } #elif defined(__linux) || defined(__FreeBSD__) || defined(__CYGWIN__)|| defined(__MINGW32__) - namespace osg { - typedef unsigned long long Timer_t; - } + namespace osg { + typedef unsigned long long Timer_t; + } #elif defined(__sgi) - namespace osg { - typedef unsigned long long Timer_t; - } + namespace osg { + typedef unsigned long long Timer_t; + } #elif defined(unix) - namespace osg { - typedef unsigned long long Timer_t; - } + namespace osg { + typedef unsigned long long Timer_t; + } #elif defined __APPLE__ || defined macintosh - namespace osg { - typedef double Timer_t; - } + namespace osg { + typedef double Timer_t; + } #else #include - namespace osg { - typedef std::clock_t Timer_t; - } + namespace osg { + typedef std::clock_t Timer_t; + } #endif namespace osg { @@ -57,14 +57,14 @@ class SG_EXPORT Timer { static const Timer* instance(); - #if defined __DARWIN_OSX__ || defined macintosh - // PJA MAC OSX - inline Tick() pollutes namespace so badly - // we cant compile, due to Carbon.h ... + #if defined __DARWIN_OSX__ || defined macintosh + // PJA MAC OSX - inline Tick() pollutes namespace so badly + // we cant compile, due to Carbon.h ... Timer_t tick() const; - #else - inline Timer_t tick() const; - #endif - + #else + inline Timer_t tick() const; + #endif + inline double delta_s( Timer_t t1, Timer_t t2 ) const { return (double)(t2 - t1)*_secsPerTick; } inline double delta_m( Timer_t t1, Timer_t t2 ) const { return delta_s(t1,t2)*1e3; } inline double delta_u( Timer_t t1, Timer_t t2 ) const { return delta_s(t1,t2)*1e6; } @@ -81,7 +81,7 @@ class SG_EXPORT Timer { unsigned long* _clockAddress_32; unsigned long long* _clockAddress_64; int _cycleCntrSize; - // for SGI machines with 32 bit clocks. + // for SGI machines with 32 bit clocks. mutable unsigned long _lastClockValue; mutable unsigned long long _rollOver; # endif @@ -129,15 +129,15 @@ class SG_EXPORT Timer { #define CLK(x) __asm__ volatile (".byte 0x0f, 0x31" : "=A" (x)) namespace osg{ - inline Timer_t Timer::tick() const - { - if (_useStandardClock) - return clock(); - else - { - Timer_t x;CLK(x);return x; - } - } + inline Timer_t Timer::tick() const + { + if (_useStandardClock) + return clock(); + else + { + Timer_t x;CLK(x);return x; + } + } } @@ -146,7 +146,7 @@ class SG_EXPORT Timer { #include #ifdef __ia64 - #define CLK(x) ((x)=0) + #define CLK(x) ((x)=0) #else #define CLK(x) __asm__ volatile (".byte 0x0f, 0x31" : "=A" (x)) #endif @@ -189,14 +189,18 @@ class SG_EXPORT Timer { if ( _clockAddress_64 ) return *_clockAddress_64; else - { - unsigned long clockValue = *_clockAddress_32; - if( _lastClockValue > clockValue ) - { - _rollOver += 0x100000000L; - } - _lastClockValue = clockValue; - return _rollOver + clockValue; + { + unsigned long clockValue = *_clockAddress_32; + if( _lastClockValue > clockValue ) + { + # ifdef __GNUC__ + _rollOver += 0x100000000LL; + #else + _rollOver += 0x100000000L; + #endif + } + _lastClockValue = clockValue; + return _rollOver + clockValue; } } } diff --git a/include/osgFX/Validator b/include/osgFX/Validator index ca1d4519b..90170212f 100644 --- a/include/osgFX/Validator +++ b/include/osgFX/Validator @@ -15,7 +15,7 @@ #ifndef OSGFX_VALIDATOR_ #define OSGFX_VALIDATOR_ -#include +#include #include #include @@ -25,9 +25,6 @@ namespace osgFX { - // forward declaration - class Effect; - /** This class is used internally by osgFX::Effect to choose between different techniques dynamically. The apply() method will call each technique's diff --git a/src/osg/Timer.cpp b/src/osg/Timer.cpp index 83d59e91a..1346b3584 100644 --- a/src/osg/Timer.cpp +++ b/src/osg/Timer.cpp @@ -88,7 +88,7 @@ const Timer* Timer::instance() if (sysctlbyname("machdep.tsc_freq", &cpuspeed, &len, NULL, NULL) == -1) { _useStandardClock = true; - perror("sysctlbyname(machdep.tsc_freq)"); + perror("sysctlbyname(machdep.tsc_freq)"); return; } @@ -106,7 +106,7 @@ const Timer* Timer::instance() Timer::Timer() { #ifdef __ia64 - _useStandardClock = true; + _useStandardClock = true; #else _useStandardClock = false; #endif @@ -125,17 +125,17 @@ const Timer* Timer::instance() while( fgets( buff, sizeof( buff ), fp ) > 0 ) { if( !strncmp( buff, "cpu MHz", strlen( "cpu MHz" ))) - { - char *ptr = buff; + { + char *ptr = buff; - while( ptr && *ptr != ':' ) ptr++; - if( ptr ) - { - ptr++; - sscanf( ptr, "%lf", &cpu_mhz ); - } - break; - } + while( ptr && *ptr != ':' ) ptr++; + if( ptr ) + { + ptr++; + sscanf( ptr, "%lf", &cpu_mhz ); + } + break; + } } fclose( fp ); @@ -160,7 +160,6 @@ const Timer* Timer::instance() #include #include #include - #include #include Timer::Timer( void ) @@ -232,26 +231,26 @@ const Timer* Timer::instance() #elif defined (__DARWIN_OSX__) || defined (macintosh) #if defined (__DARWIN_OSX__) - #include // do I really have to link against the Carbon framework just for this? - #else - #include - #include + #include // do I really have to link against the Carbon framework just for this? + #else + #include + #include #endif Timer::Timer( void ) { - _useStandardClock = false; - _secsPerTick = 1e-6; // Carbon timer's precision. + _useStandardClock = false; + _secsPerTick = 1e-6; // Carbon timer's precision. } Timer_t Timer::tick(void) const { - UnsignedWide usecs; - Microseconds(&usecs); + UnsignedWide usecs; + Microseconds(&usecs); - return (usecs.hi * 4294967296.0) + usecs.lo; + return (usecs.hi * 4294967296.0) + usecs.lo; } #elif defined(unix)