Changes for Cygwin build, sent in by Norman Vine.

This commit is contained in:
Robert Osfield 2002-05-28 11:40:37 +00:00
parent 165cc1bf42
commit e73d4ca5b3
15 changed files with 85 additions and 80 deletions

View File

@ -5,7 +5,7 @@
#ifndef OSG_EXPORT #ifndef OSG_EXPORT
#define OSG_EXPORT 1 #define OSG_EXPORT 1
#if defined(WIN32) && !(defined(__CYGWIN__) || defined(__MINGW32__)) #if defined(_MSC_VER)
#pragma warning( disable : 4244 ) #pragma warning( disable : 4244 )
#pragma warning( disable : 4251 ) #pragma warning( disable : 4251 )
#pragma warning( disable : 4275 ) #pragma warning( disable : 4275 )

View File

@ -8,7 +8,7 @@
#include <osg/Export> #include <osg/Export>
#if defined(WIN32 ) && !(defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MWERKS__)) #if defined(_MSC_VER)
namespace osg { namespace osg {
typedef __int64 Timer_t; typedef __int64 Timer_t;
} }
@ -73,41 +73,44 @@ class SG_EXPORT Timer {
} }
#if defined(_WIN32) && !(defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MWERKS__)) #if defined(_MSC_VER)
#include <time.h> #include <time.h>
#pragma optimize("",off) #pragma optimize("",off)
namespace osg{ namespace osg{
inline Timer_t Timer::tick( void ) const inline Timer_t Timer::tick( void ) const
{
if (_useStandardClock) return clock();
volatile Timer_t ts;
volatile unsigned int HighPart;
volatile unsigned int LowPart;
_asm
{ {
xor eax, eax // Used when QueryPerformanceCounter() if (_useStandardClock) return clock();
xor edx, edx // not supported or minimal overhead
_emit 0x0f // desired volatile Timer_t ts;
_emit 0x31 // volatile unsigned int HighPart;
mov HighPart,edx volatile unsigned int LowPart;
mov LowPart,eax _asm
{
xor eax, eax // Used when QueryPerformanceCounter()
xor edx, edx // not supported or minimal overhead
_emit 0x0f // desired
_emit 0x31 //
mov HighPart,edx
mov LowPart,eax
}
//ts = LowPart | HighPart >> 32;
*((unsigned int*)&ts) = LowPart;
*((unsigned int*)&ts+1) = HighPart;
return ts;
} }
//ts = LowPart | HighPart >> 32;
*((unsigned int*)&ts) = LowPart;
*((unsigned int*)&ts+1) = HighPart;
return ts;
} }
}
#pragma optimize("",on) #pragma optimize("",on)
#elif defined(__MINGW32__)
#include <sys/time.h>
#define CLK(x) __asm__ volatile (".byte 0x0f, 0x31" : "=A" (x)) #elif defined(__MINGW32__)
namespace osg{
#include <sys/time.h>
#define CLK(x) __asm__ volatile (".byte 0x0f, 0x31" : "=A" (x))
namespace osg{
inline Timer_t Timer::tick() const inline Timer_t Timer::tick() const
{ {
@ -119,72 +122,73 @@ namespace osg{
} }
} }
} }
#elif defined(__linux) || defined(__FreeBSD__) || defined(__CYGWIN__) #elif defined(__linux) || defined(__FreeBSD__) || defined(__CYGWIN__)
#include <sys/time.h> #include <sys/time.h>
#define CLK(x) __asm__ volatile (".byte 0x0f, 0x31" : "=A" (x)) #define CLK(x) __asm__ volatile (".byte 0x0f, 0x31" : "=A" (x))
namespace osg{ namespace osg{
inline Timer_t Timer::tick() const inline Timer_t Timer::tick() const
{
if (_useStandardClock)
{ {
struct timeval tv; if (_useStandardClock)
gettimeofday(&tv, NULL); {
return ((osg::Timer_t)tv.tv_sec)*1000000+(osg::Timer_t)tv.tv_usec; struct timeval tv;
} gettimeofday(&tv, NULL);
else return ((osg::Timer_t)tv.tv_sec)*1000000+(osg::Timer_t)tv.tv_usec;
{ }
Timer_t x;CLK(x);return x; else
{
Timer_t x;CLK(x);return x;
}
} }
} }
}
#elif defined(__sgi) #elif defined(__sgi)
#include <sys/time.h> #include <sys/time.h>
namespace osg{ namespace osg{
inline Timer_t Timer::tick() const inline Timer_t Timer::tick() const
{
if (_useStandardClock)
{ {
struct timeval tv; if (_useStandardClock)
gettimeofday(&tv, NULL); {
return ((osg::Timer_t)tv.tv_sec)*1000000+(osg::Timer_t)tv.tv_usec; struct timeval tv;
} gettimeofday(&tv, NULL);
else return ((osg::Timer_t)tv.tv_sec)*1000000+(osg::Timer_t)tv.tv_usec;
{ }
return *_clockAddress; else
{
return *_clockAddress;
}
} }
} }
}
#elif defined(unix) #elif defined(unix)
#include <sys/time.h> #include <sys/time.h>
namespace osg{ namespace osg{
inline Timer_t Timer::tick() const inline Timer_t Timer::tick() const
{ {
struct timeval tv; struct timeval tv;
gettimeofday(&tv, NULL); gettimeofday(&tv, NULL);
return ((osg::Timer_t)tv.tv_sec)*1000000+(osg::Timer_t)tv.tv_usec; return ((osg::Timer_t)tv.tv_sec)*1000000+(osg::Timer_t)tv.tv_usec;
}
} }
}
#elif !defined (__DARWIN_OSX__) && !defined (macintosh) #elif !defined (__DARWIN_OSX__) && !defined (macintosh)
// no choice, always use std::clock() // no choice, always use std::clock()
namespace osg{ namespace osg{
inline Timer_t Timer::tick( void ) const { return std::clock(); } inline Timer_t Timer::tick( void ) const { return std::clock(); }
} }
#endif #endif

View File

@ -5,7 +5,7 @@
#ifndef OSGDB_EXPORT_ #ifndef OSGDB_EXPORT_
#define OSGDB_EXPORT_ 1 #define OSGDB_EXPORT_ 1
#if defined(WIN32) && !(defined(__CYGWIN__) || defined(__MINGW32__)) #if defined(_MSC_VER)
#pragma warning( disable : 4244 ) #pragma warning( disable : 4244 )
#pragma warning( disable : 4251 ) #pragma warning( disable : 4251 )
#pragma warning( disable : 4275 ) #pragma warning( disable : 4275 )

View File

@ -5,7 +5,7 @@
#ifndef OSGTEXT_EXPORT_ #ifndef OSGTEXT_EXPORT_
#define OSGTEXT_EXPORT_ 1 #define OSGTEXT_EXPORT_ 1
#if defined(WIN32) && !(defined(__CYGWIN__) || defined(__MINGW32__)) #if defined(_MSC_VER)
#pragma warning( disable : 4244 ) #pragma warning( disable : 4244 )
#pragma warning( disable : 4251 ) #pragma warning( disable : 4251 )
#pragma warning( disable : 4275 ) #pragma warning( disable : 4275 )

View File

@ -6,7 +6,7 @@
#ifndef OSGUTIL_EXPORT_ #ifndef OSGUTIL_EXPORT_
#define OSGUTIL_EXPORT_ 1 #define OSGUTIL_EXPORT_ 1
#if defined(WIN32) && !(defined(__CYGWIN__) || defined(__MINGW32__)) #if defined(_MSC_VER)
#pragma warning( disable : 4244 ) #pragma warning( disable : 4244 )
#pragma warning( disable : 4251 ) #pragma warning( disable : 4251 )
#pragma warning( disable : 4275 ) #pragma warning( disable : 4275 )

View File

@ -1,4 +1,4 @@
#ifdef WIN32 #ifdef _MSC_VER
#include <Windows.h> #include <Windows.h>
#pragma warning( disable : 4244 ) #pragma warning( disable : 4244 )
#endif #endif

View File

@ -9,7 +9,7 @@
#include <osgDB/ReadFile> #include <osgDB/ReadFile>
#ifdef WIN32 #ifdef _MSC_VER
#pragma warning( disable : 4244 ) #pragma warning( disable : 4244 )
#pragma warning( disable : 4305 ) #pragma warning( disable : 4305 )
#endif #endif

View File

@ -11,7 +11,7 @@
#include <osgDB/ReadFile> #include <osgDB/ReadFile>
#ifdef WIN32 #ifdef _MSC_VER
#pragma warning( disable : 4244 ) #pragma warning( disable : 4244 )
#pragma warning( disable : 4305 ) #pragma warning( disable : 4305 )
#endif #endif

View File

@ -13,7 +13,7 @@
#include "hat.h" #include "hat.h"
#ifdef WIN32 #ifdef _MSC_VER
#pragma warning( disable : 4244 ) #pragma warning( disable : 4244 )
#pragma warning( disable : 4305 ) #pragma warning( disable : 4305 )
#endif #endif

View File

@ -297,7 +297,7 @@ void Image::scaleImage(const int s,const int t,const int r)
if (!newData) if (!newData)
{ {
// should we throw an exception??? Just return for time being. // should we throw an exception??? Just return for time being.
notify(FATAL) << "Error Image::scaleImage() do not succeed : out of memory."<<std::endl; notify(FATAL) << "Error Image::scaleImage() do not succeed : out of memory."<<newTotalSize<<std::endl;
return; return;
} }

View File

@ -24,14 +24,15 @@ char *PathDelimitor = ":";
static const char *s_default_file_path = ".:"; static const char *s_default_file_path = ".:";
static const char *s_default_dso_path = "/usr/lib32/:/usr/local/lib32/"; static const char *s_default_dso_path = "/usr/lib32/:/usr/local/lib32/";
static char *s_filePath = ".:"; static char *s_filePath = ".:";
#elif defined(__CYGWIN__)
char *PathDelimitor = ":";
static const char *s_default_file_path = ".:";
static const char *s_default_dso_path = "/usr/bin/:/usr/local/bin/:";
static char *s_filePath = ".:";
#else #else
char *PathDelimitor = ":"; char *PathDelimitor = ":";
static const char *s_default_file_path = ".:"; static const char *s_default_file_path = ".:";
#if defined(__CYGWIN__)
static const char *s_default_dso_path = "/usr/lib/:/usr/local/lib/:"; static const char *s_default_dso_path = "/usr/lib/:/usr/local/lib/:";
#else
static const char *s_default_dso_path = "/usr/lib/:/usr/local/lib/:";
#endif // __CYGWIN__
static char *s_filePath = ".:"; static char *s_filePath = ".:";
#endif #endif

View File

@ -1,6 +1,6 @@
// Pool.cpp // Pool.cpp
#if defined(WIN32) && !defined(__CYGWIN__) #if defined(_MSC_VER)
#pragma warning( disable : 4786 ) #pragma warning( disable : 4786 )
#endif #endif

View File

@ -1,6 +1,6 @@
// ReaderWriterFLT.cpp // ReaderWriterFLT.cpp
#if defined(WIN32) && !defined(__CYGWIN__) #if defined(_MSC_VER)
#pragma warning( disable : 4786 ) #pragma warning( disable : 4786 )
#endif #endif

View File

@ -2,7 +2,7 @@
#define __FTGL__ #define __FTGL__
#ifdef WIN32 #ifdef _MSC_VER
// stl stuff // stl stuff
#pragma warning( disable : 4244 ) #pragma warning( disable : 4244 )
#pragma warning( disable : 4251 ) #pragma warning( disable : 4251 )

View File

@ -34,7 +34,7 @@ using namespace osgText;
#if defined(__linux) || defined(__FreeBSD__) || defined (__sgi) || defined (__DARWIN_OSX__) #if defined(__linux) || defined(__FreeBSD__) || defined (__sgi) || defined (__DARWIN_OSX__)
static char* s_FontFilePath = ".:/usr/share/fonts/ttf:/usr/share/fonts/ttf/western:/usr/share/fonts/ttf/decoratives"; static char* s_FontFilePath = ".:/usr/share/fonts/ttf:/usr/share/fonts/ttf/western:/usr/share/fonts/ttf/decoratives";
#elif defined(WIN32) #elif defined(WIN32)
static char* s_FontFilePath = ".;C:/windows/fonts"; static char* s_FontFilePath = ".;C:/winnt/fonts;C:/windows/fonts";
#else #else
static char* s_FontFilePath = ".:"; static char* s_FontFilePath = ".:";
#endif #endif