build: fix / update sensors (windows) configuration

- SDL_config.h.in: add missing defines SDL_SENSOR_COREMOTION
  and SDL_SENSOR_WINDOWS (configure did set SDL_SENSOR_WINDOWS
  but it never went in SDL_config.h or Makefile.)
- SDL_config.h.cmake: remove duplicated SDL_SENSOR_XXX cmake
  defines.
- autofoo, cmake: check for sensorsapi.h header before enabling
  windows sensors.
Ozkan Sezer 2020-10-12 01:02:28 +03:00
parent 10eb5108b6
commit 196cda69f2
6 changed files with 29 additions and 9 deletions

View File

@ -1431,6 +1431,7 @@ elseif(WINDOWS)
# headers needed elsewhere
check_include_file(mmdeviceapi.h HAVE_MMDEVICEAPI_H)
check_include_file(audioclient.h HAVE_AUDIOCLIENT_H)
check_include_file(sensorsapi.h HAVE_SENSORSAPI_H)
if(SDL_AUDIO)
set(SDL_AUDIO_DRIVER_WINMM 1)
@ -1482,7 +1483,7 @@ elseif(WINDOWS)
set(HAVE_SDL_THREADS TRUE)
endif()
if(SDL_SENSOR)
if(SDL_SENSOR AND HAVE_SENSORSAPI_H)
set(SDL_SENSOR_WINDOWS 1)
set(HAVE_SDL_SENSORS TRUE)
file(GLOB WINDOWS_SENSOR_SOURCES ${SDL2_SOURCE_DIR}/src/sensor/windows/*.c)

15
configure vendored
View File

@ -24965,7 +24965,20 @@ $as_echo "#define SDL_HAPTIC_DINPUT 1" >>confdefs.h
fi
fi
# Set up files for the sensor library
if test x$enable_sensor = xyes; then
ac_fn_c_check_header_mongrel "$LINENO" "sensorsapi.h" "ac_cv_header_sensorsapi_h" "$ac_includes_default"
if test "x$ac_cv_header_sensorsapi_h" = xyes; then :
have_winsensors=yes
else
have_winsensors=no
fi
if test x$have_winsensors = xyes; then
$as_echo "#define HAVE_SENSORSAPI_H 1" >>confdefs.h
fi
if test x$enable_sensor = xyes -a x$have_winsensors = xyes; then
$as_echo "#define SDL_SENSOR_WINDOWS 1" >>confdefs.h

View File

@ -3759,7 +3759,11 @@ AS_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau
fi
fi
# Set up files for the sensor library
if test x$enable_sensor = xyes; then
AC_CHECK_HEADER(sensorsapi.h,have_winsensors=yes,have_winsensors=no)
if test x$have_winsensors = xyes; then
AC_DEFINE(HAVE_SENSORSAPI_H, 1, [ ])
fi
if test x$enable_sensor = xyes -a x$have_winsensors = xyes; then
AC_DEFINE(SDL_SENSOR_WINDOWS, 1, [ ])
SOURCES="$SOURCES $srcdir/src/sensor/windows/*.c"
have_sensor=yes

View File

@ -219,6 +219,7 @@
#cmakedefine HAVE_MMDEVICEAPI_H @HAVE_MMDEVICEAPI_H@
#cmakedefine HAVE_AUDIOCLIENT_H @HAVE_AUDIOCLIENT_H@
#cmakedefine HAVE_SENSORSAPI_H @HAVE_SENSORSAPI_H@
#cmakedefine HAVE_XINPUT_GAMEPAD_EX @HAVE_XINPUT_GAMEPAD_EX@
#cmakedefine HAVE_XINPUT_STATE_EX @HAVE_XINPUT_STATE_EX@
@ -305,6 +306,7 @@
/* Enable various sensor drivers */
#cmakedefine SDL_SENSOR_ANDROID @SDL_SENSOR_ANDROID@
#cmakedefine SDL_SENSOR_COREMOTION @SDL_SENSOR_COREMOTION@
#cmakedefine SDL_SENSOR_WINDOWS @SDL_SENSOR_WINDOWS@
#cmakedefine SDL_SENSOR_DUMMY @SDL_SENSOR_DUMMY@
/* Enable various shared object loading systems */
@ -410,12 +412,6 @@
#cmakedefine SDL_POWER_EMSCRIPTEN @SDL_POWER_EMSCRIPTEN@
#cmakedefine SDL_POWER_HARDWIRED @SDL_POWER_HARDWIRED@
/* Enable sensor support */
#cmakedefine SDL_SENSOR_ANDROID @SDL_SENSOR_ANDROID@
#cmakedefine SDL_SENSOR_WINDOWS @SDL_SENSOR_WINDOWS@
#cmakedefine SDL_SENSOR_COREMOTION @SDL_SENSOR_COREMOTION@
#cmakedefine SDL_SENSOR_DUMMY @SDL_SENSOR_DUMMY@
/* Enable system filesystem support */
#cmakedefine SDL_FILESYSTEM_ANDROID @SDL_FILESYSTEM_ANDROID@
#cmakedefine SDL_FILESYSTEM_HAIKU @SDL_FILESYSTEM_HAIKU@

View File

@ -215,8 +215,11 @@
#undef HAVE_DSOUND_H
#undef HAVE_DXGI_H
#undef HAVE_XINPUT_H
#undef HAVE_MMDEVICEAPI_H
#undef HAVE_AUDIOCLIENT_H
#undef HAVE_SENSORSAPI_H
#undef HAVE_XINPUT_GAMEPAD_EX
#undef HAVE_XINPUT_STATE_EX
@ -301,6 +304,8 @@
/* Enable various sensor drivers */
#undef SDL_SENSOR_ANDROID
#undef SDL_SENSOR_COREMOTION
#undef SDL_SENSOR_WINDOWS
#undef SDL_SENSOR_DUMMY
/* Enable various shared object loading systems */

View File

@ -84,6 +84,7 @@ typedef unsigned int uintptr_t;
#define HAVE_XINPUT_H 1
#define HAVE_MMDEVICEAPI_H 1
#define HAVE_AUDIOCLIENT_H 1
#define HAVE_SENSORSAPI_H
/* This is disabled by default to avoid C runtime dependencies and manifest requirements */
#ifdef HAVE_LIBC