Fixed building using MinGW

Our SDL_windows.h needed to be included before anything else so UNICODE is defined.
This commit is contained in:
Sam Lantinga 2013-10-17 23:02:29 -07:00
parent a2bd897064
commit 12ca3ce3fa
20 changed files with 62 additions and 38 deletions

View File

@ -20,6 +20,10 @@
*/ */
#include "SDL_config.h" #include "SDL_config.h"
#if defined(__WIN32__)
#include "core/windows/SDL_windows.h"
#endif
/* Initialization code for SDL */ /* Initialization code for SDL */
#include "SDL.h" #include "SDL.h"
@ -443,7 +447,6 @@ SDL_GetPlatform()
#if !defined(HAVE_LIBC) || (defined(__WATCOMC__) && defined(BUILD_DLL)) #if !defined(HAVE_LIBC) || (defined(__WATCOMC__) && defined(BUILD_DLL))
/* Need to include DllMain() on Watcom C for some reason.. */ /* Need to include DllMain() on Watcom C for some reason.. */
#include "core/windows/SDL_windows.h"
BOOL APIENTRY BOOL APIENTRY
_DllMainCRTStartup(HANDLE hModule, _DllMainCRTStartup(HANDLE hModule,

View File

@ -20,6 +20,10 @@
*/ */
#include "SDL_config.h" #include "SDL_config.h"
#if defined(__WIN32__)
#include "core/windows/SDL_windows.h"
#endif
#include "SDL.h" #include "SDL.h"
#include "SDL_atomic.h" #include "SDL_atomic.h"
#include "SDL_messagebox.h" #include "SDL_messagebox.h"
@ -29,8 +33,6 @@
#include "video/SDL_sysvideo.h" #include "video/SDL_sysvideo.h"
#ifdef __WIN32__ #ifdef __WIN32__
#include "core/windows/SDL_windows.h"
#ifndef WS_OVERLAPPEDWINDOW #ifndef WS_OVERLAPPEDWINDOW
#define WS_OVERLAPPEDWINDOW 0 #define WS_OVERLAPPEDWINDOW 0
#endif #endif

View File

@ -20,6 +20,10 @@
*/ */
#include "SDL_config.h" #include "SDL_config.h"
#if defined(__WIN32__)
#include "core/windows/SDL_windows.h"
#endif
/* Simple log messages in SDL */ /* Simple log messages in SDL */
#include "SDL_log.h" #include "SDL_log.h"
@ -28,9 +32,7 @@
#include <stdio.h> #include <stdio.h>
#endif #endif
#if defined(__WIN32__) #if defined(__ANDROID__)
#include "core/windows/SDL_windows.h"
#elif defined(__ANDROID__)
#include <android/log.h> #include <android/log.h>
#endif #endif

View File

@ -20,14 +20,14 @@
*/ */
#include "SDL_config.h" #include "SDL_config.h"
#ifdef __WIN32__
#include "../core/windows/SDL_windows.h"
#endif
#include "SDL_atomic.h" #include "SDL_atomic.h"
#include "SDL_mutex.h" #include "SDL_mutex.h"
#include "SDL_timer.h" #include "SDL_timer.h"
/* Don't do the check for Visual Studio 2005, it's safe here */
#ifdef __WIN32__
#include "../core/windows/SDL_windows.h"
#endif
/* This function is where all the magic happens... */ /* This function is where all the magic happens... */
SDL_bool SDL_bool

View File

@ -22,8 +22,8 @@
#ifdef __WIN32__ #ifdef __WIN32__
#include "SDL_error.h"
#include "SDL_windows.h" #include "SDL_windows.h"
#include "SDL_error.h"
#include "SDL_assert.h" #include "SDL_assert.h"
#include <objbase.h> /* for CoInitialize/CoUninitialize */ #include <objbase.h> /* for CoInitialize/CoUninitialize */

View File

@ -20,6 +20,10 @@
*/ */
#include "SDL_config.h" #include "SDL_config.h"
#if defined(__WIN32__)
#include "../core/windows/SDL_windows.h"
#endif
/* CPU feature detection for SDL */ /* CPU feature detection for SDL */
#include "SDL_cpuinfo.h" #include "SDL_cpuinfo.h"
@ -41,9 +45,6 @@
#include <signal.h> #include <signal.h>
#include <setjmp.h> #include <setjmp.h>
#endif #endif
#ifdef __WIN32__
#include "../core/windows/SDL_windows.h"
#endif
#define CPU_HAS_RDTSC 0x00000001 #define CPU_HAS_RDTSC 0x00000001
#define CPU_HAS_ALTIVEC 0x00000002 #define CPU_HAS_ALTIVEC 0x00000002

View File

@ -22,6 +22,11 @@
#define _LARGEFILE64_SOURCE #define _LARGEFILE64_SOURCE
#include "SDL_config.h" #include "SDL_config.h"
#if defined(__WIN32__)
#include "../core/windows/SDL_windows.h"
#endif
/* This file provides a general interface for SDL to read and write /* This file provides a general interface for SDL to read and write
data sources. It can easily be extended to files, memory, etc. data sources. It can easily be extended to files, memory, etc.
*/ */
@ -42,8 +47,6 @@
/* Functions to read/write Win32 API file pointers */ /* Functions to read/write Win32 API file pointers */
#include "../core/windows/SDL_windows.h"
#ifndef INVALID_SET_FILE_POINTER #ifndef INVALID_SET_FILE_POINTER
#define INVALID_SET_FILE_POINTER 0xFFFFFFFF #define INVALID_SET_FILE_POINTER 0xFFFFFFFF
#endif #endif

View File

@ -33,6 +33,11 @@
#include "../SDL_sysjoystick.h" #include "../SDL_sysjoystick.h"
#include "../SDL_joystick_c.h" #include "../SDL_joystick_c.h"
#ifdef REGSTR_VAL_JOYOEMNAME
#undef REGSTR_VAL_JOYOEMNAME
#endif
#define REGSTR_VAL_JOYOEMNAME "OEMName"
#define MAX_JOYSTICKS 16 #define MAX_JOYSTICKS 16
#define MAX_AXES 6 /* each joystick can have up to 6 axes */ #define MAX_AXES 6 /* each joystick can have up to 6 axes */
#define MAX_BUTTONS 32 /* and 32 buttons */ #define MAX_BUTTONS 32 /* and 32 buttons */
@ -45,7 +50,7 @@
/* array to hold joystick ID values */ /* array to hold joystick ID values */
static UINT SYS_JoystickID[MAX_JOYSTICKS]; static UINT SYS_JoystickID[MAX_JOYSTICKS];
static JOYCAPS SYS_Joystick[MAX_JOYSTICKS]; static JOYCAPSA SYS_Joystick[MAX_JOYSTICKS];
static char *SYS_JoystickName[MAX_JOYSTICKS]; static char *SYS_JoystickName[MAX_JOYSTICKS];
/* The private structure used to keep track of a joystick */ /* The private structure used to keep track of a joystick */
@ -148,7 +153,7 @@ SDL_SYS_JoystickInit(void)
int i; int i;
int maxdevs; int maxdevs;
JOYINFOEX joyinfo; JOYINFOEX joyinfo;
JOYCAPS joycaps; JOYCAPSA joycaps;
MMRESULT result; MMRESULT result;
/* Reset the joystick ID & name mapping tables */ /* Reset the joystick ID & name mapping tables */
@ -166,7 +171,7 @@ SDL_SYS_JoystickInit(void)
joyinfo.dwFlags = JOY_RETURNALL; joyinfo.dwFlags = JOY_RETURNALL;
result = joyGetPosEx(i, &joyinfo); result = joyGetPosEx(i, &joyinfo);
if (result == JOYERR_NOERROR) { if (result == JOYERR_NOERROR) {
result = joyGetDevCaps(i, &joycaps, sizeof(joycaps)); result = joyGetDevCapsA(i, &joycaps, sizeof(joycaps));
if (result == JOYERR_NOERROR) { if (result == JOYERR_NOERROR) {
SYS_JoystickID[SDL_SYS_numjoysticks] = i; SYS_JoystickID[SDL_SYS_numjoysticks] = i;
SYS_Joystick[SDL_SYS_numjoysticks] = joycaps; SYS_Joystick[SDL_SYS_numjoysticks] = joycaps;

View File

@ -7,12 +7,12 @@
#ifdef __WIN32__ #ifdef __WIN32__
/* Include this so we define UNICODE properly */
#include "../../core/windows/SDL_windows.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
/* Include the SDL main definition header */ /* Include the SDL main definition header */
#include "SDL.h" #include "SDL.h"
#include "SDL_main.h" #include "SDL_main.h"

View File

@ -22,7 +22,6 @@
#if SDL_VIDEO_RENDER_D3D && !SDL_RENDER_DISABLED #if SDL_VIDEO_RENDER_D3D && !SDL_RENDER_DISABLED
#include "../../core/windows/SDL_windows.h" #include "../../core/windows/SDL_windows.h"
#include "SDL_hints.h" #include "SDL_hints.h"

View File

@ -30,8 +30,8 @@ Andreas Schiffler -- aschiffler at ferzkopp dot net
*/ */
#include "SDL_config.h" #include "SDL_config.h"
#ifdef WIN32 #if defined(__WIN32__)
#include <windows.h> #include "../../core/windows/SDL_windows.h"
#endif #endif
#include <stdlib.h> #include <stdlib.h>

View File

@ -20,10 +20,13 @@
*/ */
#include "SDL_config.h" #include "SDL_config.h"
#if defined(__WIN32__)
#include "../core/windows/SDL_windows.h"
#endif
#include "SDL_stdinc.h" #include "SDL_stdinc.h"
#if !defined(SDL_setenv) && defined(__WIN32__) #if !defined(SDL_setenv) && defined(__WIN32__)
#include "../core/windows/SDL_windows.h"
/* Note this isn't thread-safe! */ /* Note this isn't thread-safe! */
static char *SDL_envmem = NULL; /* Ugh, memory leak */ static char *SDL_envmem = NULL; /* Ugh, memory leak */
static size_t SDL_envmemlen = 0; static size_t SDL_envmemlen = 0;

View File

@ -1107,10 +1107,10 @@ SDLTest_PrintEvent(SDL_Event * event)
case SDL_FINGERDOWN: case SDL_FINGERDOWN:
case SDL_FINGERUP: case SDL_FINGERUP:
fprintf(stderr, "Finger: %s touch=%lld, finger=%lld, x=%f, y=%f, dx=%f, dy=%f, pressure=%f", fprintf(stderr, "Finger: %s touch=%ld, finger=%ld, x=%f, y=%f, dx=%f, dy=%f, pressure=%f",
(event->type == SDL_FINGERDOWN) ? "down" : "up", (event->type == SDL_FINGERDOWN) ? "down" : "up",
(long long) event->tfinger.touchId, (long) event->tfinger.touchId,
(long long) event->tfinger.fingerId, (long) event->tfinger.fingerId,
event->tfinger.x, event->tfinger.y, event->tfinger.x, event->tfinger.y,
event->tfinger.dx, event->tfinger.dy, event->tfinger.pressure); event->tfinger.dx, event->tfinger.dy, event->tfinger.pressure);
break; break;

View File

@ -116,8 +116,8 @@ SDL_SYS_CreateThread(SDL_Thread * thread, void *args)
int int
SDL_SYS_CreateThread(SDL_Thread * thread, void *args) SDL_SYS_CreateThread(SDL_Thread * thread, void *args)
{ {
pfnSDL_CurrentBeginThread pfnBeginThread = _beginthreadex; pfnSDL_CurrentBeginThread pfnBeginThread = (pfnSDL_CurrentBeginThread)_beginthreadex;
pfnSDL_CurrentEndThread pfnEndThread = _endthreadex; pfnSDL_CurrentEndThread pfnEndThread = (pfnSDL_CurrentEndThread)_endthreadex;
#endif /* SDL_PASSED_BEGINTHREAD_ENDTHREAD */ #endif /* SDL_PASSED_BEGINTHREAD_ENDTHREAD */
pThreadStartParms pThreadParms = pThreadStartParms pThreadParms =
(pThreadStartParms) SDL_malloc(sizeof(tThreadStartParms)); (pThreadStartParms) SDL_malloc(sizeof(tThreadStartParms));

View File

@ -20,13 +20,13 @@
*/ */
#include "SDL_config.h" #include "SDL_config.h"
#include "SDL_thread.h"
#include "../SDL_thread_c.h"
#if SDL_THREAD_WINDOWS #if SDL_THREAD_WINDOWS
#include "../../core/windows/SDL_windows.h" #include "../../core/windows/SDL_windows.h"
#include "SDL_thread.h"
#include "../SDL_thread_c.h"
static DWORD thread_local_storage = TLS_OUT_OF_INDEXES; static DWORD thread_local_storage = TLS_OUT_OF_INDEXES;
static SDL_bool generic_local_storage = SDL_FALSE; static SDL_bool generic_local_storage = SDL_FALSE;

View File

@ -22,7 +22,11 @@
#if SDL_VIDEO_DRIVER_WINDOWS #if SDL_VIDEO_DRIVER_WINDOWS
#include "SDL.h" #if defined(__WIN32__)
#include "../../core/windows/SDL_windows.h"
#endif
#include "SDL_assert.h"
#include "SDL_windowsvideo.h" #include "SDL_windowsvideo.h"

View File

@ -23,10 +23,10 @@
#ifndef _SDL_windowsvideo_h #ifndef _SDL_windowsvideo_h
#define _SDL_windowsvideo_h #define _SDL_windowsvideo_h
#include "../SDL_sysvideo.h"
#include "../../core/windows/SDL_windows.h" #include "../../core/windows/SDL_windows.h"
#include "../SDL_sysvideo.h"
#if defined(_MSC_VER) #if defined(_MSC_VER)
#include <msctf.h> #include <msctf.h>
#else #else

View File

@ -22,6 +22,8 @@
#if SDL_VIDEO_DRIVER_WINDOWS #if SDL_VIDEO_DRIVER_WINDOWS
#include "../../core/windows/SDL_windows.h"
#include "SDL_assert.h" #include "SDL_assert.h"
#include "../SDL_sysvideo.h" #include "../SDL_sysvideo.h"
#include "../SDL_pixels_c.h" #include "../SDL_pixels_c.h"

2
test/configure vendored
View File

@ -3452,7 +3452,7 @@ rm -f core conftest.err conftest.$ac_objext \
rm -f conf.sdltest rm -f conf.sdltest
CFLAGS="$CFLAGS $SDL_CFLAGS" CFLAGS="$CFLAGS $SDL_CFLAGS"
LIBS="$LIBS $SDL_LIBS -lSDL2_test" LIBS="$LIBS -lSDL2_test $SDL_LIBS"
ac_ext=c ac_ext=c
ac_cpp='$CPP $CPPFLAGS' ac_cpp='$CPP $CPPFLAGS'

View File

@ -86,7 +86,7 @@ AM_PATH_SDL2($SDL_VERSION,
AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!]) AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])
) )
CFLAGS="$CFLAGS $SDL_CFLAGS" CFLAGS="$CFLAGS $SDL_CFLAGS"
LIBS="$LIBS $SDL_LIBS -lSDL2_test" LIBS="$LIBS -lSDL2_test $SDL_LIBS"
dnl Check for X11 path, needed for OpenGL on some systems dnl Check for X11 path, needed for OpenGL on some systems
AC_PATH_X AC_PATH_X