diff --git a/src/osgPlugins/txp/TrPageArchive.cpp b/src/osgPlugins/txp/TrPageArchive.cpp index 42996e1f5..3980f60b9 100644 --- a/src/osgPlugins/txp/TrPageArchive.cpp +++ b/src/osgPlugins/txp/TrPageArchive.cpp @@ -34,7 +34,7 @@ using namespace txp; using namespace osg; // disable 'this' used in base pointer initilialization.. -#if defined(WIN32) && !(defined(__CYGWIN__) || defined(__MINGW32__)) +#if defined(WIN32) && !defined(__GNUC__) #pragma warning( disable : 4355 ) #endif diff --git a/src/osgPlugins/txp/WaitBlock.h b/src/osgPlugins/txp/WaitBlock.h index 62b1d39f0..8d5236231 100644 --- a/src/osgPlugins/txp/WaitBlock.h +++ b/src/osgPlugins/txp/WaitBlock.h @@ -1,6 +1,7 @@ #ifndef WAIT_BLOCK_H #define WAIT_BLOCK_H -#ifndef WIN32 + +#if !defined(WIN32) || defined(__CYGWIN__) #include namespace osgTXP { diff --git a/src/osgPlugins/txp/trPagePageManager.cpp b/src/osgPlugins/txp/trPagePageManager.cpp index 552dd6f40..c57314be7 100644 --- a/src/osgPlugins/txp/trPagePageManager.cpp +++ b/src/osgPlugins/txp/trPagePageManager.cpp @@ -1,7 +1,11 @@ #include #include -#if defined(_WIN32) +#if defined(__CYGWIN__) +#include +#include +#include +#elif defined(_WIN32) #include #include #else @@ -124,7 +128,7 @@ void osgLockMutex(ThreadMutex &mtx) // --- Either thread --- void osgUnLockMutex(ThreadMutex &mtx) { -#if defined (_WIN32) +#if defined(_WIN32) && !defined(__CYGWIN__) ReleaseMutex(mtx); #else pthread_mutex_unlock( &mtx ); @@ -135,7 +139,7 @@ void osgUnLockMutex(ThreadMutex &mtx) // --- Either thread (only used in paging thread) --- void osgWaitEvent(ThreadEvent &ev) { -#if defined (_WIN32) +#if defined(_WIN32) && !defined(__CYGWIN__) WaitForSingleObject( ev, INFINITE); #else ev.wait(); @@ -146,7 +150,7 @@ void osgWaitEvent(ThreadEvent &ev) // --- Either thread (only used in main thread) --- void osgSetEvent(ThreadEvent &ev) { -#if defined (_WIN32) +#if defined(_WIN32) && !defined(__CYGWIN__) SetEvent(ev); #else ev.release(); @@ -156,7 +160,7 @@ void osgSetEvent(ThreadEvent &ev) // Windows specific thread function. // This just fires up our own loop // --- Paging Thread --- -#if defined (_WIN32) +#if defined(_WIN32) && !defined(__CYGWIN__) DWORD WINAPI ThreadFunc( LPVOID lpParam ) { OSGPageManager *myPager = (OSGPageManager *)lpParam; @@ -182,7 +186,7 @@ bool OSGPageManager::StartThread(ThreadMode mode,ThreadID &newThread) { positionValid = false; -#if defined(_WIN32) +#if defined(_WIN32) && !defined(__CYGWIN__) // Create the event we'll use to wake up the pager thread when the location changes locationChangeEvent = CreateEvent(NULL,false,false,"Location Change Event"); @@ -228,7 +232,7 @@ bool OSGPageManager::StartThread(ThreadMode mode,ThreadID &newThread) */ bool OSGPageManager::EndThread() { -#ifdef WIN32 +#ifdef _WIN32 #else // Need a handle to the thread ID here. //pthread_cancel( ?newThread? ); diff --git a/src/osgPlugins/txp/trPagePageManager.h b/src/osgPlugins/txp/trPagePageManager.h index 630e264d3..43f176a09 100644 --- a/src/osgPlugins/txp/trPagePageManager.h +++ b/src/osgPlugins/txp/trPagePageManager.h @@ -19,7 +19,7 @@ #include -#ifndef WIN32 +#if defined(__CYGWIN__) || !defined(WIN32) #include #endif @@ -50,7 +50,7 @@ namespace txp Fill this in for your specific platform. Should be water ID you use for threads. */ -#if defined(_WIN32) +#if defined(_WIN32) && !defined(__CYGWIN__) typedef HANDLE ThreadID; typedef HANDLE ThreadMutex; typedef HANDLE ThreadEvent; diff --git a/src/osgPlugins/txp/trpage_geom.cpp b/src/osgPlugins/txp/trpage_geom.cpp index 37faa7bda..6f0e3b5ee 100644 --- a/src/osgPlugins/txp/trpage_geom.cpp +++ b/src/osgPlugins/txp/trpage_geom.cpp @@ -29,7 +29,7 @@ #include -#if defined(_WIN32) +#if defined(_WIN32) && !defined(__CYGWIN__) #define ALIGNMENT_WORKAROUND false #else #define ALIGNMENT_WORKAROUND true diff --git a/src/osgPlugins/txp/trpage_read.h b/src/osgPlugins/txp/trpage_read.h index 8231d0ac0..dcf7f69c8 100644 --- a/src/osgPlugins/txp/trpage_read.h +++ b/src/osgPlugins/txp/trpage_read.h @@ -74,7 +74,7 @@ protected: private: // Note: Just how slow is a map<> anyway? // This usage is self-contained and could be replaced with an array -#if defined(_WIN32) +#if defined(_WIN32) && !defined(__CYGWIN__) typedef std::map tok_map; #else typedef std::map > tok_map; diff --git a/src/osgPlugins/txp/trpage_scene.h b/src/osgPlugins/txp/trpage_scene.h index 6d2e9b598..ae3015f34 100644 --- a/src/osgPlugins/txp/trpage_scene.h +++ b/src/osgPlugins/txp/trpage_scene.h @@ -203,7 +203,7 @@ protected: // {group:Demonstration Scene Graph} TX_EXDECL class TX_CLDECL trpgSceneGraphParser : public trpgSceneParser { public: -#if defined(_WIN32) +#if defined(_WIN32) && !defined(__CYGWIN__) typedef std::map GroupMap; #else typedef std::map > GroupMap; diff --git a/src/osgPlugins/txp/trpage_sys.h b/src/osgPlugins/txp/trpage_sys.h index bd0ac2a18..b52d54e15 100644 --- a/src/osgPlugins/txp/trpage_sys.h +++ b/src/osgPlugins/txp/trpage_sys.h @@ -38,18 +38,29 @@ #include #include +#if !defined(__GNUC__) // Microsoft Developer warnings that annoy me #pragma warning ( disable : 4251) #pragma warning ( disable : 4275) #pragma warning ( disable : 4786) +#endif // Somewhat system independent file deletion macro -#define TRPGDELETEFILE(file) DeleteFile((file)) +#ifdef __CYGWIN__ +# define TRPGDELETEFILE(file) remove((file)) +#else +# define TRPGDELETEFILE(file) DeleteFile((file)) +#endif #ifndef int64 -// 64 bit long value. Need this for really big files. -typedef __int64 int64; + // 64 bit long value. Need this for really big files. +#ifdef __GNUC__ + typedef long long int64; +#else + typedef __int64 int64; #endif +#endif + #else // Unix