From 01c43f5eef32bec26377a940ae09bb0e66a4b8f6 Mon Sep 17 00:00:00 2001 From: Logan McNaughton Date: Thu, 22 Sep 2016 15:37:41 -0600 Subject: [PATCH 1/2] Allow pthread support in emscripten --- Makefile.emscripten | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile.emscripten b/Makefile.emscripten index ec432a3310..43c111f1ff 100644 --- a/Makefile.emscripten +++ b/Makefile.emscripten @@ -3,9 +3,10 @@ TARGET := retroarch.js EOPT = USE_ZLIB=1 USE_SDL=2 # Emscripten specific options EOPTS = $(addprefix -s $(EMPTY), $(EOPT)) # Add '-s ' to each option +PTHREAD = 0 OS = Emscripten OBJ := -DEFINES := -DRARCH_INTERNAL -DHAVE_OVERLAY -DHAVE_MAIN +DEFINES := -DRARCH_INTERNAL -DHAVE_OVERLAY -DHAVE_MAIN -s USE_PTHREADS=$(PTHREAD) DEFINES += -DHAVE_OPENGL -DHAVE_OPENGLES -DHAVE_OPENGLES2 -DHAVE_EGL -DHAVE_OVERLAY -DHAVE_GLSL -DHAVE_FILTERS_BUILTIN HAVE_EGL = 1 @@ -36,7 +37,7 @@ endif #if you compile with SDL2 flag add this Emscripten flag "-s USE_SDL=2" to LDFLAGS: LIBS := -s USE_SDL=2 -s USE_ZLIB=1 -LDFLAGS := -L. --no-heap-copy -s USE_ZLIB=1 -s TOTAL_MEMORY=$(MEMORY) -s ASYNCIFY=$(ASYNC) \ +LDFLAGS := -L. --no-heap-copy -s USE_ZLIB=1 -s TOTAL_MEMORY=$(MEMORY) -s ASYNCIFY=$(ASYNC) -s USE_PTHREADS=$(PTHREAD) \ -s EXPORTED_FUNCTIONS="['_main', '_malloc', '_cmd_savefiles', '_cmd_save_state', '_cmd_load_state', '_cmd_take_screenshot']" \ --js-library emscripten/library_rwebaudio.js \ --js-library emscripten/library_rwebinput.js \ From 17b696c0dd3088c8a4fe7d3f8b9cc647217af047 Mon Sep 17 00:00:00 2001 From: Logan McNaughton Date: Thu, 22 Sep 2016 21:51:30 -0600 Subject: [PATCH 2/2] Add PTHREAD_POOL_SIZE --- Makefile.emscripten | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.emscripten b/Makefile.emscripten index 43c111f1ff..70549715ba 100644 --- a/Makefile.emscripten +++ b/Makefile.emscripten @@ -37,7 +37,7 @@ endif #if you compile with SDL2 flag add this Emscripten flag "-s USE_SDL=2" to LDFLAGS: LIBS := -s USE_SDL=2 -s USE_ZLIB=1 -LDFLAGS := -L. --no-heap-copy -s USE_ZLIB=1 -s TOTAL_MEMORY=$(MEMORY) -s ASYNCIFY=$(ASYNC) -s USE_PTHREADS=$(PTHREAD) \ +LDFLAGS := -L. --no-heap-copy -s USE_ZLIB=1 -s TOTAL_MEMORY=$(MEMORY) -s ASYNCIFY=$(ASYNC) -s USE_PTHREADS=$(PTHREAD) -s PTHREAD_POOL_SIZE=2 \ -s EXPORTED_FUNCTIONS="['_main', '_malloc', '_cmd_savefiles', '_cmd_save_state', '_cmd_load_state', '_cmd_take_screenshot']" \ --js-library emscripten/library_rwebaudio.js \ --js-library emscripten/library_rwebinput.js \