Changes to get SimGear to configure and compile out-of-the-box on

a MinGW target:

Link against alut.dll in addition to openal32.dll.

Remove some preprocessor defines from compiler.h that were
confusing the mingw and/or libstdc++ headers (I put the _isnan
one back in the only file it was used).

Hack a broken sleep() call into the OpenAL sample programs so
that they will compile (but not work) in a non-POSIX environment.

Change the header file ordering in sample_openal.hxx to get
around some really weird interactions between MinGW's windows.h
and the gcc iostream header.
This commit is contained in:
andy 2004-04-30 00:44:04 +00:00
parent 9f06c8df76
commit 86e83faef3
6 changed files with 22 additions and 13 deletions

View File

@ -275,7 +275,7 @@ case "${host}" in
*-*-cygwin* | *-*-mingw32*) *-*-cygwin* | *-*-mingw32*)
dnl CygWin under Windoze. dnl CygWin under Windoze.
LIBS="$LIBS -lopenal32 -lwinmm -ldsound -ldxguid -lole32" LIBS="$LIBS -lalut -lopenal32 -lwinmm -ldsound -ldxguid -lole32"
;; ;;
*-apple-darwin*) *-apple-darwin*)

View File

@ -149,13 +149,6 @@
#endif // __GNUC__ #endif // __GNUC__
#if defined( __MINGW32__ )
# define bcopy(from, to, n) memcpy(to, from, n)
# define FG_MEM_COPY(to,from,n) memcpy(to, from, n)
# define isnan _isnan
# define snprintf _snprintf
#endif
/* KAI C++ */ /* KAI C++ */
#if defined(__KCC) #if defined(__KCC)

View File

@ -41,6 +41,10 @@
#include "cloud.hxx" #include "cloud.hxx"
#if defined(_MSC_VER) || defined(__MINGW32__)
#define isnan(x) _isnan(x)
#endif
static ssgStateSelector *layer_states[SGCloudLayer::SG_MAX_CLOUD_COVERAGES]; static ssgStateSelector *layer_states[SGCloudLayer::SG_MAX_CLOUD_COVERAGES];
static bool state_initialized = false; static bool state_initialized = false;

View File

@ -1,5 +1,12 @@
#include <stdio.h> #include <stdio.h>
#ifdef __MINGW32__
// This is broken, but allows the file to compile without a POSIX
// environment.
static unsigned int sleep(unsigned int secs) { return 0; }
#else
#include <unistd.h> // sleep() #include <unistd.h> // sleep()
#endif
#if defined( __APPLE__ ) #if defined( __APPLE__ )
# define AL_ILLEGAL_ENUM AL_INVALID_ENUM # define AL_ILLEGAL_ENUM AL_INVALID_ENUM

View File

@ -1,5 +1,11 @@
#include <stdio.h> #include <stdio.h>
#ifdef __MINGW32__
// This is broken, but allows the file to compile without a POSIX
// environment.
static unsigned int sleep(unsigned int secs) { return 0; }
#else
#include <unistd.h> // sleep() #include <unistd.h> // sleep()
#endif
#include "sample_openal.hxx" #include "sample_openal.hxx"
#include "soundmgr_openal.hxx" #include "soundmgr_openal.hxx"

View File

@ -36,6 +36,10 @@
#include STL_STRING #include STL_STRING
#include <simgear/debug/logstream.hxx>
#include <plib/sg.h>
#if defined(__APPLE__) #if defined(__APPLE__)
# define AL_ILLEGAL_ENUM AL_INVALID_ENUM # define AL_ILLEGAL_ENUM AL_INVALID_ENUM
# define AL_ILLEGAL_COMMAND AL_INVALID_OPERATION # define AL_ILLEGAL_COMMAND AL_INVALID_OPERATION
@ -46,13 +50,8 @@
# include <AL/alut.h> # include <AL/alut.h>
#endif #endif
#include <plib/sg.h>
#include <simgear/debug/logstream.hxx>
SG_USING_STD(string); SG_USING_STD(string);
/** /**
* manages everything we need to know for an individual sound sample * manages everything we need to know for an individual sound sample
*/ */