update CMake file so that it will generate proper _WIN32_WINNT and WINVER definitions in visual studio project setting.

This commit is contained in:
Jinrong Xie 2015-05-25 16:30:00 -07:00
parent 16bc907735
commit 96e89316b6
4 changed files with 52 additions and 7 deletions

View File

@ -233,11 +233,23 @@ IF(WIN32)
SET( CMAKE_DEBUG_POSTFIX "d" )
ENDIF(MSVC)
IF(NOT(MSVC_VERSION LESS "1300"))
# minimum requirement for spaceball device
ADD_DEFINITIONS(-D_WIN32_WINNT=0x0501)
ADD_DEFINITIONS(-DWINVER=0x0501)
ELSE()
# enable the use of Win2000 APIs (needed for really old compilers like MSVC6)
ADD_DEFINITIONS(-D_WIN32_WINNT=0x0500)
ADD_DEFINITIONS(-DWINVER=0x0500)
ENDIF()
IF(NOT(MSVC_VERSION LESS "1600"))
# minimum requirement for WM_TOUCH device
ADD_DEFINITIONS(-D_WIN32_WINNT=0x0601)
ADD_DEFINITIONS(-DWINVER=0x0601)
ENDIF()
ENDIF()
IF(CMAKE_COMPILER_IS_GNUCC)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
IF(NOT(ANDROID OR BLACKBERRY))

View File

@ -7,9 +7,12 @@
* magellan X-based protocol.
*/
#include <GL/freeglut.h>
#include "fg_internal.h"
#if(_WIN32_WINNT >= 0x0501)
/* -- PRIVATE FUNCTIONS --------------------------------------------------- */
extern void fgPlatformInitializeSpaceball(void);
@ -28,13 +31,12 @@ void fgInitialiseSpaceball(void)
}
fgPlatformInitializeSpaceball();
//sball_initialized = 1;
}
void fgSpaceballClose(void)
{
fgPlatformSpaceballClose();}
fgPlatformSpaceballClose();
}
int fgHasSpaceball(void)
{
@ -74,3 +76,28 @@ void fgSpaceballSetWindow(SFG_Window *window)
fgPlatformSpaceballSetWindow(window);
}
#else
void fgInitialiseSpaceball(void)
{
}
void fgSpaceballClose(void)
{
}
int fgHasSpaceball(void)
{
return 0;
}
int fgSpaceballNumButtons(void)
{
return 0;
}
void fgSpaceballSetWindow(SFG_Window *window)
{
}
#endif

View File

@ -1543,14 +1543,16 @@ LRESULT CALLBACK fgPlatformWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPAR
break;
}
#endif
//Added by Jinrong Xie <stonexjr at gmail.com> 12/24/2014
//for SpaceNavigator support on Windows.
#ifdef WM_INPUT
case WM_INPUT:
/* Added by Jinrong Xie <stonexjr at gmail.com> for SpaceNavigator support on Windows. Dec 2014 */
if (fgHasSpaceball())
{
fgSpaceballHandleWinEvent(hWnd, wParam, lParam);
}
break;
#endif
default:
/* Handle unhandled messages */
lRet = DefWindowProc( hWnd, uMsg, wParam, lParam );

View File

@ -36,6 +36,8 @@
* six degree of freedom navigator.
*/
#if(_WIN32_WINNT >= 0x0501)
#include <GL/freeglut.h>
#include <stdlib.h>
#include "../fg_internal.h"
@ -190,3 +192,5 @@ void fgSpaceballHandleWinEvent(HWND hwnd, WPARAM wParam, LPARAM lParam)
}
}
}
#endif