Added FREEGLUT_LIB_PRAGMAS to control MS library pragmas, and fixed NOMINMAX define.

git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@711 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
joekrahn 2006-09-26 03:18:18 +00:00
parent 98c7917ed8
commit 6273d5e17b
4 changed files with 44 additions and 36 deletions

View File

@ -35,19 +35,28 @@
/* /*
* Under windows, we have to differentiate between static and dynamic libraries * Under windows, we have to differentiate between static and dynamic libraries
*/ */
#if defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW32__) || defined(__WATCOMC__) #ifdef _WIN32
/* #pragma may not be supported by some compilers. /* #pragma may not be supported by some compilers.
* Discussion by FreeGLUT developers suggests that * Discussion by FreeGLUT developers suggests that
* Visual C++ specific code involving pragmas may * Visual C++ specific code involving pragmas may
* need to move to a separate header. 24th Dec 2003 * need to move to a separate header. 24th Dec 2003
*/ */
/* Define FREEGLUT_LIB_PRAGMAS to 1 to include library
* pragmas or to 1 to exclude library pragmas.
* The default behavior depends on the compiler/platform.
*/
# ifndef FREEGLUT_LIB_PRAGMAS
# if ( defined(_MSC_VER) || defined(__WATCOMC__) ) && !defined(_WIN32_WCE)
# define FREEGLUT_LIB_PRAGMAS 1
# else
# define FREEGLUT_LIB_PRAGMAS 0
# endif
# endif
# define WIN32_LEAN_AND_MEAN # define WIN32_LEAN_AND_MEAN
# define NO_MIN_MAX # define NOMINMAX
# include <windows.h> # include <Windows.h>
# undef min
# undef max
/* Windows static library */ /* Windows static library */
# ifdef FREEGLUT_STATIC # ifdef FREEGLUT_STATIC
@ -56,40 +65,35 @@
# define FGAPIENTRY # define FGAPIENTRY
/* Link with Win32 static freeglut lib */ /* Link with Win32 static freeglut lib */
# if defined(_MSC_VER) || defined(__WATCOMC__) # if FREEGLUT_LIB_PRAGMAS
# pragma comment (lib, "freeglut_static.lib") # pragma comment (lib, "freeglut_static.lib")
# endif # endif
/* Windows shared library (DLL) */ /* Windows shared library (DLL) */
# else # else
# define FGAPIENTRY __stdcall
# if defined(FREEGLUT_EXPORTS) # if defined(FREEGLUT_EXPORTS)
# define FGAPI __declspec(dllexport) # define FGAPI __declspec(dllexport)
# else # else
# define FGAPI __declspec(dllimport) # define FGAPI __declspec(dllimport)
/* link with Win32 shared freeglut lib */ /* Link with Win32 shared freeglut lib */
# if defined(_MSC_VER) || defined(__WATCOMC__) # if FREEGLUT_LIB_PRAGMAS
# ifndef _WIN32_WCE
# pragma comment (lib, "freeglut.lib") # pragma comment (lib, "freeglut.lib")
# endif # endif
# endif
# endif # endif
# define FGAPIENTRY __stdcall
# endif # endif
/* Drag in other Windows libraries as required by FreeGLUT */ /* Drag in other Windows libraries as required by FreeGLUT */
# if defined(_MSC_VER) || defined(__WATCOMC__) # if FREEGLUT_LIB_PRAGMAS
# ifndef _WIN32_WCE # pragma comment (lib, "glu32.lib") /* link OpenGL Utility lib */
# pragma comment (lib, "opengl32.lib") /* link Microsoft OpenGL lib */
# pragma comment (lib, "gdi32.lib") /* link Windows GDI lib */
# pragma comment (lib, "winmm.lib") /* link Windows MultiMedia lib */ # pragma comment (lib, "winmm.lib") /* link Windows MultiMedia lib */
# pragma comment (lib, "user32.lib") /* link Windows user lib */ # pragma comment (lib, "user32.lib") /* link Windows user lib */
# pragma comment (lib, "gdi32.lib") /* link Windows GDI lib */
# pragma comment (lib, "opengl32.lib") /* link Microsoft OpenGL lib */
# pragma comment (lib, "glu32.lib") /* link OpenGL Utility lib */
# endif /* _WIN32_WCE */
# endif # endif
#else #else

View File

@ -979,8 +979,8 @@ static void fghJoystickAddHatElement ( SFG_Joystick *joy, CFDictionaryRef button
/* Inspired by /* Inspired by
http://msdn.microsoft.com/archive/en-us/dnargame/html/msdn_sidewind3d.asp http://msdn.microsoft.com/archive/en-us/dnargame/html/msdn_sidewind3d.asp
*/ */
# if defined(_MSC_VER) # if FREEGLUT_LIB_PRAGMAS
# pragma comment (lib, "advapi32.lib") /* library pragmas are bad */ # pragma comment (lib, "advapi32.lib")
# endif # endif
static int fghJoystickGetOEMProductName ( SFG_Joystick* joy, char *buf, int buf_sz ) static int fghJoystickGetOEMProductName ( SFG_Joystick* joy, char *buf, int buf_sz )

View File

@ -503,7 +503,10 @@ int FGAPIENTRY glutDeviceGet( GLenum eWhat )
*/ */
#if defined(_WIN32_CE) #if defined(_WIN32_CE)
return ( GetKeyboardStatus() & KBDI_KEYBOARD_PRESENT ) ? 1 : 0; return ( GetKeyboardStatus() & KBDI_KEYBOARD_PRESENT ) ? 1 : 0;
# if FREEGLUT_LIB_PRAGMAS
# pragma comment (lib,"Kbdui.lib") # pragma comment (lib,"Kbdui.lib")
# endif
#else #else
return 1; return 1;
#endif #endif

View File

@ -29,8 +29,10 @@
#include "freeglut_internal.h" #include "freeglut_internal.h"
#if defined(_WIN32_WCE) #if defined(_WIN32_WCE)
#include <aygshell.h> # include <Aygshell.h>
#pragma comment( lib, "Aygshell.lib" ) /* library pragmas are bad */ # ifdef FREEGLUT_LIB_PRAGMAS
# pragma comment( lib, "Aygshell.lib" )
# endif
static wchar_t* fghWstrFromStr(const char* str) static wchar_t* fghWstrFromStr(const char* str)
{ {
@ -42,7 +44,6 @@ static wchar_t* fghWstrFromStr(const char* str)
return wstr; return wstr;
} }
#endif /* defined(_WIN32_WCE) */ #endif /* defined(_WIN32_WCE) */
/* /*