Fixed mingw-w64 build
authorSam Lantinga <slouken@libsdl.org>
Fri, 28 Sep 2018 01:00:47 -0700
changeset 122450c1c3e41a6f2
parent 12244 63282fe5089e
child 12246 87fecd66352a
Fixed mingw-w64 build
configure
configure.in
src/hidapi/windows/hid.c
src/joystick/hidapi/SDL_hidapi_ps4.c
     1.1 --- a/configure	Fri Sep 28 00:40:35 2018 -0700
     1.2 +++ b/configure	Fri Sep 28 01:00:47 2018 -0700
     1.3 @@ -24296,16 +24296,15 @@
     1.4  $as_echo "#define SDL_JOYSTICK_WINMM 1" >>confdefs.h
     1.5  
     1.6              fi
     1.7 +
     1.8 +$as_echo "#define SDL_JOYSTICK_HIDAPI 1" >>confdefs.h
     1.9 +
    1.10              SOURCES="$SOURCES $srcdir/src/joystick/windows/*.c"
    1.11 +            SOURCES="$SOURCES $srcdir/src/joystick/hidapi/*.c"
    1.12 +            SOURCES="$SOURCES $srcdir/src/hidapi/windows/hid.c"
    1.13 +            EXTRA_CFLAGS="$EXTRA_CFLAGS -I$srcdir/src/hidapi/hidapi"
    1.14              have_joystick=yes
    1.15          fi
    1.16 -        if test x$enable_joystick = xyes -a x$enable_hidapi = xyes; then
    1.17 -
    1.18 -$as_echo "#define SDL_JOYSTICK_HIDAPI 1" >>confdefs.h
    1.19 -
    1.20 -            EXTRA_CFLAGS="$EXTRA_CFLAGS -I$srcdir/src/hidapi/hidapi"
    1.21 -            SOURCES="$SOURCES $srcdir/src/joystick/hidapi/*.c"
    1.22 -        fi
    1.23          if test x$enable_haptic = xyes; then
    1.24              if test x$have_dinput = xyes -o x$have_xinput = xyes; then
    1.25                  if test x$have_xinput = xyes; then
    1.26 @@ -24367,7 +24366,7 @@
    1.27          else
    1.28              LIBUUID=-luuid
    1.29          fi
    1.30 -        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lversion $LIBUUID -static-libgcc"
    1.31 +        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lsetupapi -lversion $LIBUUID -static-libgcc"
    1.32          # The Windows platform requires special setup
    1.33          VERSION_SOURCES="$srcdir/src/main/windows/*.rc"
    1.34          SDLMAIN_SOURCES="$srcdir/src/main/windows/*.c"
     2.1 --- a/configure.in	Fri Sep 28 00:40:35 2018 -0700
     2.2 +++ b/configure.in	Fri Sep 28 01:00:47 2018 -0700
     2.3 @@ -3628,14 +3628,13 @@
     2.4              else
     2.5                  AC_DEFINE(SDL_JOYSTICK_WINMM, 1, [ ])
     2.6              fi
     2.7 +            AC_DEFINE(SDL_JOYSTICK_HIDAPI, 1, [ ])
     2.8              SOURCES="$SOURCES $srcdir/src/joystick/windows/*.c"
     2.9 +            SOURCES="$SOURCES $srcdir/src/joystick/hidapi/*.c"
    2.10 +            SOURCES="$SOURCES $srcdir/src/hidapi/windows/hid.c"
    2.11 +            EXTRA_CFLAGS="$EXTRA_CFLAGS -I$srcdir/src/hidapi/hidapi"
    2.12              have_joystick=yes
    2.13          fi
    2.14 -        if test x$enable_joystick = xyes -a x$enable_hidapi = xyes; then
    2.15 -            AC_DEFINE(SDL_JOYSTICK_HIDAPI, 1, [ ])
    2.16 -            EXTRA_CFLAGS="$EXTRA_CFLAGS -I$srcdir/src/hidapi/hidapi"
    2.17 -            SOURCES="$SOURCES $srcdir/src/joystick/hidapi/*.c"
    2.18 -        fi
    2.19          if test x$enable_haptic = xyes; then
    2.20              if test x$have_dinput = xyes -o x$have_xinput = xyes; then
    2.21                  if test x$have_xinput = xyes; then
    2.22 @@ -3683,7 +3682,7 @@
    2.23          else
    2.24              LIBUUID=-luuid
    2.25          fi
    2.26 -        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lversion $LIBUUID -static-libgcc"
    2.27 +        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lsetupapi -lversion $LIBUUID -static-libgcc"
    2.28          # The Windows platform requires special setup
    2.29          VERSION_SOURCES="$srcdir/src/main/windows/*.rc"
    2.30          SDLMAIN_SOURCES="$srcdir/src/main/windows/*.c"
     3.1 --- a/src/hidapi/windows/hid.c	Fri Sep 28 00:40:35 2018 -0700
     3.2 +++ b/src/hidapi/windows/hid.c	Fri Sep 28 01:00:47 2018 -0700
     3.3 @@ -37,6 +37,7 @@
     3.4  #endif
     3.5  
     3.6  /* SDL C runtime functions */
     3.7 +#include "../../SDL_internal.h"
     3.8  #include "SDL_stdinc.h"
     3.9  
    3.10  #define calloc SDL_calloc
     4.1 --- a/src/joystick/hidapi/SDL_hidapi_ps4.c	Fri Sep 28 00:40:35 2018 -0700
     4.2 +++ b/src/joystick/hidapi/SDL_hidapi_ps4.c	Fri Sep 28 01:00:47 2018 -0700
     4.3 @@ -162,9 +162,9 @@
     4.4  
     4.5  #undef DEFINE_GUID
     4.6  #define DEFINE_GUID(n,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) static const GUID n = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}}
     4.7 -DEFINE_GUID(CLSID_MMDeviceEnumerator, 0xBCDE0395, 0xE52F, 0x467C, 0x8E, 0x3D, 0xC4, 0x57, 0x92, 0x91, 0x69, 0x2E);
     4.8 -DEFINE_GUID(IID_IMMDeviceEnumerator, 0xA95664D2, 0x9614, 0x4F35, 0xA7, 0x46, 0xDE, 0x8D, 0xB6, 0x36, 0x17, 0xE6);
     4.9 -DEFINE_GUID(IID_IAudioEndpointVolume, 0x5CDF2C82, 0x841E, 0x4546, 0x97, 0x22, 0x0C, 0xF7, 0x40, 0x78, 0x22, 0x9A);
    4.10 +DEFINE_GUID(SDL_CLSID_MMDeviceEnumerator, 0xBCDE0395, 0xE52F, 0x467C, 0x8E, 0x3D, 0xC4, 0x57, 0x92, 0x91, 0x69, 0x2E);
    4.11 +DEFINE_GUID(SDL_IID_IMMDeviceEnumerator, 0xA95664D2, 0x9614, 0x4F35, 0xA7, 0x46, 0xDE, 0x8D, 0xB6, 0x36, 0x17, 0xE6);
    4.12 +DEFINE_GUID(SDL_IID_IAudioEndpointVolume, 0x5CDF2C82, 0x841E, 0x4546, 0x97, 0x22, 0x0C, 0xF7, 0x40, 0x78, 0x22, 0x9A);
    4.13  #endif
    4.14  
    4.15  
    4.16 @@ -179,7 +179,7 @@
    4.17          IMMDeviceEnumerator *pEnumerator;
    4.18  
    4.19          /* This should gracefully fail on XP and succeed on everything Vista and above */
    4.20 -        hr = CoCreateInstance(&CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL, &IID_IMMDeviceEnumerator, (LPVOID*)&pEnumerator);
    4.21 +        hr = CoCreateInstance(&SDL_CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL, &SDL_IID_IMMDeviceEnumerator, (LPVOID*)&pEnumerator);
    4.22          if (SUCCEEDED(hr)) {
    4.23              IMMDevice *pDevice;
    4.24  
    4.25 @@ -187,7 +187,7 @@
    4.26              if (SUCCEEDED(hr)) {
    4.27                  IAudioEndpointVolume *pEndpointVolume;
    4.28  
    4.29 -                hr = IMMDevice_Activate(pDevice, &IID_IAudioEndpointVolume, CLSCTX_ALL, NULL, (LPVOID*)&pEndpointVolume);
    4.30 +                hr = IMMDevice_Activate(pDevice, &SDL_IID_IAudioEndpointVolume, CLSCTX_ALL, NULL, (LPVOID*)&pEndpointVolume);
    4.31                  if (SUCCEEDED(hr)) {
    4.32                      IAudioEndpointVolume_GetMasterVolumeLevelScalar(pEndpointVolume, &volume);
    4.33                      IUnknown_Release(pEndpointVolume);