@@ -251,14 +251,18 @@ def on_directive_handle(
251251
252252check_sdl_version ()
253253
254- if sys .platform == "win32" or sys .platform == "darwin" :
254+ SDL_PARSE_PATH : Path | None = None
255+ SDL_BUNDLE_PATH : Path | None = None
256+ if (sys .platform == "win32" or sys .platform == "darwin" ) and "PYODIDE" not in os .environ :
255257 SDL_PARSE_PATH = unpack_sdl (SDL_PARSE_VERSION )
256258 SDL_BUNDLE_PATH = unpack_sdl (SDL_BUNDLE_VERSION )
257259
258260SDL_INCLUDE : Path
259- if sys .platform == "win32" :
261+ if "PYODIDE" in os .environ :
262+ SDL_INCLUDE = Path (os .environ ["EMSDK" ], "include" )
263+ elif sys .platform == "win32" and SDL_PARSE_PATH is not None :
260264 SDL_INCLUDE = SDL_PARSE_PATH / "include"
261- elif sys .platform == "darwin" :
265+ elif sys .platform == "darwin" and SDL_PARSE_PATH is not None :
262266 SDL_INCLUDE = SDL_PARSE_PATH / "Versions/A/Headers"
263267else : # Unix
264268 matches = re .findall (
@@ -275,6 +279,7 @@ def on_directive_handle(
275279 raise AssertionError (matches )
276280 assert SDL_INCLUDE
277281
282+ logger .info (f"{ SDL_INCLUDE = } " )
278283
279284EXTRA_CDEF = """
280285#define SDLK_SCANCODE_MASK ...
@@ -358,7 +363,7 @@ def get_cdef() -> tuple[str, dict[str, str]]:
358363 libraries += ["SDL3" ]
359364
360365# Bundle the Windows SDL DLL.
361- if sys .platform == "win32" :
366+ if sys .platform == "win32" and SDL_BUNDLE_PATH is not None :
362367 include_dirs .append (str (SDL_INCLUDE ))
363368 ARCH_MAPPING = {"32bit" : "x86" , "64bit" : "x64" }
364369 SDL_LIB_DIR = Path (SDL_BUNDLE_PATH , "lib/" , ARCH_MAPPING [BIT_SIZE ])
@@ -372,7 +377,7 @@ def get_cdef() -> tuple[str, dict[str, str]]:
372377
373378# Link to the SDL framework on MacOS.
374379# Delocate will bundle the binaries in a later step.
375- if sys .platform == "darwin" :
380+ if sys .platform == "darwin" and SDL_BUNDLE_PATH is not None :
376381 include_dirs .append (SDL_INCLUDE )
377382 extra_link_args += [f"-F{ SDL_BUNDLE_PATH } /.." ]
378383 extra_link_args += ["-rpath" , f"{ SDL_BUNDLE_PATH } /.." ]
0 commit comments