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,61 +35,65 @@
/*
* 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.
* Discussion by FreeGLUT developers suggests that
* Visual C++ specific code involving pragmas may
* 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 NO_MIN_MAX
# include <windows.h>
# undef min
# undef max
# define NOMINMAX
# include <Windows.h>
/* Windows static library */
# ifdef FREEGLUT_STATIC
# define FGAPI
# define FGAPIENTRY
# define FGAPI
# define FGAPIENTRY
/* Link with Win32 static freeglut lib */
# if defined(_MSC_VER) || defined(__WATCOMC__)
# if FREEGLUT_LIB_PRAGMAS
# pragma comment (lib, "freeglut_static.lib")
# endif
/* Windows shared library (DLL) */
# else
# if defined(FREEGLUT_EXPORTS)
# define FGAPI __declspec(dllexport)
# else
# define FGAPI __declspec(dllimport)
# define FGAPIENTRY __stdcall
# if defined(FREEGLUT_EXPORTS)
# define FGAPI __declspec(dllexport)
# else
# define FGAPI __declspec(dllimport)
/* link with Win32 shared freeglut lib */
# if defined(_MSC_VER) || defined(__WATCOMC__)
# ifndef _WIN32_WCE
# pragma comment (lib, "freeglut.lib")
# endif
# endif
/* Link with Win32 shared freeglut lib */
# if FREEGLUT_LIB_PRAGMAS
# pragma comment (lib, "freeglut.lib")
# endif
# endif
# define FGAPIENTRY __stdcall
# endif
/* Drag in other Windows libraries as required by FreeGLUT */
# if defined(_MSC_VER) || defined(__WATCOMC__)
# ifndef _WIN32_WCE
# pragma comment (lib, "winmm.lib") /* link Windows MultiMedia 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 */
# if FREEGLUT_LIB_PRAGMAS
# 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, "user32.lib") /* link Windows user lib */
# endif
#else

View File

@ -979,8 +979,8 @@ static void fghJoystickAddHatElement ( SFG_Joystick *joy, CFDictionaryRef button
/* Inspired by
http://msdn.microsoft.com/archive/en-us/dnargame/html/msdn_sidewind3d.asp
*/
# if defined(_MSC_VER)
# pragma comment (lib, "advapi32.lib") /* library pragmas are bad */
# if FREEGLUT_LIB_PRAGMAS
# pragma comment (lib, "advapi32.lib")
# endif
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)
return ( GetKeyboardStatus() & KBDI_KEYBOARD_PRESENT ) ? 1 : 0;
# pragma comment (lib,"Kbdui.lib")
# if FREEGLUT_LIB_PRAGMAS
# pragma comment (lib,"Kbdui.lib")
# endif
#else
return 1;
#endif

View File

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