Commit d54b125a860e83dac32efc0029e0055f0d1435c3

Sam Lantinga 2021-01-14T14:53:34

Fixed bug 5287 - Support building for UWP with CMake Jan Niklas Hasse Actually the SDL2-static target works, if I set SDL_SENSOR to OFF. Awesome! See this patch: https://github.com/microsoft/vcpkg/blob/master/ports/sdl2/0003-sdl2-fix-uwp-build.patch

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1bda90d..f749f6f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1400,8 +1400,13 @@ elseif(WINDOWS)
     endif()
   endif()
 
+  if(WINDOWS_STORE)
+    file(GLOB WINRT_MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/winrt/*.cpp)
+    set(SOURCE_FILES ${SOURCE_FILES} ${WINRT_MISC_SOURCES})
+  else()
   file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/windows/*.c)
   set(SOURCE_FILES ${SOURCE_FILES} ${MISC_SOURCES})
+  endif()
   set(HAVE_SDL_MISC TRUE)
 
   # Check for DirectX
@@ -1524,7 +1529,7 @@ elseif(WINDOWS)
     set(HAVE_SDL_THREADS TRUE)
   endif()
 
-  if(SDL_SENSOR AND HAVE_SENSORSAPI_H)
+  if(SDL_SENSOR AND HAVE_SENSORSAPI_H AND NOT WINDOWS_STORE)
     set(SDL_SENSOR_WINDOWS 1)
     set(HAVE_SDL_SENSORS TRUE)
     file(GLOB WINDOWS_SENSOR_SOURCES ${SDL2_SOURCE_DIR}/src/sensor/windows/*.c)