mirror of https://github.com/encounter/SDL.git
added --enable-xinput switch for windows builds
This commit is contained in:
parent
d6a6662fa1
commit
091a4649e8
|
@ -386,6 +386,7 @@ foreach(_SUB ${SDL_X11_OPTIONS})
|
||||||
endforeach()
|
endforeach()
|
||||||
set_option(VIDEO_COCOA "Use Cocoa video driver" ${APPLE})
|
set_option(VIDEO_COCOA "Use Cocoa video driver" ${APPLE})
|
||||||
set_option(DIRECTX "Use DirectX for Windows audio/video" ${WINDOWS})
|
set_option(DIRECTX "Use DirectX for Windows audio/video" ${WINDOWS})
|
||||||
|
set_option(XINPUT "Use Xinput for Windows" ${WINDOWS})
|
||||||
set_option(WASAPI "Use the Windows WASAPI audio driver" ${WINDOWS})
|
set_option(WASAPI "Use the Windows WASAPI audio driver" ${WINDOWS})
|
||||||
set_option(RENDER_D3D "Enable the Direct3D render driver" ${WINDOWS})
|
set_option(RENDER_D3D "Enable the Direct3D render driver" ${WINDOWS})
|
||||||
set_option(RENDER_METAL "Enable the Metal render driver" ${APPLE})
|
set_option(RENDER_METAL "Enable the Metal render driver" ${APPLE})
|
||||||
|
@ -1453,7 +1454,7 @@ elseif(WINDOWS)
|
||||||
set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS})
|
set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(HAVE_WIN32_CC)
|
if(XINPUT)
|
||||||
# xinput.h may need windows.h, but does not include it itself.
|
# xinput.h may need windows.h, but does not include it itself.
|
||||||
check_c_source_compiles("
|
check_c_source_compiles("
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
@ -1469,8 +1470,6 @@ elseif(WINDOWS)
|
||||||
#include <xinput.h>
|
#include <xinput.h>
|
||||||
XINPUT_STATE_EX s1;
|
XINPUT_STATE_EX s1;
|
||||||
int main(int argc, char **argv) { }" HAVE_XINPUT_STATE_EX)
|
int main(int argc, char **argv) { }" HAVE_XINPUT_STATE_EX)
|
||||||
else()
|
|
||||||
check_include_file(xinput.h HAVE_XINPUT_H)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# headers needed elsewhere
|
# headers needed elsewhere
|
||||||
|
|
|
@ -400,7 +400,7 @@ macro(CheckX11)
|
||||||
|
|
||||||
check_include_file(X11/Xcursor/Xcursor.h HAVE_XCURSOR_H)
|
check_include_file(X11/Xcursor/Xcursor.h HAVE_XCURSOR_H)
|
||||||
check_include_file(X11/extensions/Xinerama.h HAVE_XINERAMA_H)
|
check_include_file(X11/extensions/Xinerama.h HAVE_XINERAMA_H)
|
||||||
check_include_file(X11/extensions/XInput2.h HAVE_XINPUT_H)
|
check_include_file(X11/extensions/XInput2.h HAVE_XINPUT2_H)
|
||||||
check_include_file(X11/extensions/Xrandr.h HAVE_XRANDR_H)
|
check_include_file(X11/extensions/Xrandr.h HAVE_XRANDR_H)
|
||||||
check_include_file(X11/extensions/Xrender.h HAVE_XRENDER_H)
|
check_include_file(X11/extensions/Xrender.h HAVE_XRENDER_H)
|
||||||
check_include_file(X11/extensions/scrnsaver.h HAVE_XSS_H)
|
check_include_file(X11/extensions/scrnsaver.h HAVE_XSS_H)
|
||||||
|
@ -498,7 +498,7 @@ macro(CheckX11)
|
||||||
set(SDL_VIDEO_DRIVER_X11_XINERAMA 1)
|
set(SDL_VIDEO_DRIVER_X11_XINERAMA 1)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(VIDEO_X11_XINPUT AND HAVE_XINPUT_H)
|
if(VIDEO_X11_XINPUT AND HAVE_XINPUT2_H)
|
||||||
set(HAVE_VIDEO_X11_XINPUT TRUE)
|
set(HAVE_VIDEO_X11_XINPUT TRUE)
|
||||||
if(HAVE_X11_SHARED AND XI_LIB)
|
if(HAVE_X11_SHARED AND XI_LIB)
|
||||||
set(SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 "\"${XI_LIB_SONAME}\"")
|
set(SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 "\"${XI_LIB_SONAME}\"")
|
||||||
|
|
|
@ -892,6 +892,7 @@ enable_joystick_mfi
|
||||||
enable_pthreads
|
enable_pthreads
|
||||||
enable_pthread_sem
|
enable_pthread_sem
|
||||||
enable_directx
|
enable_directx
|
||||||
|
enable_xinput
|
||||||
enable_wasapi
|
enable_wasapi
|
||||||
enable_sdl_dlopen
|
enable_sdl_dlopen
|
||||||
enable_hidapi
|
enable_hidapi
|
||||||
|
@ -1677,6 +1678,7 @@ Optional Features:
|
||||||
[[default=yes]]
|
[[default=yes]]
|
||||||
--enable-pthread-sem use pthread semaphores [[default=yes]]
|
--enable-pthread-sem use pthread semaphores [[default=yes]]
|
||||||
--enable-directx use DirectX for Windows audio/video [[default=yes]]
|
--enable-directx use DirectX for Windows audio/video [[default=yes]]
|
||||||
|
--enable-xinput use Xinput for Windows [[default=yes]]
|
||||||
--enable-wasapi use the Windows WASAPI audio driver [[default=yes]]
|
--enable-wasapi use the Windows WASAPI audio driver [[default=yes]]
|
||||||
--enable-sdl-dlopen use dlopen for shared object loading [[default=yes]]
|
--enable-sdl-dlopen use dlopen for shared object loading [[default=yes]]
|
||||||
--enable-hidapi use HIDAPI for low level joystick drivers
|
--enable-hidapi use HIDAPI for low level joystick drivers
|
||||||
|
@ -23896,13 +23898,25 @@ $as_echo "#define HAVE_DXGI_H 1" >>confdefs.h
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Check whether --enable-xinput was given.
|
||||||
|
if test "${enable_xinput+set}" = set; then :
|
||||||
|
enableval=$enable_xinput;
|
||||||
|
else
|
||||||
|
enable_xinput=yes
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test x$enable_xinput = xyes; then
|
||||||
|
have_xinput_gamepadex=no
|
||||||
|
have_xinput_stateex=no
|
||||||
ac_fn_c_check_header_mongrel "$LINENO" "xinput.h" "ac_cv_header_xinput_h" "$ac_includes_default"
|
ac_fn_c_check_header_mongrel "$LINENO" "xinput.h" "ac_cv_header_xinput_h" "$ac_includes_default"
|
||||||
if test "x$ac_cv_header_xinput_h" = xyes; then :
|
if test "x$ac_cv_header_xinput_h" = xyes; then :
|
||||||
have_xinput=yes
|
have_xinput=yes
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct XINPUT_GAMEPAD_EX" >&5
|
||||||
|
$as_echo_n "checking for struct XINPUT_GAMEPAD_EX... " >&6; }
|
||||||
|
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||||
/* end confdefs.h. */
|
/* end confdefs.h. */
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
@ -23921,7 +23935,11 @@ if ac_fn_c_try_compile "$LINENO"; then :
|
||||||
have_xinput_gamepadex=yes
|
have_xinput_gamepadex=yes
|
||||||
fi
|
fi
|
||||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_xinput_gamepadex" >&5
|
||||||
|
$as_echo "$have_xinput_gamepadex" >&6; }
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct XINPUT_STATE_EX" >&5
|
||||||
|
$as_echo_n "checking for struct XINPUT_STATE_EX... " >&6; }
|
||||||
|
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||||
/* end confdefs.h. */
|
/* end confdefs.h. */
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
@ -23940,21 +23958,24 @@ if ac_fn_c_try_compile "$LINENO"; then :
|
||||||
have_xinput_stateex=yes
|
have_xinput_stateex=yes
|
||||||
fi
|
fi
|
||||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_xinput_stateex" >&5
|
||||||
|
$as_echo "$have_xinput_stateex" >&6; }
|
||||||
|
|
||||||
if test x$have_xinput = xyes; then
|
if test x$have_xinput = xyes; then
|
||||||
|
|
||||||
$as_echo "#define HAVE_XINPUT_H 1" >>confdefs.h
|
$as_echo "#define HAVE_XINPUT_H 1" >>confdefs.h
|
||||||
|
|
||||||
fi
|
fi
|
||||||
if test x$have_xinput_gamepadex = xyes; then
|
if test x$have_xinput_gamepadex = xyes; then
|
||||||
|
|
||||||
$as_echo "#define HAVE_XINPUT_GAMEPAD_EX 1" >>confdefs.h
|
$as_echo "#define HAVE_XINPUT_GAMEPAD_EX 1" >>confdefs.h
|
||||||
|
|
||||||
fi
|
fi
|
||||||
if test x$have_xinput_stateex = xyes; then
|
if test x$have_xinput_stateex = xyes; then
|
||||||
|
|
||||||
$as_echo "#define HAVE_XINPUT_STATE_EX 1" >>confdefs.h
|
$as_echo "#define HAVE_XINPUT_STATE_EX 1" >>confdefs.h
|
||||||
|
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ac_fn_c_check_header_mongrel "$LINENO" "mmdeviceapi.h" "ac_cv_header_mmdeviceapi_h" "$ac_includes_default"
|
ac_fn_c_check_header_mongrel "$LINENO" "mmdeviceapi.h" "ac_cv_header_mmdeviceapi_h" "$ac_includes_default"
|
||||||
|
|
40
configure.ac
40
configure.ac
|
@ -3146,7 +3146,7 @@ CheckDIRECTX()
|
||||||
{
|
{
|
||||||
AC_ARG_ENABLE(directx,
|
AC_ARG_ENABLE(directx,
|
||||||
AS_HELP_STRING([--enable-directx], [use DirectX for Windows audio/video [[default=yes]]]),
|
AS_HELP_STRING([--enable-directx], [use DirectX for Windows audio/video [[default=yes]]]),
|
||||||
, enable_directx=yes)
|
, enable_directx=yes)
|
||||||
if test x$enable_directx = xyes; then
|
if test x$enable_directx = xyes; then
|
||||||
AC_CHECK_HEADER(d3d9.h, have_d3d=yes)
|
AC_CHECK_HEADER(d3d9.h, have_d3d=yes)
|
||||||
AC_CHECK_HEADER(d3d11_1.h, have_d3d11=yes)
|
AC_CHECK_HEADER(d3d11_1.h, have_d3d11=yes)
|
||||||
|
@ -3177,27 +3177,37 @@ AS_HELP_STRING([--enable-directx], [use DirectX for Windows audio/video [[defaul
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dnl The following are independent of --enable-directx
|
AC_ARG_ENABLE(xinput,
|
||||||
AC_CHECK_HEADER(xinput.h, have_xinput=yes)
|
AS_HELP_STRING([--enable-xinput], [use Xinput for Windows [[default=yes]]]),
|
||||||
AC_TRY_COMPILE([
|
, enable_xinput=yes)
|
||||||
|
if test x$enable_xinput = xyes; then
|
||||||
|
have_xinput_gamepadex=no
|
||||||
|
have_xinput_stateex=no
|
||||||
|
AC_CHECK_HEADER(xinput.h, have_xinput=yes)
|
||||||
|
AC_MSG_CHECKING(for struct XINPUT_GAMEPAD_EX)
|
||||||
|
AC_TRY_COMPILE([
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <xinput.h>
|
#include <xinput.h>
|
||||||
XINPUT_GAMEPAD_EX x1;
|
XINPUT_GAMEPAD_EX x1;
|
||||||
],[],[have_xinput_gamepadex=yes])
|
],[],[have_xinput_gamepadex=yes])
|
||||||
AC_TRY_COMPILE([
|
AC_MSG_RESULT($have_xinput_gamepadex)
|
||||||
|
AC_MSG_CHECKING(for struct XINPUT_STATE_EX)
|
||||||
|
AC_TRY_COMPILE([
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <xinput.h>
|
#include <xinput.h>
|
||||||
XINPUT_STATE_EX s1;
|
XINPUT_STATE_EX s1;
|
||||||
],[],[have_xinput_stateex=yes])
|
],[],[have_xinput_stateex=yes])
|
||||||
|
AC_MSG_RESULT($have_xinput_stateex)
|
||||||
|
|
||||||
if test x$have_xinput = xyes; then
|
if test x$have_xinput = xyes; then
|
||||||
AC_DEFINE(HAVE_XINPUT_H, 1, [ ])
|
AC_DEFINE(HAVE_XINPUT_H, 1, [ ])
|
||||||
fi
|
fi
|
||||||
if test x$have_xinput_gamepadex = xyes; then
|
if test x$have_xinput_gamepadex = xyes; then
|
||||||
AC_DEFINE(HAVE_XINPUT_GAMEPAD_EX, 1, [ ])
|
AC_DEFINE(HAVE_XINPUT_GAMEPAD_EX, 1, [ ])
|
||||||
fi
|
fi
|
||||||
if test x$have_xinput_stateex = xyes; then
|
if test x$have_xinput_stateex = xyes; then
|
||||||
AC_DEFINE(HAVE_XINPUT_STATE_EX, 1, [ ])
|
AC_DEFINE(HAVE_XINPUT_STATE_EX, 1, [ ])
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_CHECK_HEADER(mmdeviceapi.h, have_wasapi=yes)
|
AC_CHECK_HEADER(mmdeviceapi.h, have_wasapi=yes)
|
||||||
|
|
Loading…
Reference in New Issue