From 185e405bc14fe02ff1163479123a6475816e0c1a Mon Sep 17 00:00:00 2001
From: lat9nq <22451773+lat9nq@users.noreply.github.com>
Date: Mon, 31 May 2021 15:24:17 -0400
Subject: [PATCH] externals: Use defaults for building SDL2 on WIN32

Whatever those settings do breaks controller detection on Windows, at
least with the MinGW container. If-guard it against WIN32 and just let
SDL2 configure using its defaults, aside from static linking.
---
 externals/CMakeLists.txt | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/externals/CMakeLists.txt b/externals/CMakeLists.txt
index fe1c088ca2..aae0baa0bb 100644
--- a/externals/CMakeLists.txt
+++ b/externals/CMakeLists.txt
@@ -47,19 +47,21 @@ target_include_directories(unicorn-headers INTERFACE ./unicorn/include)
 
 # SDL2
 if (NOT SDL2_FOUND AND ENABLE_SDL2)
-    # Yuzu itself needs: Events Joystick Haptic Sensor Timers
-    # Yuzu-cmd also needs: Video (depends on Loadso/Dlopen)
-    set(SDL_UNUSED_SUBSYSTEMS
-        Atomic Audio Render Power Threads
-        File CPUinfo Filesystem Locale)
-    foreach(_SUB ${SDL_UNUSED_SUBSYSTEMS})
-      string(TOUPPER ${_SUB} _OPT)
-      option(SDL_${_OPT} "" OFF)
-    endforeach()
+    if (NOT WIN32)
+        # Yuzu itself needs: Events Joystick Haptic Sensor Timers
+        # Yuzu-cmd also needs: Video (depends on Loadso/Dlopen)
+        set(SDL_UNUSED_SUBSYSTEMS
+            Atomic Audio Render Power Threads
+            File CPUinfo Filesystem Locale)
+        foreach(_SUB ${SDL_UNUSED_SUBSYSTEMS})
+          string(TOUPPER ${_SUB} _OPT)
+          option(SDL_${_OPT} "" OFF)
+        endforeach()
 
+        option(HIDAPI "" ON)
+    endif()
     set(SDL_STATIC ON)
     set(SDL_SHARED OFF)
-    option(HIDAPI "" ON)
 
     add_subdirectory(SDL EXCLUDE_FROM_ALL)
     add_library(SDL2 ALIAS SDL2-static)