Skip to content

Commit

Permalink
Add multi-threading variants to sdl2_mixer (emscripten-core#23094)
Browse files Browse the repository at this point in the history
I added support for multi threading (-pthread) to the sdl2_mixer port. 
For me this was kind of new but I did try to follow the prinziples of
the sdl2_image adn sdl2_ttf
(emscripten-core#22946) changes.

I also changed the "_" to "-" for consistency.
  • Loading branch information
db-tech authored Jan 6, 2025
1 parent 8f63761 commit 21d9dd8
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions tools/ports/sdl2_mixer.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@

deps = ['sdl2']
variants = {
'sdl2_mixer_mp3': {'SDL2_MIXER_FORMATS': ["mp3"]},
'sdl2_mixer_none': {'SDL2_MIXER_FORMATS': []},
'sdl2_mixer-mp3': {'SDL2_MIXER_FORMATS': ['mp3']},
'sdl2_mixer-none': {'SDL2_MIXER_FORMATS': []},
'sdl2_mixer-mp3-mt': {'SDL2_MIXER_FORMATS': ['mp3'], 'PTHREADS': 1},
'sdl2_mixer-none-mt': {'SDL2_MIXER_FORMATS': [], 'PTHREADS': 1},
}


Expand All @@ -25,7 +27,9 @@ def get_lib_name(settings):

libname = 'libSDL2_mixer'
if formats != '':
libname += '_' + formats
libname += '-' + formats
if settings.PTHREADS:
libname += '-mt'
libname += '.a'

return libname
Expand Down Expand Up @@ -68,6 +72,9 @@ def create(final):
'-DMUSIC_MID_TIMIDITY',
]

if settings.PTHREADS:
flags.append('-pthread')

build_dir = ports.clear_project_build('sdl2_mixer')
include_path = os.path.join(source_path, 'include')
includes = [
Expand Down

0 comments on commit 21d9dd8

Please sign in to comment.