Fixed building on Windows with CMake

This commit is contained in:
Sam Lantinga 2014-08-16 15:18:21 -07:00
parent d72c61d8c7
commit 384c204761
1 changed files with 19 additions and 8 deletions

View File

@ -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,22 +911,32 @@ 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)
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)
set(SOURCE_FILES ${SOURCE_FILES} ${SDL2_SOURCE_DIR}/src/haptic/windows/SDL_syshaptic.c)
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)
file(GLOB SDLMAIN_SOURCES ${SDL2_SOURCE_DIR}/src/main/windows/*.c)