@@ -34,11 +34,7 @@ elif host_machine.system() == 'android'
34
34
' However it may be added in the future' ,
35
35
)
36
36
elif host_machine .system() == ' emscripten'
37
- plat = ' emscripten'
38
- error (
39
- ' The meson buildconfig of pygame-ce does not support emscripten for now. ' ,
40
- ' However it may be added in the future' ,
41
- )
37
+ plat = ' emscripten-@0@' .format(get_option (' emscripten_type' ))
42
38
else
43
39
# here it one of: cygwin, dragonfly, freebsd, gnu, haiku, netbsd, openbsd, sunos
44
40
plat = ' unix'
@@ -80,7 +76,7 @@ pg_dir = py.get_install_dir() / pg
80
76
81
77
sdl_api = get_option (' sdl_api' )
82
78
sdl = ' SDL@0@' .format(sdl_api)
83
- sdl_mixer = ' @0@_mixer' .format(sdl)
79
+ sdl_mixer = (plat == ' emscripten-pygbag ' ) ? ' @0@_mixer_ogg ' .format(sdl) : ' @0@_mixer' .format(sdl)
84
80
sdl_ttf = ' @0@_ttf' .format(sdl)
85
81
sdl_image = ' @0@_image' .format(sdl)
86
82
@@ -229,7 +225,20 @@ if plat == 'win' and host_machine.cpu_family().startswith('x86')
229
225
install_data (dlls, install_dir : pg_dir, install_tag : ' pg-tag' )
230
226
231
227
else
232
- bases = [' /usr/local' , ' /usr' , ' /opt/homebrew' , ' /opt/local' ]
228
+ if plat == ' emscripten-pygbag'
229
+ bases = [
230
+ ' /opt/python-wasm-sdk/emsdk/upstream/emscripten/cache/sysroot' ,
231
+ ' /opt/python-wasm-sdk/devices/emsdk/usr'
232
+ ]
233
+ add_global_arguments ([' -DBUILD_STATIC' ], language : ' c' )
234
+ elif plat == ' emscripten-generic'
235
+ # TODO: check if these bases are valid in pyodide
236
+ bases = [' /usr/local' , ' /usr' , ' /opt/local' ]
237
+ add_global_arguments ([' -DBUILD_STATIC' ], language : ' c' )
238
+ else
239
+ bases = [' /usr/local' , ' /usr' , ' /opt/homebrew' , ' /opt/local' ]
240
+ endif
241
+
233
242
foreach inc_dir : bases
234
243
foreach sub_inc : [
235
244
'' ,
244
253
endforeach
245
254
246
255
foreach lib_dir : bases
247
- foreach sub_lib : [' lib' , ' lib64' ]
256
+ foreach sub_lib : [' lib' , ' lib64' , ' lib/wasm32-emscripten/pic ' , ' lib/wasm32-emscripten ' ]
248
257
full_lib = lib_dir / sub_lib
249
258
if fs.exists(full_lib)
250
259
pg_lib_dirs += full_lib
@@ -312,7 +321,7 @@ if not freetype_dep.found()
312
321
endif
313
322
314
323
portmidi_dep = dependency (' portmidi' , required : false )
315
- if not portmidi_dep.found()
324
+ if not portmidi_dep.found() and not plat.startswith( ' emscripten ' )
316
325
portmidi_dep = declare_dependency (
317
326
include_directories : pg_inc_dirs,
318
327
dependencies : cc.find_library (
@@ -436,7 +445,7 @@ endif
436
445
subdir (' src_c' )
437
446
subdir (' src_py' )
438
447
439
- if not get_option (' stripped' )
448
+ if not get_option (' stripped' ) and not plat.startswith( ' emscripten ' )
440
449
# run make_docs and make docs
441
450
if not fs.is_dir(' docs/generated' )
442
451
make_docs = files (' buildconfig/make_docs.py' )
0 commit comments