Updates for Cygwin port, from Norman Vine.
This commit is contained in:
@@ -5,14 +5,14 @@
|
||||
#ifndef OSG_EXPORT
|
||||
#define OSG_EXPORT 1
|
||||
|
||||
#ifdef WIN32
|
||||
#if defined(WIN32) && !(defined(__CYGWIN__) || defined(__MINGW32__))
|
||||
#pragma warning( disable : 4244 )
|
||||
#pragma warning( disable : 4251 )
|
||||
#pragma warning( disable : 4275 )
|
||||
#pragma warning( disable : 4786 )
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW32__)
|
||||
# ifdef SG_LIBRARY
|
||||
# define SG_EXPORT __declspec(dllexport)
|
||||
# else
|
||||
|
||||
@@ -24,6 +24,18 @@
|
||||
|
||||
#else
|
||||
|
||||
#if defined(__CYGWIN__) || defined(__MINGW32__)
|
||||
# ifndef APIENTRY
|
||||
# define GLUT_APIENTRY_DEFINED
|
||||
# define APIENTRY __stdcall
|
||||
# endif
|
||||
// XXX This is from Win32's <winnt.h>
|
||||
# ifndef CALLBACK
|
||||
# define CALLBACK __stdcall
|
||||
# endif
|
||||
|
||||
#else // ! __CYGWIN__
|
||||
|
||||
// Under windows avoid including <windows.h>
|
||||
// to avoid name space pollution, but Win32's <GL/gl.h>
|
||||
// needs APIENTRY and WINGDIAPI defined properly.
|
||||
@@ -49,17 +61,20 @@
|
||||
# define CALLBACK
|
||||
# endif
|
||||
# endif
|
||||
// XXX This is from Win32's <wingdi.h> and <winnt.h>
|
||||
# ifndef WINGDIAPI
|
||||
# define GLUT_WINGDIAPI_DEFINED
|
||||
# define WINGDIAPI __declspec(dllimport)
|
||||
# endif
|
||||
// XXX This is from Win32's <ctype.h>
|
||||
# ifndef _WCHAR_T_DEFINED
|
||||
typedef unsigned short wchar_t;
|
||||
# define _WCHAR_T_DEFINED
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#endif // __CYGWIN__
|
||||
|
||||
// XXX This is from Win32's <wingdi.h> and <winnt.h>
|
||||
# ifndef WINGDIAPI
|
||||
# define GLUT_WINGDIAPI_DEFINED
|
||||
# define WINGDIAPI __declspec(dllimport)
|
||||
# endif
|
||||
// XXX This is from Win32's <ctype.h>
|
||||
# ifndef _WCHAR_T_DEFINED
|
||||
typedef unsigned short wchar_t;
|
||||
# define _WCHAR_T_DEFINED
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#ifndef __gl_h_
|
||||
#include <GL/gl.h>
|
||||
|
||||
@@ -7,13 +7,9 @@
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#if defined(WIN32)
|
||||
// needed for _isnan & _finite used below.
|
||||
#include <float.h>
|
||||
#endif
|
||||
|
||||
#if defined(WIN32) || defined (macintosh)
|
||||
#include <float.h>
|
||||
#if !defined(__CYGWIN__)
|
||||
#define M_E 2.7182818284590452354
|
||||
#define M_LOG2E 1.4426950408889634074
|
||||
#define M_LOG10E 0.43429448190325182765
|
||||
@@ -27,6 +23,7 @@
|
||||
#define M_2_SQRTPI 1.12837916709551257390
|
||||
#define M_SQRT2 1.41421356237309504880
|
||||
#define M_SQRT1_2 0.70710678118654752440
|
||||
#endif // __CYGWIN__
|
||||
#endif
|
||||
|
||||
// PJA MAC OSX
|
||||
@@ -75,7 +72,7 @@ inline double inRadians(double angle) { return angle; }
|
||||
inline double DegreesToRadians(double angle) { return angle*M_PI/180.0; }
|
||||
inline double RadiansToDegrees(double angle) { return angle*180.0/M_PI; }
|
||||
|
||||
#ifdef WIN32
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
inline bool isNaN(float v) { return ::_isnan(v)!=0; }
|
||||
inline bool isNaN(double v) { return ::_isnan(v)!=0; }
|
||||
inline bool isInfinite(float v) { return !::_finite(v); }
|
||||
|
||||
@@ -10,9 +10,9 @@
|
||||
|
||||
namespace osg {
|
||||
|
||||
#ifdef WIN32
|
||||
#if defined(WIN32 ) && !defined(__CYGWIN__)
|
||||
typedef __int64 Timer_t;
|
||||
#elif defined(__linux) || defined(__FreeBSD__)
|
||||
#elif defined(__linux) || defined(__FreeBSD__) || defined(__CYGWIN__)
|
||||
typedef unsigned long long Timer_t;
|
||||
#elif defined(__sgi)
|
||||
typedef unsigned long long Timer_t;
|
||||
@@ -61,7 +61,7 @@ class SG_EXPORT Timer {
|
||||
|
||||
};
|
||||
|
||||
#ifdef WIN32
|
||||
#if defined(_WIN32) && !(defined(__CYGWIN__) || defined(__MINGW32__))
|
||||
#include <time.h>
|
||||
#pragma optimize("",off)
|
||||
|
||||
@@ -92,7 +92,7 @@ namespace osg{
|
||||
};
|
||||
#pragma optimize("",on)
|
||||
|
||||
#elif defined(__linux) || defined(__FreeBSD__)
|
||||
#elif defined(__linux) || defined(__FreeBSD__) || defined(__CYGWIN__) || defined(__MINGW32__)
|
||||
|
||||
#include <sys/time.h>
|
||||
|
||||
|
||||
@@ -5,15 +5,15 @@
|
||||
#ifndef OSGDB_EXPORT_
|
||||
#define OSGDB_EXPORT_ 1
|
||||
|
||||
#ifdef WIN32
|
||||
#pragma warning( disable : 4244 )
|
||||
#if defined(WIN32) && !(defined(__CYGWIN__) || defined(__MINGW32__))
|
||||
#pragma warning( disable : 4244 )
|
||||
#pragma warning( disable : 4251 )
|
||||
#pragma warning( disable : 4275 )
|
||||
#pragma warning( disable : 4786 )
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW32__)
|
||||
# ifdef OSGDB_LIBRARY
|
||||
# define OSGDB_EXPORT __declspec(dllexport)
|
||||
# else
|
||||
|
||||
@@ -6,14 +6,14 @@
|
||||
#ifndef OSGGLUT_EXPORT_
|
||||
#define OSGGLUT_EXPORT_ 1
|
||||
|
||||
#ifdef WIN32
|
||||
#pragma warning( disable : 4244 )
|
||||
#if defined(WIN32) && !(defined(__CYGWIN__) || defined(__MINGW32__))
|
||||
#pragma warning( disable : 4244 )
|
||||
#pragma warning( disable : 4251 )
|
||||
#pragma warning( disable : 4275 )
|
||||
#pragma warning( disable : 4786 )
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW32__)
|
||||
# ifdef OSGGLUT_LIBRARY
|
||||
# define OSGGLUT_EXPORT __declspec(dllexport)
|
||||
# else
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#ifndef OSGTEXT_EXPORT_
|
||||
#define OSGTEXT_EXPORT_ 1
|
||||
|
||||
#ifdef WIN32
|
||||
#if defined(WIN32) && !(defined(__CYGWIN__) || defined(__MINGW32__))
|
||||
#pragma warning( disable : 4244 )
|
||||
#pragma warning( disable : 4251 )
|
||||
#pragma warning( disable : 4275 )
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW32__)
|
||||
# ifdef OSGTEXT_LIBRARY
|
||||
# define OSGTEXT_EXPORT __declspec(dllexport)
|
||||
# else
|
||||
|
||||
@@ -6,14 +6,14 @@
|
||||
#ifndef OSGUTIL_EXPORT_
|
||||
#define OSGUTIL_EXPORT_ 1
|
||||
|
||||
#ifdef WIN32
|
||||
#pragma warning( disable : 4244 )
|
||||
#if defined(WIN32) && !(defined(__CYGWIN__) || defined(__MINGW32__))
|
||||
#pragma warning( disable : 4244 )
|
||||
#pragma warning( disable : 4251 )
|
||||
#pragma warning( disable : 4275 )
|
||||
#pragma warning( disable : 4786 )
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW32__)
|
||||
# ifdef OSGUTIL_LIBRARY
|
||||
# define OSGUTIL_EXPORT __declspec(dllexport)
|
||||
# else
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32) || defined(__CYGWIN__)
|
||||
#include <windows.h>
|
||||
#elif !defined macintosh
|
||||
#include <dlfcn.h>
|
||||
|
||||
@@ -26,7 +26,7 @@ bool osg::initNotifyLevel()
|
||||
g_NotifyInit = true;
|
||||
|
||||
// set up global notify null stream for inline notify
|
||||
#ifdef WIN32
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
g_NotifyNulStream = new std::ofstream ("nul");
|
||||
#else
|
||||
g_NotifyNulStream = new std::ofstream ("/dev/null");
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#ifdef WIN32
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
#include <Io.h>
|
||||
#include <Windows.h>
|
||||
#include <Winbase.h>
|
||||
@@ -25,7 +25,7 @@ DynamicLibrary::~DynamicLibrary()
|
||||
{
|
||||
if (_handle)
|
||||
{
|
||||
#ifdef WIN32
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
FreeLibrary((HMODULE)_handle);
|
||||
#elif !defined(macintosh)
|
||||
dlclose(_handle);
|
||||
@@ -39,7 +39,7 @@ DynamicLibrary* DynamicLibrary::loadLibrary(const std::string& libraryName)
|
||||
char* fullLibraryName = osgDB::findDSO( libraryName.c_str() );
|
||||
if (fullLibraryName==NULL) return NULL;
|
||||
|
||||
#ifdef WIN32
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
HANDLE handle = LoadLibrary( fullLibraryName );
|
||||
if (handle) return new DynamicLibrary(libraryName,handle);
|
||||
notify(WARN) << "DynamicLibrary::failed loading "<<fullLibraryName<<std::endl;
|
||||
@@ -55,7 +55,7 @@ DynamicLibrary* DynamicLibrary::loadLibrary(const std::string& libraryName)
|
||||
DynamicLibrary::PROC_ADDRESS DynamicLibrary::getProcAddress(const std::string& procName)
|
||||
{
|
||||
if (_handle==NULL) return NULL;
|
||||
#ifdef WIN32
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
return GetProcAddress( (HMODULE)_handle, procName.c_str() );
|
||||
#elif !defined(macintosh)
|
||||
return dlsym( _handle, procName.c_str() );
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#ifdef WIN32
|
||||
#if defined(WIN32) &&!defined(__CYGWIN__)
|
||||
#include <Io.h>
|
||||
#include <Windows.h>
|
||||
#include <Winbase.h>
|
||||
@@ -41,7 +41,7 @@ inline static char* strdup(const char *src)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#if defined(WIN32) &&!defined(__CYGWIN__)
|
||||
char *PathDelimitor = ";";
|
||||
static const char *s_default_file_path = ".;";
|
||||
static const char *s_default_dso_path = "C:/Windows/System/;";
|
||||
@@ -59,11 +59,15 @@ static char *s_filePath = ".:";
|
||||
#else
|
||||
char *PathDelimitor = ":";
|
||||
static const char *s_default_file_path = ".:";
|
||||
#if defined(__CYGWIN__)
|
||||
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 = ".:";
|
||||
#endif
|
||||
|
||||
#if defined (WIN32)
|
||||
#if defined(WIN32) &&!defined(__CYGWIN__)
|
||||
#define F_OK 4
|
||||
#endif
|
||||
|
||||
@@ -195,7 +199,7 @@ char *osgDB::findDSO( const char *name )
|
||||
{
|
||||
#ifndef macintosh
|
||||
|
||||
#ifdef __linux
|
||||
#if defined(__linux) || defined(__CYGWIN__)
|
||||
if( access( name, F_OK ) == 0 )
|
||||
{
|
||||
if (name[0]!='/')
|
||||
@@ -259,7 +263,7 @@ char *osgDB::findDSO( const char *name )
|
||||
}
|
||||
#endif
|
||||
|
||||
#elif WIN32
|
||||
#elif defined(WIN32)
|
||||
|
||||
if ((ptr = getenv( "PATH" )))
|
||||
{
|
||||
@@ -268,13 +272,13 @@ char *osgDB::findDSO( const char *name )
|
||||
strcat( path, ptr );
|
||||
}
|
||||
|
||||
#else
|
||||
#else
|
||||
if( (ptr = getenv( "LD_LIBRARY_PATH" )))
|
||||
{
|
||||
strcat( path, PathDelimitor );
|
||||
strcat( path, ptr );
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// check existance of dso assembled direct paths.
|
||||
char* fileFound = NULL;
|
||||
@@ -341,7 +345,7 @@ std::string osgDB::findFileInDirectory(const std::string& fileName,const std::st
|
||||
}
|
||||
|
||||
|
||||
#ifdef WIN32
|
||||
#if defined(WIN32) &&!defined(__CYGWIN__)
|
||||
|
||||
#include <io.h>
|
||||
#include <direct.h>
|
||||
|
||||
@@ -222,6 +222,7 @@ std::string Registry::createLibraryNameForExt(const std::string& ext)
|
||||
if (itr!=_extAliasMap.end()) return createLibraryNameForExt(itr->second);
|
||||
|
||||
#if defined(WIN32)
|
||||
// !! recheck evolving Cygwin DLL extension naming protocols !! NHV
|
||||
# ifdef _DEBUG
|
||||
return "osgdb_"+ext+"d.dll";
|
||||
# else
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#if !defined(WIN32) && !defined(macintosh)
|
||||
#if (!defined(WIN32) && !defined(macintosh)) || defined(__CYGWIN__)
|
||||
#include <unistd.h>
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
@@ -50,7 +50,7 @@
|
||||
|
||||
#include <osgGLUT/glut>
|
||||
|
||||
#ifdef WIN32
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
#include <sys/timeb.h>
|
||||
#else
|
||||
#endif
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// GeoSetBuilder.cpp
|
||||
|
||||
#ifdef WIN32
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
#pragma warning( disable : 4786 )
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Pool.cpp
|
||||
|
||||
#ifdef WIN32
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
#pragma warning( disable : 4786 )
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// ReaderWriterFLT.cpp
|
||||
|
||||
#ifdef WIN32
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
#pragma warning( disable : 4786 )
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef __FLT_REGISTRY_H
|
||||
#define __FLT_REGISTRY_H
|
||||
|
||||
#ifdef WIN32
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
#pragma warning( disable : 4786 )
|
||||
#endif
|
||||
|
||||
|
||||
@@ -6,6 +6,10 @@
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
namespace flt {
|
||||
|
||||
#define ENDIAN2(SRC, DST) endian2((void*)&(SRC), sizeof(SRC), (void*)&(DST), sizeof(DST))
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include <osgDB/FileUtils>
|
||||
#include <osgDB/FileNameUtils>
|
||||
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
#include <direct.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
@@ -40,7 +40,7 @@ class sgReaderWriterOSGTGZ : public osgDB::ReaderWriter
|
||||
char dirname[128];
|
||||
char command[1024];
|
||||
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
sprintf( dirname, "C:/Windows/Temp/.osgdb_osgtgz");
|
||||
// note, the following C option under windows does not seem to work...
|
||||
// will pursue an better tar.exe later. RO.
|
||||
@@ -50,7 +50,7 @@ class sgReaderWriterOSGTGZ : public osgDB::ReaderWriter
|
||||
mkdir( dirname);
|
||||
#endif
|
||||
|
||||
#ifdef __linux
|
||||
#if defined(__linux) || defined(__CYGWIN__)
|
||||
sprintf( dirname, "/tmp/.osg%06d", getpid());
|
||||
sprintf( command,
|
||||
"tar xfCz %s %s",
|
||||
@@ -86,7 +86,7 @@ class sgReaderWriterOSGTGZ : public osgDB::ReaderWriter
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
// note, is this the right command for windows?
|
||||
// is there any way of overiding the Y/N option? RO.
|
||||
sprintf( command, "erase %s", dirname );
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include <osgDB/FileNameUtils>
|
||||
#include <osgDB/Registry>
|
||||
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
#include <direct.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
@@ -41,7 +41,7 @@ class ReaderWriterTGZ : public osgDB::ReaderWriter
|
||||
char dirname[128];
|
||||
char command[1024];
|
||||
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
strcpy(dirname, "C:/Windows/Temp/.osgdb_tgz");
|
||||
mkdir( dirname);
|
||||
// note, the following C option under windows does not seem to work...
|
||||
@@ -51,7 +51,7 @@ class ReaderWriterTGZ : public osgDB::ReaderWriter
|
||||
fileName.c_str(), dirname );
|
||||
#endif
|
||||
|
||||
#ifdef __linux
|
||||
#if defined(__linux) || defined(__CYGWIN__)
|
||||
sprintf( dirname, "/tmp/.tgz%06d", getpid());
|
||||
mkdir( dirname, 0700 );
|
||||
sprintf( command,
|
||||
@@ -94,7 +94,7 @@ class ReaderWriterTGZ : public osgDB::ReaderWriter
|
||||
// restorre original state of the automatic generation of images to geode's.
|
||||
osgDB::Registry::instance()->setCreateNodeFromImage(prevCreateNodeFromImage);
|
||||
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
// note, is this the right command for windows?
|
||||
// is there any way of overiding the Y/N option? RO.
|
||||
sprintf( command, "erase %s", dirname );
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include <osgDB/FileNameUtils>
|
||||
#include <osgDB/Registry>
|
||||
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
#include <direct.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
@@ -40,7 +40,7 @@ class ReaderWriterZIP : public osgDB::ReaderWriter
|
||||
char dirname[128];
|
||||
char command[1024];
|
||||
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
strcpy(dirname, "C:/Windows/Temp/.osgdb_zip");
|
||||
mkdir(dirname);
|
||||
sprintf( command,
|
||||
@@ -83,7 +83,7 @@ class ReaderWriterZIP : public osgDB::ReaderWriter
|
||||
|
||||
osgDB::Registry::instance()->setCreateNodeFromImage(prevCreateNodeFromImage);
|
||||
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
// note, is this the right command for windows?
|
||||
// is there any way of overiding the Y/N option? RO.
|
||||
sprintf( command, "erase %s", dirname );
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
typedef int WORD;
|
||||
typedef int nvWORD;
|
||||
typedef unsigned int UINT;
|
||||
|
||||
struct MyVertex
|
||||
@@ -165,7 +165,7 @@ typedef std::list <NvFaceInfo*> NvFaceInfoList;
|
||||
typedef std::list <NvFaceInfoVec*> NvStripList;
|
||||
typedef std::vector<NvEdgeInfo*> NvEdgeInfoVec;
|
||||
|
||||
typedef std::vector<WORD> WordVec;
|
||||
typedef std::vector<nvWORD> WordVec;
|
||||
typedef std::vector<MyVertex> MyVertexVec;
|
||||
typedef std::vector<MyFace> MyFaceVec;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user