diff --git a/CMakeLists.txt b/CMakeLists.txt index e690ba523..792f26c6b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -805,6 +805,7 @@ elseif(WINDOWS) check_include_file(dsound.h HAVE_DSOUND_H) check_include_file(dinput.h HAVE_DINPUT_H) check_include_file(xaudio2.h HAVE_XAUDIO2_H) + check_include_file(xinput.h HAVE_XINPUT_H) check_include_file(dxgi.h HAVE_DXGI_H) if(HAVE_D3D_H OR HAVE_D3D11_H OR HAVE_DDRAW_H OR HAVE_DSOUND_H OR HAVE_DINPUT_H OR HAVE_XAUDIO2_H) set(HAVE_DIRECTX TRUE) @@ -910,21 +911,31 @@ elseif(WINDOWS) endif() if(SDL_JOYSTICK) + file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/windows/*.c) + set(SOURCE_FILES ${SOURCE_FILES} ${JOYSTICK_SOURCES}) if(HAVE_DINPUT_H) set(SDL_JOYSTICK_DINPUT 1) - set(SOURCE_FILES ${SOURCE_FILES} ${SDL2_SOURCE_DIR}/src/joystick/windows/SDL_dxjoystick.c) list(APPEND EXTRA_LIBS dinput8 dxguid dxerr) - else() + endif() + if(HAVE_XINPUT_H) + set(SDL_JOYSTICK_XINPUT 1) + endif() + if(NOT HAVE_DINPUT_H AND NOT HAVE_XINPUT_H) set(SDL_JOYSTICK_WINMM 1) - set(SOURCE_FILES ${SOURCE_FILES} ${SDL2_SOURCE_DIR}/src/joystick/windows/SDL_mmjoystick.c) endif() set(HAVE_SDL_JOYSTICK TRUE) - endif() - if(SDL_HAPTIC AND HAVE_DINPUT_H) - set(SDL_HAPTIC_DINPUT 1) - set(SOURCE_FILES ${SOURCE_FILES} ${SDL2_SOURCE_DIR}/src/haptic/windows/SDL_syshaptic.c) - set(HAVE_SDL_HAPTIC TRUE) + if(SDL_HAPTIC) + file(GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/windows/*.c) + set(SOURCE_FILES ${SOURCE_FILES} ${HAPTIC_SOURCES}) + if(HAVE_DINPUT_H) + set(SDL_HAPTIC_DINPUT 1) + endif() + if(HAVE_XINPUT_H) + set(SDL_HAPTIC_XINPUT 1) + endif() + set(HAVE_SDL_HAPTIC TRUE) + endif() endif() file(GLOB VERSION_SOURCES ${SDL2_SOURCE_DIR}/src/main/windows/*.rc)