Updates for Cygwin port, from Norman Vine.

This commit is contained in:
Robert Osfield
2002-01-03 21:34:57 +00:00
parent ba8c009219
commit e3ad8a87ee
23 changed files with 88 additions and 67 deletions

View File

@@ -1,4 +1,4 @@
#ifdef _WIN32
#if defined(_WIN32) || defined(__CYGWIN__)
#include <windows.h>
#elif !defined macintosh
#include <dlfcn.h>

View File

@@ -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");

View File

@@ -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() );

View File

@@ -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>

View File

@@ -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

View File

@@ -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

View File

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

View File

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

View File

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

View File

@@ -1,7 +1,7 @@
#ifndef __FLT_REGISTRY_H
#define __FLT_REGISTRY_H
#ifdef WIN32
#if defined(WIN32) && !defined(__CYGWIN__)
#pragma warning( disable : 4786 )
#endif

View File

@@ -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))

View File

@@ -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 );

View File

@@ -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 );

View File

@@ -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 );

View File

@@ -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;