From 409548d3b318b30475dd278e1de0af07e90b90a0 Mon Sep 17 00:00:00 2001
From: Kyle Benesch <4b796c65+github@gmail.com>
Date: Wed, 25 Jun 2025 18:43:01 -0700
Subject: [PATCH 01/20] Test Pyodide builds

Simple import test
---
 .github/workflows/python-package.yml |  1 +
 build_sdl.py                         |  3 ++-
 tcod/cffi.py                         | 13 ++++++-------
 3 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml
index 1545558e..a8644a66 100644
--- a/.github/workflows/python-package.yml
+++ b/.github/workflows/python-package.yml
@@ -339,6 +339,7 @@ jobs:
         env:
           CIBW_BUILD: cp313-pyodide_wasm32
           CIBW_PLATFORM: pyodide
+          CIBW_TEST_COMMAND: python -c "import tcod.context"
       - name: Archive wheel
         uses: actions/upload-artifact@v4
         with:
diff --git a/build_sdl.py b/build_sdl.py
index 28069f2d..fd09e256 100755
--- a/build_sdl.py
+++ b/build_sdl.py
@@ -370,7 +370,7 @@ def get_cdef() -> tuple[str, dict[str, str]]:
 library_dirs: list[str] = []
 
 if "PYODIDE" in os.environ:
-    pass
+    libraries += ["SDL3"]
 elif sys.platform == "darwin":
     extra_link_args += ["-framework", "SDL3"]
 else:
@@ -399,6 +399,7 @@ def get_cdef() -> tuple[str, dict[str, str]]:
 
 if "PYODIDE" in os.environ:
     extra_compile_args += ["--use-port=sdl3"]
+    extra_link_args += ["--use-port=sdl3"]
 elif sys.platform not in ["win32", "darwin"]:
     # Use sdl-config to link to SDL on Linux.
     extra_compile_args += (
diff --git a/tcod/cffi.py b/tcod/cffi.py
index b0590d0e..863e2219 100644
--- a/tcod/cffi.py
+++ b/tcod/cffi.py
@@ -17,16 +17,15 @@
 
 REQUIRED_SDL_VERSION = (3, 2, 0)
 
-ffi_check = cffi.FFI()
-ffi_check.cdef(
-    """
-int SDL_GetVersion(void);
-"""
-)
-
 
 def verify_dependencies() -> None:
     """Try to make sure dependencies exist on this system."""
+    ffi_check = cffi.FFI()
+    ffi_check.cdef(
+        """
+    int SDL_GetVersion(void);
+    """
+    )
     if sys.platform == "win32":
         lib_test: Any = ffi_check.dlopen("SDL3.dll")  # Make sure SDL3.dll is here.
         int_version = lib_test.SDL_GetVersion()  # Need to check this version.

From cab157345c50f1410abf3aee608271c73869de34 Mon Sep 17 00:00:00 2001
From: Kyle Benesch <4b796c65+github@gmail.com>
Date: Fri, 27 Jun 2025 17:37:36 -0700
Subject: [PATCH 02/20] fixup! Test Pyodide builds

---
 build_sdl.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/build_sdl.py b/build_sdl.py
index fd09e256..17afb686 100755
--- a/build_sdl.py
+++ b/build_sdl.py
@@ -370,7 +370,7 @@ def get_cdef() -> tuple[str, dict[str, str]]:
 library_dirs: list[str] = []
 
 if "PYODIDE" in os.environ:
-    libraries += ["SDL3"]
+    libraries += ["SDL2"]
 elif sys.platform == "darwin":
     extra_link_args += ["-framework", "SDL3"]
 else:

From a1017e5df2b33de076f3e981b8954227858ed90d Mon Sep 17 00:00:00 2001
From: Kyle Benesch <4b796c65+github@gmail.com>
Date: Fri, 27 Jun 2025 17:37:52 -0700
Subject: [PATCH 03/20] fixup! fixup! Test Pyodide builds

---
 build_sdl.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/build_sdl.py b/build_sdl.py
index 17afb686..a01696a4 100755
--- a/build_sdl.py
+++ b/build_sdl.py
@@ -370,7 +370,7 @@ def get_cdef() -> tuple[str, dict[str, str]]:
 library_dirs: list[str] = []
 
 if "PYODIDE" in os.environ:
-    libraries += ["SDL2"]
+    pass
 elif sys.platform == "darwin":
     extra_link_args += ["-framework", "SDL3"]
 else:

From 0b4922e40555b21778ec0499b54f02d8419ab103 Mon Sep 17 00:00:00 2001
From: Kyle Benesch <4b796c65+github@gmail.com>
Date: Fri, 27 Jun 2025 20:27:27 -0700
Subject: [PATCH 04/20] fixup! fixup! fixup! Test Pyodide builds

---
 build_sdl.py | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/build_sdl.py b/build_sdl.py
index a01696a4..45db1c47 100755
--- a/build_sdl.py
+++ b/build_sdl.py
@@ -398,8 +398,19 @@ def get_cdef() -> tuple[str, dict[str, str]]:
     extra_link_args += ["-rpath", "/usr/local/opt/llvm/lib/"]
 
 if "PYODIDE" in os.environ:
+    with TemporaryDirectory() as tmp_dir:
+        blank_source = Path(tmp_dir, "blank.c")
+        blank_source.write_text("")
+        subprocess.check_output(["emcc", "--use-port=sdl3", blank_source], universal_newlines=True)
+
     extra_compile_args += ["--use-port=sdl3"]
     extra_link_args += ["--use-port=sdl3"]
+    extra_compile_args += (
+        subprocess.check_output(["pkg-config", "sdl3", "--cflags"], universal_newlines=True).strip().split()
+    )
+    extra_link_args += (
+        subprocess.check_output(["pkg-config", "sdl3", "--libs"], universal_newlines=True).strip().split()
+    )
 elif sys.platform not in ["win32", "darwin"]:
     # Use sdl-config to link to SDL on Linux.
     extra_compile_args += (

From b619c58b2751f1f7ebf0b321ba91b87166a8f596 Mon Sep 17 00:00:00 2001
From: Kyle Benesch <4b796c65+github@gmail.com>
Date: Fri, 27 Jun 2025 20:32:06 -0700
Subject: [PATCH 05/20] fixup! fixup! fixup! fixup! Test Pyodide builds

---
 build_sdl.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/build_sdl.py b/build_sdl.py
index 45db1c47..c49891a9 100755
--- a/build_sdl.py
+++ b/build_sdl.py
@@ -401,7 +401,8 @@ def get_cdef() -> tuple[str, dict[str, str]]:
     with TemporaryDirectory() as tmp_dir:
         blank_source = Path(tmp_dir, "blank.c")
         blank_source.write_text("")
-        subprocess.check_output(["emcc", "--use-port=sdl3", blank_source], universal_newlines=True)
+        print(f"""EMCC CFLAGS: {subprocess.check_output(["emcc", "--use-port=sdl3", "--cflags"], text=True)!r}""")
+        subprocess.run(["emcc", "--use-port=sdl3", blank_source], check=True)
 
     extra_compile_args += ["--use-port=sdl3"]
     extra_link_args += ["--use-port=sdl3"]

From 0e7252cde247d5a10266c621a0f5bb02984cee93 Mon Sep 17 00:00:00 2001
From: Kyle Benesch <4b796c65+github@gmail.com>
Date: Fri, 27 Jun 2025 20:47:08 -0700
Subject: [PATCH 06/20] fixup! fixup! fixup! fixup! fixup! Test Pyodide builds

---
 build_sdl.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/build_sdl.py b/build_sdl.py
index c49891a9..2a7421a6 100755
--- a/build_sdl.py
+++ b/build_sdl.py
@@ -412,6 +412,8 @@ def get_cdef() -> tuple[str, dict[str, str]]:
     extra_link_args += (
         subprocess.check_output(["pkg-config", "sdl3", "--libs"], universal_newlines=True).strip().split()
     )
+    print(f"{extra_compile_args=}")
+    print(f"{extra_link_args=}")
 elif sys.platform not in ["win32", "darwin"]:
     # Use sdl-config to link to SDL on Linux.
     extra_compile_args += (

From b3596b3aee7f332192e81d74ccb39dad12450227 Mon Sep 17 00:00:00 2001
From: Kyle Benesch <4b796c65+github@gmail.com>
Date: Fri, 27 Jun 2025 21:21:27 -0700
Subject: [PATCH 07/20] fixup! fixup! fixup! fixup! fixup! fixup! Test Pyodide
 builds

---
 build_sdl.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/build_sdl.py b/build_sdl.py
index 2a7421a6..d96e8f4d 100755
--- a/build_sdl.py
+++ b/build_sdl.py
@@ -407,10 +407,10 @@ def get_cdef() -> tuple[str, dict[str, str]]:
     extra_compile_args += ["--use-port=sdl3"]
     extra_link_args += ["--use-port=sdl3"]
     extra_compile_args += (
-        subprocess.check_output(["pkg-config", "sdl3", "--cflags"], universal_newlines=True).strip().split()
+        subprocess.check_output(["cmake", "--find-package", "-DNAME=SDL3", "-DMODE=COMPILE"], text=True).strip().split()
     )
     extra_link_args += (
-        subprocess.check_output(["pkg-config", "sdl3", "--libs"], universal_newlines=True).strip().split()
+        subprocess.check_output(["cmake", "--find-package", "-DNAME=SDL3", "-DMODE=LINK"], text=True).strip().split()
     )
     print(f"{extra_compile_args=}")
     print(f"{extra_link_args=}")

From bd5121318574cca2839f82c5d967a7dccbf976e6 Mon Sep 17 00:00:00 2001
From: Kyle Benesch <4b796c65+github@gmail.com>
Date: Fri, 27 Jun 2025 21:34:50 -0700
Subject: [PATCH 08/20] fixup! fixup! fixup! fixup! fixup! fixup! fixup! Test
 Pyodide builds

---
 build_sdl.py | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/build_sdl.py b/build_sdl.py
index d96e8f4d..4fa3ee86 100755
--- a/build_sdl.py
+++ b/build_sdl.py
@@ -406,12 +406,9 @@ def get_cdef() -> tuple[str, dict[str, str]]:
 
     extra_compile_args += ["--use-port=sdl3"]
     extra_link_args += ["--use-port=sdl3"]
-    extra_compile_args += (
-        subprocess.check_output(["cmake", "--find-package", "-DNAME=SDL3", "-DMODE=COMPILE"], text=True).strip().split()
-    )
-    extra_link_args += (
-        subprocess.check_output(["cmake", "--find-package", "-DNAME=SDL3", "-DMODE=LINK"], text=True).strip().split()
-    )
+    cmake_cmd = ("cmake", "--find-package", "-D", "NAME=SDL3", "-D", "COMPILER_ID=GNU", "-D", "LANGUAGE=C")
+    extra_compile_args += subprocess.check_output((*cmake_cmd, "-DMODE=COMPILE"), text=True).strip().split()
+    extra_link_args += subprocess.check_output((*cmake_cmd, "-DMODE=LINK"), text=True).strip().split()
     print(f"{extra_compile_args=}")
     print(f"{extra_link_args=}")
 elif sys.platform not in ["win32", "darwin"]:

From 78015693869f50824844de2c0ad20febd89498e6 Mon Sep 17 00:00:00 2001
From: Kyle Benesch <4b796c65+github@gmail.com>
Date: Fri, 27 Jun 2025 21:52:53 -0700
Subject: [PATCH 09/20] fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup!
 Test Pyodide builds

---
 .github/workflows/python-package.yml | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml
index a8644a66..8eeceafe 100644
--- a/.github/workflows/python-package.yml
+++ b/.github/workflows/python-package.yml
@@ -330,11 +330,11 @@ jobs:
           fetch-depth: ${{ env.git-depth }}
       - name: Checkout submodules
         run: git submodule update --init --recursive --depth 1
-      - uses: libsdl-org/setup-sdl@6574e20ac65ce362cd12f9c26b3a5e4d3cd31dee
-        with:
-          install-linux-dependencies: true
-          build-type: "Debug"
-          version: "3.2.4" # Should be equal or less than the version used by Emscripten
+      #- uses: libsdl-org/setup-sdl@6574e20ac65ce362cd12f9c26b3a5e4d3cd31dee
+      #  with:
+      #    install-linux-dependencies: true
+      #    build-type: "Debug"
+      #    version: "3.2.4" # Should be equal or less than the version used by Emscripten
       - uses: pypa/cibuildwheel@v3.0.0
         env:
           CIBW_BUILD: cp313-pyodide_wasm32

From 4396e66f18afcca658cb3b98663b461505485e4b Mon Sep 17 00:00:00 2001
From: Kyle Benesch <4b796c65+github@gmail.com>
Date: Fri, 27 Jun 2025 21:56:18 -0700
Subject: [PATCH 10/20] fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup!
 fixup! Test Pyodide builds

---
 build_sdl.py | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/build_sdl.py b/build_sdl.py
index 4fa3ee86..004968c4 100755
--- a/build_sdl.py
+++ b/build_sdl.py
@@ -265,6 +265,12 @@ def get_emscripten_include_dir() -> Path:
     raise AssertionError(os.environ["PATH"])
 
 
+if "PYODIDE" in os.environ:
+    with TemporaryDirectory() as tmp_dir:
+        blank_source = Path(tmp_dir, "blank.c")
+        blank_source.write_text("")
+        subprocess.run(["emcc", "--use-port=sdl3", blank_source], check=True)
+
 check_sdl_version()
 
 SDL_PARSE_PATH: Path | None = None
@@ -398,12 +404,7 @@ def get_cdef() -> tuple[str, dict[str, str]]:
     extra_link_args += ["-rpath", "/usr/local/opt/llvm/lib/"]
 
 if "PYODIDE" in os.environ:
-    with TemporaryDirectory() as tmp_dir:
-        blank_source = Path(tmp_dir, "blank.c")
-        blank_source.write_text("")
-        print(f"""EMCC CFLAGS: {subprocess.check_output(["emcc", "--use-port=sdl3", "--cflags"], text=True)!r}""")
-        subprocess.run(["emcc", "--use-port=sdl3", blank_source], check=True)
-
+    print(f"""EMCC CFLAGS: {subprocess.check_output(["emcc", "--use-port=sdl3", "--cflags"], text=True)!r}""")
     extra_compile_args += ["--use-port=sdl3"]
     extra_link_args += ["--use-port=sdl3"]
     cmake_cmd = ("cmake", "--find-package", "-D", "NAME=SDL3", "-D", "COMPILER_ID=GNU", "-D", "LANGUAGE=C")

From 46414cb0642c0bb1cbf405486a4b3c4431f4c68b Mon Sep 17 00:00:00 2001
From: Kyle Benesch <4b796c65+github@gmail.com>
Date: Fri, 27 Jun 2025 22:21:48 -0700
Subject: [PATCH 11/20] fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup!
 fixup! fixup! Test Pyodide builds

---
 build_sdl.py | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/build_sdl.py b/build_sdl.py
index 004968c4..44036676 100755
--- a/build_sdl.py
+++ b/build_sdl.py
@@ -271,7 +271,7 @@ def get_emscripten_include_dir() -> Path:
         blank_source.write_text("")
         subprocess.run(["emcc", "--use-port=sdl3", blank_source], check=True)
 
-check_sdl_version()
+# check_sdl_version()
 
 SDL_PARSE_PATH: Path | None = None
 SDL_BUNDLE_PATH: Path | None = None
@@ -404,12 +404,11 @@ def get_cdef() -> tuple[str, dict[str, str]]:
     extra_link_args += ["-rpath", "/usr/local/opt/llvm/lib/"]
 
 if "PYODIDE" in os.environ:
-    print(f"""EMCC CFLAGS: {subprocess.check_output(["emcc", "--use-port=sdl3", "--cflags"], text=True)!r}""")
     extra_compile_args += ["--use-port=sdl3"]
     extra_link_args += ["--use-port=sdl3"]
     cmake_cmd = ("cmake", "--find-package", "-D", "NAME=SDL3", "-D", "COMPILER_ID=GNU", "-D", "LANGUAGE=C")
-    extra_compile_args += subprocess.check_output((*cmake_cmd, "-DMODE=COMPILE"), text=True).strip().split()
-    extra_link_args += subprocess.check_output((*cmake_cmd, "-DMODE=LINK"), text=True).strip().split()
+    extra_compile_args += subprocess.check_output((*cmake_cmd, "-D", "MODE=COMPILE"), text=True).strip().split()
+    extra_link_args += subprocess.check_output((*cmake_cmd, "-D", "MODE=LINK"), text=True).strip().split()
     print(f"{extra_compile_args=}")
     print(f"{extra_link_args=}")
 elif sys.platform not in ["win32", "darwin"]:

From 439ef26efc8a4ac7c54d9dc33c6593ba164fc8dd Mon Sep 17 00:00:00 2001
From: Kyle Benesch <4b796c65+github@gmail.com>
Date: Fri, 27 Jun 2025 22:34:52 -0700
Subject: [PATCH 12/20] fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup!
 fixup! fixup! fixup! Test Pyodide builds

---
 build_sdl.py | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/build_sdl.py b/build_sdl.py
index 44036676..0b6b69e2 100755
--- a/build_sdl.py
+++ b/build_sdl.py
@@ -37,7 +37,6 @@
 # The SDL version to include in binary distributions.
 SDL_BUNDLE_VERSION = os.environ.get("SDL_VERSION", "3.2.16")
 
-
 # Used to remove excessive newlines in debug outputs.
 RE_NEWLINES = re.compile(r"\n\n+")
 # Functions using va_list need to be culled.
@@ -124,6 +123,8 @@
     )
 )
 
+CMAKE_FIND_SDL_CMD = ("cmake", "--find-package", "-D", "NAME=SDL3", "-D", "COMPILER_ID=GNU", "-D", "LANGUAGE=C")
+
 
 def check_sdl_version() -> None:
     """Check the local SDL3 version on Linux distributions."""
@@ -287,7 +288,8 @@ def get_emscripten_include_dir() -> Path:
 else:  # Unix
     matches = re.findall(
         r"-I(\S+)",
-        subprocess.check_output(["pkg-config", "sdl3", "--cflags"], universal_newlines=True),
+        # subprocess.check_output(["pkg-config", "sdl3", "--cflags"], universal_newlines=True),
+        subprocess.check_output((*CMAKE_FIND_SDL_CMD, "-D", "MODE=COMPILE"), text=True),
     )
     assert matches
 
@@ -406,9 +408,10 @@ def get_cdef() -> tuple[str, dict[str, str]]:
 if "PYODIDE" in os.environ:
     extra_compile_args += ["--use-port=sdl3"]
     extra_link_args += ["--use-port=sdl3"]
-    cmake_cmd = ("cmake", "--find-package", "-D", "NAME=SDL3", "-D", "COMPILER_ID=GNU", "-D", "LANGUAGE=C")
-    extra_compile_args += subprocess.check_output((*cmake_cmd, "-D", "MODE=COMPILE"), text=True).strip().split()
-    extra_link_args += subprocess.check_output((*cmake_cmd, "-D", "MODE=LINK"), text=True).strip().split()
+    extra_compile_args += (
+        subprocess.check_output((*CMAKE_FIND_SDL_CMD, "-D", "MODE=COMPILE"), text=True).strip().split()
+    )
+    extra_link_args += subprocess.check_output((*CMAKE_FIND_SDL_CMD, "-D", "MODE=LINK"), text=True).strip().split()
     print(f"{extra_compile_args=}")
     print(f"{extra_link_args=}")
 elif sys.platform not in ["win32", "darwin"]:

From 9af33c3076488e8400f1f42a7016c44498b24bf7 Mon Sep 17 00:00:00 2001
From: Kyle Benesch <4b796c65+github@gmail.com>
Date: Fri, 27 Jun 2025 22:52:15 -0700
Subject: [PATCH 13/20] fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup!
 fixup! fixup! fixup! fixup! Test Pyodide builds

---
 build_sdl.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/build_sdl.py b/build_sdl.py
index 0b6b69e2..97ee62a8 100755
--- a/build_sdl.py
+++ b/build_sdl.py
@@ -288,8 +288,9 @@ def get_emscripten_include_dir() -> Path:
 else:  # Unix
     matches = re.findall(
         r"-I(\S+)",
-        # subprocess.check_output(["pkg-config", "sdl3", "--cflags"], universal_newlines=True),
-        subprocess.check_output((*CMAKE_FIND_SDL_CMD, "-D", "MODE=COMPILE"), text=True),
+        subprocess.check_output(["pkg-config", "sdl3", "--cflags"], universal_newlines=True)
+        if "PYODIDE" not in os.environ
+        else subprocess.check_output((*CMAKE_FIND_SDL_CMD, "-D", "MODE=COMPILE"), text=True),
     )
     assert matches
 

From 2c7b20fc5d7956eaf02bf921e170675678fcf07f Mon Sep 17 00:00:00 2001
From: Kyle Benesch <4b796c65+github@gmail.com>
Date: Fri, 27 Jun 2025 23:05:50 -0700
Subject: [PATCH 14/20] fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup!
 fixup! fixup! fixup! fixup! fixup! Test Pyodide builds

---
 build_sdl.py | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/build_sdl.py b/build_sdl.py
index 97ee62a8..2581df8c 100755
--- a/build_sdl.py
+++ b/build_sdl.py
@@ -286,12 +286,11 @@ def get_emscripten_include_dir() -> Path:
 elif sys.platform == "darwin" and SDL_PARSE_PATH is not None:
     SDL_INCLUDE = SDL_PARSE_PATH / "Versions/A/Headers"
 else:  # Unix
-    matches = re.findall(
-        r"-I(\S+)",
-        subprocess.check_output(["pkg-config", "sdl3", "--cflags"], universal_newlines=True)
-        if "PYODIDE" not in os.environ
-        else subprocess.check_output((*CMAKE_FIND_SDL_CMD, "-D", "MODE=COMPILE"), text=True),
-    )
+    try:
+        out = subprocess.check_output((*CMAKE_FIND_SDL_CMD, "-D", "MODE=COMPILE"), text=True)
+    except Exception:
+        out = subprocess.check_output(["pkg-config", "sdl3", "--cflags"], universal_newlines=True)
+    matches = re.findall(r"-I(\S+)", out)
     assert matches
 
     for match in matches:

From 4a11e4c33d50b4f2844ee7ba2e531d8042e60def Mon Sep 17 00:00:00 2001
From: Kyle Benesch <4b796c65+github@gmail.com>
Date: Fri, 27 Jun 2025 23:10:26 -0700
Subject: [PATCH 15/20] fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup!
 fixup! fixup! fixup! fixup! fixup! fixup! Test Pyodide builds

---
 build_sdl.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/build_sdl.py b/build_sdl.py
index 2581df8c..b5071dfa 100755
--- a/build_sdl.py
+++ b/build_sdl.py
@@ -291,7 +291,7 @@ def get_emscripten_include_dir() -> Path:
     except Exception:
         out = subprocess.check_output(["pkg-config", "sdl3", "--cflags"], universal_newlines=True)
     matches = re.findall(r"-I(\S+)", out)
-    assert matches
+    assert matches, out
 
     for match in matches:
         if Path(match, "SDL3/SDL.h").is_file():

From 9c49d88a1d400ffee0fc8d39999a25d56a0fbebf Mon Sep 17 00:00:00 2001
From: Kyle Benesch <4b796c65+github@gmail.com>
Date: Fri, 27 Jun 2025 23:23:21 -0700
Subject: [PATCH 16/20] fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup!
 fixup! fixup! fixup! fixup! fixup! fixup! fixup! Test Pyodide builds

---
 build_sdl.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/build_sdl.py b/build_sdl.py
index b5071dfa..970c33cd 100755
--- a/build_sdl.py
+++ b/build_sdl.py
@@ -287,9 +287,9 @@ def get_emscripten_include_dir() -> Path:
     SDL_INCLUDE = SDL_PARSE_PATH / "Versions/A/Headers"
 else:  # Unix
     try:
-        out = subprocess.check_output((*CMAKE_FIND_SDL_CMD, "-D", "MODE=COMPILE"), text=True)
-    except Exception:
         out = subprocess.check_output(["pkg-config", "sdl3", "--cflags"], universal_newlines=True)
+    except Exception:
+        out = subprocess.check_output((*CMAKE_FIND_SDL_CMD, "-D", "MODE=COMPILE"), text=True)
     matches = re.findall(r"-I(\S+)", out)
     assert matches, out
 

From e509fdbec0dceb4528003d496317ec531a02a74a Mon Sep 17 00:00:00 2001
From: Kyle Benesch <4b796c65+github@gmail.com>
Date: Sat, 28 Jun 2025 14:56:24 -0700
Subject: [PATCH 17/20] fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup!
 fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! Test Pyodide builds

---
 build_sdl.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/build_sdl.py b/build_sdl.py
index 970c33cd..0b0dcdb6 100755
--- a/build_sdl.py
+++ b/build_sdl.py
@@ -123,7 +123,8 @@
     )
 )
 
-CMAKE_FIND_SDL_CMD = ("cmake", "--find-package", "-D", "NAME=SDL3", "-D", "COMPILER_ID=GNU", "-D", "LANGUAGE=C")
+CMAKE_CMD = "emcmake" if "PYODIDE" in os.environ else "cmake"
+CMAKE_FIND_SDL_CMD = (CMAKE_CMD, "--find-package", "-D", "NAME=SDL3", "-D", "COMPILER_ID=GNU", "-D", "LANGUAGE=C")
 
 
 def check_sdl_version() -> None:

From da2c3151c57b88409e4b072460d0d75a08463058 Mon Sep 17 00:00:00 2001
From: Kyle Benesch <4b796c65+github@gmail.com>
Date: Sat, 28 Jun 2025 15:34:47 -0700
Subject: [PATCH 18/20] fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup!
 fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! Test Pyodide
 builds

---
 build_sdl.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/build_sdl.py b/build_sdl.py
index 0b0dcdb6..02c8b1d2 100755
--- a/build_sdl.py
+++ b/build_sdl.py
@@ -123,8 +123,8 @@
     )
 )
 
-CMAKE_CMD = "emcmake" if "PYODIDE" in os.environ else "cmake"
-CMAKE_FIND_SDL_CMD = (CMAKE_CMD, "--find-package", "-D", "NAME=SDL3", "-D", "COMPILER_ID=GNU", "-D", "LANGUAGE=C")
+CMAKE_CMD = ("emcmake", "cmake") if "PYODIDE" in os.environ else ("cmake",)
+CMAKE_FIND_SDL_CMD = (*CMAKE_CMD, "--find-package", "-D", "NAME=SDL3", "-D", "COMPILER_ID=GNU", "-D", "LANGUAGE=C")
 
 
 def check_sdl_version() -> None:

From 712e10f0c68deefff3d1fd9855f86354ceab462c Mon Sep 17 00:00:00 2001
From: Kyle Benesch <4b796c65+github@gmail.com>
Date: Sat, 28 Jun 2025 15:46:59 -0700
Subject: [PATCH 19/20] fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup!
 fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! Test
 Pyodide builds

---
 build_sdl.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/build_sdl.py b/build_sdl.py
index 02c8b1d2..5e7387bf 100755
--- a/build_sdl.py
+++ b/build_sdl.py
@@ -123,7 +123,7 @@
     )
 )
 
-CMAKE_CMD = ("emcmake", "cmake") if "PYODIDE" in os.environ else ("cmake",)
+CMAKE_CMD = ("emcmake", "cmake")
 CMAKE_FIND_SDL_CMD = (*CMAKE_CMD, "--find-package", "-D", "NAME=SDL3", "-D", "COMPILER_ID=GNU", "-D", "LANGUAGE=C")
 
 

From 850f6c563c9f7b0f0a822aeaae8100f29e20424e Mon Sep 17 00:00:00 2001
From: Kyle Benesch <4b796c65+github@gmail.com>
Date: Tue, 8 Jul 2025 02:03:31 -0700
Subject: [PATCH 20/20] fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup!
 fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup!
 Test Pyodide builds

---
 build_sdl.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/build_sdl.py b/build_sdl.py
index 5e7387bf..02c8b1d2 100755
--- a/build_sdl.py
+++ b/build_sdl.py
@@ -123,7 +123,7 @@
     )
 )
 
-CMAKE_CMD = ("emcmake", "cmake")
+CMAKE_CMD = ("emcmake", "cmake") if "PYODIDE" in os.environ else ("cmake",)
 CMAKE_FIND_SDL_CMD = (*CMAKE_CMD, "--find-package", "-D", "NAME=SDL3", "-D", "COMPILER_ID=GNU", "-D", "LANGUAGE=C")
 
 
