Removed option to disable loading of winmm.

This commit is contained in:
Camilla Berglund 2014-08-15 14:50:41 +02:00
parent 2eb5ed33be
commit 82dc6c8b8f
5 changed files with 11 additions and 45 deletions

View File

@ -168,14 +168,7 @@ endif()
#-------------------------------------------------------------------- #--------------------------------------------------------------------
if (_GLFW_WIN32) if (_GLFW_WIN32)
set(GLFW_PKG_LIBS "${GLFW_PKG_LIBS} -lgdi32 -lwinmm") set(GLFW_PKG_LIBS "${GLFW_PKG_LIBS} -lgdi32")
# The DLL links against winmm; the static library loads it
# That way, both code paths receive testing
if (BUILD_SHARED_LIBS)
set(_GLFW_NO_DLOAD_WINMM 1)
list(APPEND glfw_LIBRARIES winmm)
endif()
if (GLFW_USE_DWM_SWAP_INTERVAL) if (GLFW_USE_DWM_SWAP_INTERVAL)
set(_GLFW_USE_DWM_SWAP_INTERVAL 1) set(_GLFW_USE_DWM_SWAP_INTERVAL 1)

View File

@ -87,6 +87,7 @@ GLFW bundles a number of dependencies in the `deps/` directory.
- [Cocoa] Bugfix: Joystick enumeration took hundreds of ms on some systems - [Cocoa] Bugfix: Joystick enumeration took hundreds of ms on some systems
- [Cocoa] Bugfix: The cursor was hidden when the user resized a GLFW window - [Cocoa] Bugfix: The cursor was hidden when the user resized a GLFW window
- [Win32] Enabled generation of pkg-config file for MinGW - [Win32] Enabled generation of pkg-config file for MinGW
- [Win32] Removed option to require explicitly linking against `winmm.dll`
- [Win32] Bugfix: Failure to load winmm or its functions was not reported to - [Win32] Bugfix: Failure to load winmm or its functions was not reported to
the error callback the error callback
- [Win32] Bugfix: Some keys were reported based on the current layout instead - [Win32] Bugfix: Some keys were reported based on the current layout instead

View File

@ -55,8 +55,6 @@
// Define this to 1 if building as a shared library / dynamic library / DLL // Define this to 1 if building as a shared library / dynamic library / DLL
#cmakedefine _GLFW_BUILD_DLL #cmakedefine _GLFW_BUILD_DLL
// Define this to 1 to disable dynamic loading of winmm
#cmakedefine _GLFW_NO_DLOAD_WINMM
// Define this to 1 if glfwSwapInterval should ignore DWM compositing status // Define this to 1 if glfwSwapInterval should ignore DWM compositing status
#cmakedefine _GLFW_USE_DWM_SWAP_INTERVAL #cmakedefine _GLFW_USE_DWM_SWAP_INTERVAL
// Define this to 1 to force use of high-performance GPU on Optimus systems // Define this to 1 to force use of high-performance GPU on Optimus systems

View File

@ -60,9 +60,6 @@ BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved)
// //
static GLboolean initLibraries(void) static GLboolean initLibraries(void)
{ {
#ifndef _GLFW_NO_DLOAD_WINMM
// winmm.dll (for joystick and timer support)
_glfw.win32.winmm.instance = LoadLibraryW(L"winmm.dll"); _glfw.win32.winmm.instance = LoadLibraryW(L"winmm.dll");
if (!_glfw.win32.winmm.instance) if (!_glfw.win32.winmm.instance)
{ {
@ -89,7 +86,6 @@ static GLboolean initLibraries(void)
"Win32: Failed to load winmm functions"); "Win32: Failed to load winmm functions");
return GL_FALSE; return GL_FALSE;
} }
#endif // _GLFW_NO_DLOAD_WINMM
_glfw.win32.user32.instance = LoadLibraryW(L"user32.dll"); _glfw.win32.user32.instance = LoadLibraryW(L"user32.dll");
if (_glfw.win32.user32.instance) if (_glfw.win32.user32.instance)
@ -114,13 +110,8 @@ static GLboolean initLibraries(void)
// //
static void terminateLibraries(void) static void terminateLibraries(void)
{ {
#ifndef _GLFW_NO_DLOAD_WINMM if (_glfw.win32.winmm.instance)
if (_glfw.win32.winmm.instance != NULL)
{
FreeLibrary(_glfw.win32.winmm.instance); FreeLibrary(_glfw.win32.winmm.instance);
_glfw.win32.winmm.instance = NULL;
}
#endif // _GLFW_NO_DLOAD_WINMM
if (_glfw.win32.user32.instance) if (_glfw.win32.user32.instance)
FreeLibrary(_glfw.win32.user32.instance); FreeLibrary(_glfw.win32.user32.instance);
@ -264,9 +255,6 @@ const char* _glfwPlatformGetVersionString(void)
#elif defined(__BORLANDC__) #elif defined(__BORLANDC__)
" BorlandC" " BorlandC"
#endif #endif
#if !defined(_GLFW_NO_DLOAD_WINMM)
" LoadLibrary(winmm)"
#endif
#if defined(_GLFW_BUILD_DLL) #if defined(_GLFW_BUILD_DLL)
" DLL" " DLL"
#endif #endif

View File

@ -110,26 +110,14 @@ typedef struct tagCHANGEFILTERSTRUCT
//======================================================================== //========================================================================
// winmm.dll function pointer typedefs // winmm.dll function pointer typedefs
#ifndef _GLFW_NO_DLOAD_WINMM typedef MMRESULT (WINAPI * JOYGETDEVCAPS_T)(UINT,LPJOYCAPS,UINT);
typedef MMRESULT (WINAPI * JOYGETDEVCAPS_T) (UINT,LPJOYCAPS,UINT); typedef MMRESULT (WINAPI * JOYGETPOS_T)(UINT,LPJOYINFO);
typedef MMRESULT (WINAPI * JOYGETPOS_T) (UINT,LPJOYINFO); typedef MMRESULT (WINAPI * JOYGETPOSEX_T)(UINT,LPJOYINFOEX);
typedef MMRESULT (WINAPI * JOYGETPOSEX_T) (UINT,LPJOYINFOEX); typedef DWORD (WINAPI * TIMEGETTIME_T)(void);
typedef DWORD (WINAPI * TIMEGETTIME_T) (void); #define _glfw_joyGetDevCaps _glfw.win32.winmm.joyGetDevCaps
#endif // _GLFW_NO_DLOAD_WINMM #define _glfw_joyGetPos _glfw.win32.winmm.joyGetPos
#define _glfw_joyGetPosEx _glfw.win32.winmm.joyGetPosEx
#define _glfw_timeGetTime _glfw.win32.winmm.timeGetTime
// winmm.dll shortcuts
#ifndef _GLFW_NO_DLOAD_WINMM
#define _glfw_joyGetDevCaps _glfw.win32.winmm.joyGetDevCaps
#define _glfw_joyGetPos _glfw.win32.winmm.joyGetPos
#define _glfw_joyGetPosEx _glfw.win32.winmm.joyGetPosEx
#define _glfw_timeGetTime _glfw.win32.winmm.timeGetTime
#else
#define _glfw_joyGetDevCaps joyGetDevCaps
#define _glfw_joyGetPos joyGetPos
#define _glfw_joyGetPosEx joyGetPosEx
#define _glfw_timeGetTime timeGetTime
#endif // _GLFW_NO_DLOAD_WINMM
// user32.dll function pointer typedefs // user32.dll function pointer typedefs
typedef BOOL (WINAPI * SETPROCESSDPIAWARE_T)(void); typedef BOOL (WINAPI * SETPROCESSDPIAWARE_T)(void);
@ -204,7 +192,6 @@ typedef struct _GLFWlibraryWin32
DWORD foregroundLockTimeout; DWORD foregroundLockTimeout;
char* clipboardString; char* clipboardString;
#ifndef _GLFW_NO_DLOAD_WINMM
// winmm.dll // winmm.dll
struct { struct {
HINSTANCE instance; HINSTANCE instance;
@ -213,7 +200,6 @@ typedef struct _GLFWlibraryWin32
JOYGETPOSEX_T joyGetPosEx; JOYGETPOSEX_T joyGetPosEx;
TIMEGETTIME_T timeGetTime; TIMEGETTIME_T timeGetTime;
} winmm; } winmm;
#endif // _GLFW_NO_DLOAD_WINMM
// user32.dll // user32.dll
struct { struct {