Commit aee055222989d1167837ba74df925d36e11f2ae5

Sam Lantinga 2015-06-13T10:47:55

Fixed bug 3009 - Cannot compile SDL2 on Windows CMakeLists.txt was missing handling for running CMake with -DDIRECTX=0

diff --git a/CMakeLists.txt b/CMakeLists.txt
index b9694c5..4d8b95b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1031,14 +1031,19 @@ elseif(WINDOWS)
     set(HAVE_SDL_JOYSTICK 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)
+      if(HAVE_DINPUT_H OR HAVE_XINPUT_H)
+        file(GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/windows/*.c)
+        if(HAVE_DINPUT_H)
+          set(SDL_HAPTIC_DINPUT 1)
+        endif()
+        if(HAVE_XINPUT_H)
+          set(SDL_HAPTIC_XINPUT 1)
+        endif()
+      else()
+        file(GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/dummy/*.c)
+        set(SDL_HAPTIC_DUMMY 1)
       endif()
+      set(SOURCE_FILES ${SOURCE_FILES} ${HAPTIC_SOURCES})
       set(HAVE_SDL_HAPTIC TRUE)
     endif()
   endif()
diff --git a/include/SDL_config.h.cmake b/include/SDL_config.h.cmake
index c4324f8..34599f2 100644
--- a/include/SDL_config.h.cmake
+++ b/include/SDL_config.h.cmake
@@ -232,6 +232,7 @@
 #cmakedefine SDL_INPUT_TSLIB @SDL_INPUT_TSLIB@
 #cmakedefine SDL_JOYSTICK_HAIKU @SDL_JOYSTICK_HAIKU@
 #cmakedefine SDL_JOYSTICK_DINPUT @SDL_JOYSTICK_DINPUT@
+#cmakedefine SDL_JOYSTICK_XINPUT @SDL_JOYSTICK_XINPUT@
 #cmakedefine SDL_JOYSTICK_DUMMY @SDL_JOYSTICK_DUMMY@
 #cmakedefine SDL_JOYSTICK_IOKIT @SDL_JOYSTICK_IOKIT@
 #cmakedefine SDL_JOYSTICK_LINUX @SDL_JOYSTICK_LINUX@
@@ -243,6 +244,7 @@
 #cmakedefine SDL_HAPTIC_LINUX @SDL_HAPTIC_LINUX@
 #cmakedefine SDL_HAPTIC_IOKIT @SDL_HAPTIC_IOKIT@
 #cmakedefine SDL_HAPTIC_DINPUT @SDL_HAPTIC_DINPUT@
+#cmakedefine SDL_HAPTIC_XINPUT @SDL_HAPTIC_XINPUT@
 
 /* Enable various shared object loading systems */
 #cmakedefine SDL_LOADSO_HAIKU @SDL_LOADSO_HAIKU@