Fixed building using MinGW
authorSam Lantinga <slouken@libsdl.org>
Thu, 17 Oct 2013 23:02:29 -0700
changeset 78281451063c8ecd
parent 7827 a03ec8de0426
child 7829 dd58730c3b4c
Fixed building using MinGW
Our SDL_windows.h needed to be included before anything else so UNICODE is defined.
src/SDL.c
src/SDL_assert.c
src/SDL_log.c
src/atomic/SDL_spinlock.c
src/core/windows/SDL_windows.c
src/cpuinfo/SDL_cpuinfo.c
src/file/SDL_rwops.c
src/joystick/windows/SDL_mmjoystick.c
src/main/windows/SDL_windows_main.c
src/render/direct3d/SDL_render_d3d.c
src/render/software/SDL_rotate.c
src/stdlib/SDL_getenv.c
src/test/SDL_test_common.c
src/thread/windows/SDL_systhread.c
src/thread/windows/SDL_systls.c
src/video/windows/SDL_windowsmessagebox.c
src/video/windows/SDL_windowsvideo.h
src/video/windows/SDL_windowswindow.c
test/configure
test/configure.in
     1.1 --- a/src/SDL.c	Fri Oct 18 01:36:41 2013 -0400
     1.2 +++ b/src/SDL.c	Thu Oct 17 23:02:29 2013 -0700
     1.3 @@ -20,6 +20,10 @@
     1.4  */
     1.5  #include "SDL_config.h"
     1.6  
     1.7 +#if defined(__WIN32__)
     1.8 +#include "core/windows/SDL_windows.h"
     1.9 +#endif
    1.10 +
    1.11  /* Initialization code for SDL */
    1.12  
    1.13  #include "SDL.h"
    1.14 @@ -443,7 +447,6 @@
    1.15  
    1.16  #if !defined(HAVE_LIBC) || (defined(__WATCOMC__) && defined(BUILD_DLL))
    1.17  /* Need to include DllMain() on Watcom C for some reason.. */
    1.18 -#include "core/windows/SDL_windows.h"
    1.19  
    1.20  BOOL APIENTRY
    1.21  _DllMainCRTStartup(HANDLE hModule,
     2.1 --- a/src/SDL_assert.c	Fri Oct 18 01:36:41 2013 -0400
     2.2 +++ b/src/SDL_assert.c	Thu Oct 17 23:02:29 2013 -0700
     2.3 @@ -20,6 +20,10 @@
     2.4  */
     2.5  #include "SDL_config.h"
     2.6  
     2.7 +#if defined(__WIN32__)
     2.8 +#include "core/windows/SDL_windows.h"
     2.9 +#endif
    2.10 +
    2.11  #include "SDL.h"
    2.12  #include "SDL_atomic.h"
    2.13  #include "SDL_messagebox.h"
    2.14 @@ -29,8 +33,6 @@
    2.15  #include "video/SDL_sysvideo.h"
    2.16  
    2.17  #ifdef __WIN32__
    2.18 -#include "core/windows/SDL_windows.h"
    2.19 -
    2.20  #ifndef WS_OVERLAPPEDWINDOW
    2.21  #define WS_OVERLAPPEDWINDOW 0
    2.22  #endif
     3.1 --- a/src/SDL_log.c	Fri Oct 18 01:36:41 2013 -0400
     3.2 +++ b/src/SDL_log.c	Thu Oct 17 23:02:29 2013 -0700
     3.3 @@ -20,6 +20,10 @@
     3.4  */
     3.5  #include "SDL_config.h"
     3.6  
     3.7 +#if defined(__WIN32__)
     3.8 +#include "core/windows/SDL_windows.h"
     3.9 +#endif
    3.10 +
    3.11  /* Simple log messages in SDL */
    3.12  
    3.13  #include "SDL_log.h"
    3.14 @@ -28,9 +32,7 @@
    3.15  #include <stdio.h>
    3.16  #endif
    3.17  
    3.18 -#if defined(__WIN32__)
    3.19 -#include "core/windows/SDL_windows.h"
    3.20 -#elif defined(__ANDROID__)
    3.21 +#if defined(__ANDROID__)
    3.22  #include <android/log.h>
    3.23  #endif
    3.24  
     4.1 --- a/src/atomic/SDL_spinlock.c	Fri Oct 18 01:36:41 2013 -0400
     4.2 +++ b/src/atomic/SDL_spinlock.c	Thu Oct 17 23:02:29 2013 -0700
     4.3 @@ -20,14 +20,14 @@
     4.4  */
     4.5  #include "SDL_config.h"
     4.6  
     4.7 +#ifdef __WIN32__
     4.8 +#include "../core/windows/SDL_windows.h"
     4.9 +#endif
    4.10 +
    4.11  #include "SDL_atomic.h"
    4.12  #include "SDL_mutex.h"
    4.13  #include "SDL_timer.h"
    4.14  
    4.15 -/* Don't do the check for Visual Studio 2005, it's safe here */
    4.16 -#ifdef __WIN32__
    4.17 -#include "../core/windows/SDL_windows.h"
    4.18 -#endif
    4.19  
    4.20  /* This function is where all the magic happens... */
    4.21  SDL_bool
     5.1 --- a/src/core/windows/SDL_windows.c	Fri Oct 18 01:36:41 2013 -0400
     5.2 +++ b/src/core/windows/SDL_windows.c	Thu Oct 17 23:02:29 2013 -0700
     5.3 @@ -22,8 +22,8 @@
     5.4  
     5.5  #ifdef __WIN32__
     5.6  
     5.7 +#include "SDL_windows.h"
     5.8  #include "SDL_error.h"
     5.9 -#include "SDL_windows.h"
    5.10  #include "SDL_assert.h"
    5.11  
    5.12  #include <objbase.h>  /* for CoInitialize/CoUninitialize */
     6.1 --- a/src/cpuinfo/SDL_cpuinfo.c	Fri Oct 18 01:36:41 2013 -0400
     6.2 +++ b/src/cpuinfo/SDL_cpuinfo.c	Thu Oct 17 23:02:29 2013 -0700
     6.3 @@ -20,6 +20,10 @@
     6.4  */
     6.5  #include "SDL_config.h"
     6.6  
     6.7 +#if defined(__WIN32__)
     6.8 +#include "../core/windows/SDL_windows.h"
     6.9 +#endif
    6.10 +
    6.11  /* CPU feature detection for SDL */
    6.12  
    6.13  #include "SDL_cpuinfo.h"
    6.14 @@ -41,9 +45,6 @@
    6.15  #include <signal.h>
    6.16  #include <setjmp.h>
    6.17  #endif
    6.18 -#ifdef __WIN32__
    6.19 -#include "../core/windows/SDL_windows.h"
    6.20 -#endif
    6.21  
    6.22  #define CPU_HAS_RDTSC   0x00000001
    6.23  #define CPU_HAS_ALTIVEC 0x00000002
     7.1 --- a/src/file/SDL_rwops.c	Fri Oct 18 01:36:41 2013 -0400
     7.2 +++ b/src/file/SDL_rwops.c	Thu Oct 17 23:02:29 2013 -0700
     7.3 @@ -22,6 +22,11 @@
     7.4  #define _LARGEFILE64_SOURCE
     7.5  #include "SDL_config.h"
     7.6  
     7.7 +#if defined(__WIN32__)
     7.8 +#include "../core/windows/SDL_windows.h"
     7.9 +#endif
    7.10 +
    7.11 +
    7.12  /* This file provides a general interface for SDL to read and write
    7.13     data sources.  It can easily be extended to files, memory, etc.
    7.14  */
    7.15 @@ -42,8 +47,6 @@
    7.16  
    7.17  /* Functions to read/write Win32 API file pointers */
    7.18  
    7.19 -#include "../core/windows/SDL_windows.h"
    7.20 -
    7.21  #ifndef INVALID_SET_FILE_POINTER
    7.22  #define INVALID_SET_FILE_POINTER 0xFFFFFFFF
    7.23  #endif
     8.1 --- a/src/joystick/windows/SDL_mmjoystick.c	Fri Oct 18 01:36:41 2013 -0400
     8.2 +++ b/src/joystick/windows/SDL_mmjoystick.c	Thu Oct 17 23:02:29 2013 -0700
     8.3 @@ -33,6 +33,11 @@
     8.4  #include "../SDL_sysjoystick.h"
     8.5  #include "../SDL_joystick_c.h"
     8.6  
     8.7 +#ifdef REGSTR_VAL_JOYOEMNAME 
     8.8 +#undef REGSTR_VAL_JOYOEMNAME 
     8.9 +#endif
    8.10 +#define REGSTR_VAL_JOYOEMNAME "OEMName"
    8.11 +
    8.12  #define MAX_JOYSTICKS   16
    8.13  #define MAX_AXES    6       /* each joystick can have up to 6 axes */
    8.14  #define MAX_BUTTONS 32      /* and 32 buttons                      */
    8.15 @@ -45,7 +50,7 @@
    8.16  
    8.17  /* array to hold joystick ID values */
    8.18  static UINT SYS_JoystickID[MAX_JOYSTICKS];
    8.19 -static JOYCAPS SYS_Joystick[MAX_JOYSTICKS];
    8.20 +static JOYCAPSA SYS_Joystick[MAX_JOYSTICKS];
    8.21  static char *SYS_JoystickName[MAX_JOYSTICKS];
    8.22  
    8.23  /* The private structure used to keep track of a joystick */
    8.24 @@ -148,7 +153,7 @@
    8.25      int i;
    8.26      int maxdevs;
    8.27      JOYINFOEX joyinfo;
    8.28 -    JOYCAPS joycaps;
    8.29 +    JOYCAPSA joycaps;
    8.30      MMRESULT result;
    8.31  
    8.32      /* Reset the joystick ID & name mapping tables */
    8.33 @@ -166,7 +171,7 @@
    8.34          joyinfo.dwFlags = JOY_RETURNALL;
    8.35          result = joyGetPosEx(i, &joyinfo);
    8.36          if (result == JOYERR_NOERROR) {
    8.37 -            result = joyGetDevCaps(i, &joycaps, sizeof(joycaps));
    8.38 +            result = joyGetDevCapsA(i, &joycaps, sizeof(joycaps));
    8.39              if (result == JOYERR_NOERROR) {
    8.40                  SYS_JoystickID[SDL_SYS_numjoysticks] = i;
    8.41                  SYS_Joystick[SDL_SYS_numjoysticks] = joycaps;
     9.1 --- a/src/main/windows/SDL_windows_main.c	Fri Oct 18 01:36:41 2013 -0400
     9.2 +++ b/src/main/windows/SDL_windows_main.c	Thu Oct 17 23:02:29 2013 -0700
     9.3 @@ -7,12 +7,12 @@
     9.4  
     9.5  #ifdef __WIN32__
     9.6  
     9.7 +/* Include this so we define UNICODE properly */
     9.8 +#include "../../core/windows/SDL_windows.h"
     9.9 +
    9.10  #include <stdio.h>
    9.11  #include <stdlib.h>
    9.12  
    9.13 -#define WIN32_LEAN_AND_MEAN
    9.14 -#include <windows.h>
    9.15 -
    9.16  /* Include the SDL main definition header */
    9.17  #include "SDL.h"
    9.18  #include "SDL_main.h"
    10.1 --- a/src/render/direct3d/SDL_render_d3d.c	Fri Oct 18 01:36:41 2013 -0400
    10.2 +++ b/src/render/direct3d/SDL_render_d3d.c	Thu Oct 17 23:02:29 2013 -0700
    10.3 @@ -22,7 +22,6 @@
    10.4  
    10.5  #if SDL_VIDEO_RENDER_D3D && !SDL_RENDER_DISABLED
    10.6  
    10.7 -
    10.8  #include "../../core/windows/SDL_windows.h"
    10.9  
   10.10  #include "SDL_hints.h"
    11.1 --- a/src/render/software/SDL_rotate.c	Fri Oct 18 01:36:41 2013 -0400
    11.2 +++ b/src/render/software/SDL_rotate.c	Thu Oct 17 23:02:29 2013 -0700
    11.3 @@ -30,8 +30,8 @@
    11.4  */
    11.5  #include "SDL_config.h"
    11.6  
    11.7 -#ifdef WIN32
    11.8 -#include <windows.h>
    11.9 +#if defined(__WIN32__)
   11.10 +#include "../../core/windows/SDL_windows.h"
   11.11  #endif
   11.12  
   11.13  #include <stdlib.h>
    12.1 --- a/src/stdlib/SDL_getenv.c	Fri Oct 18 01:36:41 2013 -0400
    12.2 +++ b/src/stdlib/SDL_getenv.c	Thu Oct 17 23:02:29 2013 -0700
    12.3 @@ -20,10 +20,13 @@
    12.4  */
    12.5  #include "SDL_config.h"
    12.6  
    12.7 +#if defined(__WIN32__)
    12.8 +#include "../core/windows/SDL_windows.h"
    12.9 +#endif
   12.10 +
   12.11  #include "SDL_stdinc.h"
   12.12  
   12.13  #if !defined(SDL_setenv) && defined(__WIN32__)
   12.14 -#include "../core/windows/SDL_windows.h"
   12.15  /* Note this isn't thread-safe! */
   12.16  static char *SDL_envmem = NULL; /* Ugh, memory leak */
   12.17  static size_t SDL_envmemlen = 0;
    13.1 --- a/src/test/SDL_test_common.c	Fri Oct 18 01:36:41 2013 -0400
    13.2 +++ b/src/test/SDL_test_common.c	Thu Oct 17 23:02:29 2013 -0700
    13.3 @@ -1107,10 +1107,10 @@
    13.4  
    13.5      case SDL_FINGERDOWN:
    13.6      case SDL_FINGERUP:
    13.7 -        fprintf(stderr, "Finger: %s touch=%lld, finger=%lld, x=%f, y=%f, dx=%f, dy=%f, pressure=%f",
    13.8 +        fprintf(stderr, "Finger: %s touch=%ld, finger=%ld, x=%f, y=%f, dx=%f, dy=%f, pressure=%f",
    13.9                  (event->type == SDL_FINGERDOWN) ? "down" : "up",
   13.10 -                (long long) event->tfinger.touchId,
   13.11 -                (long long) event->tfinger.fingerId,
   13.12 +                (long) event->tfinger.touchId,
   13.13 +                (long) event->tfinger.fingerId,
   13.14                  event->tfinger.x, event->tfinger.y,
   13.15                  event->tfinger.dx, event->tfinger.dy, event->tfinger.pressure);
   13.16          break;
    14.1 --- a/src/thread/windows/SDL_systhread.c	Fri Oct 18 01:36:41 2013 -0400
    14.2 +++ b/src/thread/windows/SDL_systhread.c	Thu Oct 17 23:02:29 2013 -0700
    14.3 @@ -116,8 +116,8 @@
    14.4  int
    14.5  SDL_SYS_CreateThread(SDL_Thread * thread, void *args)
    14.6  {
    14.7 -    pfnSDL_CurrentBeginThread pfnBeginThread = _beginthreadex;
    14.8 -    pfnSDL_CurrentEndThread pfnEndThread = _endthreadex;
    14.9 +    pfnSDL_CurrentBeginThread pfnBeginThread = (pfnSDL_CurrentBeginThread)_beginthreadex;
   14.10 +    pfnSDL_CurrentEndThread pfnEndThread = (pfnSDL_CurrentEndThread)_endthreadex;
   14.11  #endif /* SDL_PASSED_BEGINTHREAD_ENDTHREAD */
   14.12      pThreadStartParms pThreadParms =
   14.13          (pThreadStartParms) SDL_malloc(sizeof(tThreadStartParms));
    15.1 --- a/src/thread/windows/SDL_systls.c	Fri Oct 18 01:36:41 2013 -0400
    15.2 +++ b/src/thread/windows/SDL_systls.c	Thu Oct 17 23:02:29 2013 -0700
    15.3 @@ -20,13 +20,13 @@
    15.4  */
    15.5  
    15.6  #include "SDL_config.h"
    15.7 -#include "SDL_thread.h"
    15.8 -#include "../SDL_thread_c.h"
    15.9  
   15.10  #if SDL_THREAD_WINDOWS
   15.11  
   15.12  #include "../../core/windows/SDL_windows.h"
   15.13  
   15.14 +#include "SDL_thread.h"
   15.15 +#include "../SDL_thread_c.h"
   15.16  
   15.17  static DWORD thread_local_storage = TLS_OUT_OF_INDEXES;
   15.18  static SDL_bool generic_local_storage = SDL_FALSE;
    16.1 --- a/src/video/windows/SDL_windowsmessagebox.c	Fri Oct 18 01:36:41 2013 -0400
    16.2 +++ b/src/video/windows/SDL_windowsmessagebox.c	Thu Oct 17 23:02:29 2013 -0700
    16.3 @@ -22,7 +22,11 @@
    16.4  
    16.5  #if SDL_VIDEO_DRIVER_WINDOWS
    16.6  
    16.7 -#include "SDL.h"
    16.8 +#if defined(__WIN32__)
    16.9 +#include "../../core/windows/SDL_windows.h"
   16.10 +#endif
   16.11 +
   16.12 +#include "SDL_assert.h"
   16.13  #include "SDL_windowsvideo.h"
   16.14  
   16.15  
    17.1 --- a/src/video/windows/SDL_windowsvideo.h	Fri Oct 18 01:36:41 2013 -0400
    17.2 +++ b/src/video/windows/SDL_windowsvideo.h	Thu Oct 17 23:02:29 2013 -0700
    17.3 @@ -23,10 +23,10 @@
    17.4  #ifndef _SDL_windowsvideo_h
    17.5  #define _SDL_windowsvideo_h
    17.6  
    17.7 +#include "../../core/windows/SDL_windows.h"
    17.8 +
    17.9  #include "../SDL_sysvideo.h"
   17.10  
   17.11 -#include "../../core/windows/SDL_windows.h"
   17.12 -
   17.13  #if defined(_MSC_VER)
   17.14  #include <msctf.h>
   17.15  #else
    18.1 --- a/src/video/windows/SDL_windowswindow.c	Fri Oct 18 01:36:41 2013 -0400
    18.2 +++ b/src/video/windows/SDL_windowswindow.c	Thu Oct 17 23:02:29 2013 -0700
    18.3 @@ -22,6 +22,8 @@
    18.4  
    18.5  #if SDL_VIDEO_DRIVER_WINDOWS
    18.6  
    18.7 +#include "../../core/windows/SDL_windows.h"
    18.8 +
    18.9  #include "SDL_assert.h"
   18.10  #include "../SDL_sysvideo.h"
   18.11  #include "../SDL_pixels_c.h"
    19.1 --- a/test/configure	Fri Oct 18 01:36:41 2013 -0400
    19.2 +++ b/test/configure	Thu Oct 17 23:02:29 2013 -0700
    19.3 @@ -3452,7 +3452,7 @@
    19.4    rm -f conf.sdltest
    19.5  
    19.6  CFLAGS="$CFLAGS $SDL_CFLAGS"
    19.7 -LIBS="$LIBS  $SDL_LIBS -lSDL2_test"
    19.8 +LIBS="$LIBS -lSDL2_test $SDL_LIBS"
    19.9  
   19.10  ac_ext=c
   19.11  ac_cpp='$CPP $CPPFLAGS'
    20.1 --- a/test/configure.in	Fri Oct 18 01:36:41 2013 -0400
    20.2 +++ b/test/configure.in	Thu Oct 17 23:02:29 2013 -0700
    20.3 @@ -86,7 +86,7 @@
    20.4  	    AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])
    20.5  )
    20.6  CFLAGS="$CFLAGS $SDL_CFLAGS"
    20.7 -LIBS="$LIBS  $SDL_LIBS -lSDL2_test"
    20.8 +LIBS="$LIBS -lSDL2_test $SDL_LIBS"
    20.9  
   20.10  dnl Check for X11 path, needed for OpenGL on some systems
   20.11  AC_PATH_X