Skip to content

Commit

Permalink
Fixed building on Windows with CMake
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Aug 16, 2014
1 parent d72c61d commit 384c204
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions CMakeLists.txt
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 384c204

Please sign in to comment.