Fixed building on Windows with CMake
authorSam Lantinga <slouken@libsdl.org>
Sat, 16 Aug 2014 15:18:21 -0700
changeset 907398d13a381299
parent 9072 0c1a46c018aa
child 9074 86a6f6d92960
Fixed building on Windows with CMake
CMakeLists.txt
     1.1 --- a/CMakeLists.txt	Sat Aug 16 16:50:10 2014 -0400
     1.2 +++ b/CMakeLists.txt	Sat Aug 16 15:18:21 2014 -0700
     1.3 @@ -805,6 +805,7 @@
     1.4      check_include_file(dsound.h HAVE_DSOUND_H)
     1.5      check_include_file(dinput.h HAVE_DINPUT_H)
     1.6      check_include_file(xaudio2.h HAVE_XAUDIO2_H)
     1.7 +    check_include_file(xinput.h HAVE_XINPUT_H)
     1.8      check_include_file(dxgi.h HAVE_DXGI_H)
     1.9      if(HAVE_D3D_H OR HAVE_D3D11_H OR HAVE_DDRAW_H OR HAVE_DSOUND_H OR HAVE_DINPUT_H OR HAVE_XAUDIO2_H)
    1.10        set(HAVE_DIRECTX TRUE)
    1.11 @@ -910,21 +911,31 @@
    1.12    endif()
    1.13  
    1.14    if(SDL_JOYSTICK)
    1.15 +    file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/windows/*.c)
    1.16 +    set(SOURCE_FILES ${SOURCE_FILES} ${JOYSTICK_SOURCES})
    1.17      if(HAVE_DINPUT_H)
    1.18        set(SDL_JOYSTICK_DINPUT 1)
    1.19 -      set(SOURCE_FILES ${SOURCE_FILES} ${SDL2_SOURCE_DIR}/src/joystick/windows/SDL_dxjoystick.c)
    1.20        list(APPEND EXTRA_LIBS dinput8 dxguid dxerr)
    1.21 -    else()
    1.22 +    endif()
    1.23 +    if(HAVE_XINPUT_H)
    1.24 +      set(SDL_JOYSTICK_XINPUT 1)
    1.25 +    endif()
    1.26 +    if(NOT HAVE_DINPUT_H AND NOT HAVE_XINPUT_H)
    1.27        set(SDL_JOYSTICK_WINMM 1)
    1.28 -      set(SOURCE_FILES ${SOURCE_FILES} ${SDL2_SOURCE_DIR}/src/joystick/windows/SDL_mmjoystick.c)
    1.29      endif()
    1.30      set(HAVE_SDL_JOYSTICK TRUE)
    1.31 -  endif()
    1.32  
    1.33 -  if(SDL_HAPTIC AND HAVE_DINPUT_H)
    1.34 -    set(SDL_HAPTIC_DINPUT 1)
    1.35 -    set(SOURCE_FILES ${SOURCE_FILES} ${SDL2_SOURCE_DIR}/src/haptic/windows/SDL_syshaptic.c)
    1.36 -    set(HAVE_SDL_HAPTIC TRUE)
    1.37 +    if(SDL_HAPTIC)
    1.38 +      file(GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/windows/*.c)
    1.39 +      set(SOURCE_FILES ${SOURCE_FILES} ${HAPTIC_SOURCES})
    1.40 +      if(HAVE_DINPUT_H)
    1.41 +        set(SDL_HAPTIC_DINPUT 1)
    1.42 +      endif()
    1.43 +      if(HAVE_XINPUT_H)
    1.44 +        set(SDL_HAPTIC_XINPUT 1)
    1.45 +      endif()
    1.46 +      set(HAVE_SDL_HAPTIC TRUE)
    1.47 +    endif()
    1.48    endif()
    1.49  
    1.50    file(GLOB VERSION_SOURCES ${SDL2_SOURCE_DIR}/src/main/windows/*.rc)