cmake: Add missing SDL_JOYSTICK_WGI in config step

SDL_config.h *can* define SDL_JOYSTICK_WGI. On builds with the Windows
10 SDK available, this allow implementing trigger rumbling on Xbox One
controllers. The files included in the Visual Studio Solution in
VisualC\SDL.sln *do* have this define set.

fix #4859
This commit is contained in:
Ybalrid (Arthur Brainville) 2021-10-31 02:54:20 +02:00 committed by Sam Lantinga
parent 8a4a282aaa
commit 81fe2ccb9c
2 changed files with 10 additions and 5 deletions

View File

@ -1281,7 +1281,7 @@ elseif(UNIX AND NOT APPLE AND NOT ANDROID AND NOT RISCOS AND NOT HAIKU)
if(HAVE_INPUT_KD) if(HAVE_INPUT_KD)
set(SDL_INPUT_LINUXKD 1) set(SDL_INPUT_LINUXKD 1)
endif() endif()
if(HAVE_INPUT_KBIO) if(HAVE_INPUT_KBIO)
set(SDL_INPUT_FBSDKBIO 1) set(SDL_INPUT_FBSDKBIO 1)
endif() endif()
@ -1290,7 +1290,7 @@ elseif(UNIX AND NOT APPLE AND NOT ANDROID AND NOT RISCOS AND NOT HAIKU)
check_include_file("sys/inotify.h" HAVE_SYS_INOTIFY_H) check_include_file("sys/inotify.h" HAVE_SYS_INOTIFY_H)
check_symbol_exists(inotify_init "sys/inotify.h" HAVE_INOTIFY_INIT) check_symbol_exists(inotify_init "sys/inotify.h" HAVE_INOTIFY_INIT)
check_symbol_exists(inotify_init1 "sys/inotify.h" HAVE_INOTIFY_INIT1) check_symbol_exists(inotify_init1 "sys/inotify.h" HAVE_INOTIFY_INIT1)
if(HAVE_SYS_INOTIFY_H AND HAVE_INOTIFY_INIT) if(HAVE_SYS_INOTIFY_H AND HAVE_INOTIFY_INIT)
set(HAVE_INOTIFY 1) set(HAVE_INOTIFY 1)
endif() endif()
@ -1316,7 +1316,7 @@ elseif(UNIX AND NOT APPLE AND NOT ANDROID AND NOT RISCOS AND NOT HAIKU)
set(SDL_USE_IME TRUE) set(SDL_USE_IME TRUE)
target_compile_definitions(sdl-build-options INTERFACE "-DSDL_USE_IME") # !!! FIXME: why isn't this a definition and not in SDL_config.h.cmake? target_compile_definitions(sdl-build-options INTERFACE "-DSDL_USE_IME") # !!! FIXME: why isn't this a definition and not in SDL_config.h.cmake?
endif() endif()
if(FREEBSD AND NOT HAVE_INOTIFY) if(FREEBSD AND NOT HAVE_INOTIFY)
pkg_search_module(INOTIFY libinotify) pkg_search_module(INOTIFY libinotify)
if(INOTIFY_FOUND) if(INOTIFY_FOUND)
@ -1358,7 +1358,7 @@ elseif(UNIX AND NOT APPLE AND NOT ANDROID AND NOT RISCOS AND NOT HAIKU)
set(SOURCE_FILES ${SOURCE_FILES} "${SDL2_SOURCE_DIR}/src/core/linux/SDL_evdev.c") set(SOURCE_FILES ${SOURCE_FILES} "${SDL2_SOURCE_DIR}/src/core/linux/SDL_evdev.c")
set(SOURCE_FILES ${SOURCE_FILES} "${SDL2_SOURCE_DIR}/src/core/linux/SDL_evdev_kbd.c") set(SOURCE_FILES ${SOURCE_FILES} "${SDL2_SOURCE_DIR}/src/core/linux/SDL_evdev_kbd.c")
endif() endif()
if(HAVE_INPUT_KBIO) if(HAVE_INPUT_KBIO)
set(SOURCE_FILES ${SOURCE_FILES} "${SDL2_SOURCE_DIR}/src/core/freebsd/SDL_evdev_kbd_freebsd.c") set(SOURCE_FILES ${SOURCE_FILES} "${SDL2_SOURCE_DIR}/src/core/freebsd/SDL_evdev_kbd_freebsd.c")
endif() endif()
@ -1573,7 +1573,7 @@ elseif(WINDOWS)
if(WINDOWS_STORE) if(WINDOWS_STORE)
set(SDL_VIDEO_DRIVER_WINRT 1) set(SDL_VIDEO_DRIVER_WINRT 1)
file(GLOB WIN_VIDEO_SOURCES file(GLOB WIN_VIDEO_SOURCES
${SDL2_SOURCE_DIR}/src/video/winrt/*.c ${SDL2_SOURCE_DIR}/src/video/winrt/*.c
${SDL2_SOURCE_DIR}/src/video/winrt/*.cpp ${SDL2_SOURCE_DIR}/src/video/winrt/*.cpp
${SDL2_SOURCE_DIR}/src/render/direct3d11/*.cpp ${SDL2_SOURCE_DIR}/src/render/direct3d11/*.cpp
) )
@ -1712,6 +1712,10 @@ elseif(WINDOWS)
endif() endif()
if(HAVE_XINPUT_H) if(HAVE_XINPUT_H)
set(SDL_JOYSTICK_XINPUT 1) set(SDL_JOYSTICK_XINPUT 1)
if(NOT CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION STREQUAL "")
# Has Windows 10 SDK, so has Windows.Gaming.Input
set(SDL_JOYSTICK_WGI 1)
endif()
endif() endif()
if(NOT HAVE_DINPUT_H AND NOT HAVE_XINPUT_H) if(NOT HAVE_DINPUT_H AND NOT HAVE_XINPUT_H)
set(SDL_JOYSTICK_WINMM 1) set(SDL_JOYSTICK_WINMM 1)

View File

@ -319,6 +319,7 @@
#cmakedefine SDL_INPUT_FBSDKBIO @SDL_INPUT_FBSDKBIO@ #cmakedefine SDL_INPUT_FBSDKBIO @SDL_INPUT_FBSDKBIO@
#cmakedefine SDL_JOYSTICK_ANDROID @SDL_JOYSTICK_ANDROID@ #cmakedefine SDL_JOYSTICK_ANDROID @SDL_JOYSTICK_ANDROID@
#cmakedefine SDL_JOYSTICK_HAIKU @SDL_JOYSTICK_HAIKU@ #cmakedefine SDL_JOYSTICK_HAIKU @SDL_JOYSTICK_HAIKU@
#cmakedefine SDL_JOYSTICK_WGI @SDL_JOYSTICK_WGI@
#cmakedefine SDL_JOYSTICK_DINPUT @SDL_JOYSTICK_DINPUT@ #cmakedefine SDL_JOYSTICK_DINPUT @SDL_JOYSTICK_DINPUT@
#cmakedefine SDL_JOYSTICK_XINPUT @SDL_JOYSTICK_XINPUT@ #cmakedefine SDL_JOYSTICK_XINPUT @SDL_JOYSTICK_XINPUT@
#cmakedefine SDL_JOYSTICK_DUMMY @SDL_JOYSTICK_DUMMY@ #cmakedefine SDL_JOYSTICK_DUMMY @SDL_JOYSTICK_DUMMY@