Skip to content

v4.1.x - Add PThreads option for Emscripten #792

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ file(TOUCH "${PROJECTM_DUMMY_SOURCE_FILE}")

if(CMAKE_SYSTEM_NAME STREQUAL Emscripten)
set(ENABLE_EMSCRIPTEN ON CACHE BOOL "Build for web with emscripten. Will also build the SDL2-based entrypoint." FORCE)
option(USE_PTHREADS "Enable multithreading support" OFF)
else()
set(ENABLE_EMSCRIPTEN OFF CACHE BOOL "Build for web with emscripten. Requires emscripten toolset for building." FORCE)
endif()
Expand Down Expand Up @@ -122,6 +123,11 @@ if(ENABLE_EMSCRIPTEN)
"SHELL:-s NO_DISABLE_EXCEPTION_CATCHING"
)

if(USE_PTHREADS)
add_compile_options("SHELL:-s USE_PTHREADS=1")
add_link_options("SHELL:-s USE_PTHREADS=1")
endif()

set(USE_GLES ON)
else()
if(ENABLE_SDL_UI)
Expand Down Expand Up @@ -242,6 +248,9 @@ if(ENABLE_SDL_UI)
endif()
message(STATUS " OpenGL ES: ${ENABLE_GLES}")
message(STATUS " Emscripten: ${ENABLE_EMSCRIPTEN}")
if(CMAKE_SYSTEM_NAME STREQUAL Emscripten)
message(STATUS " - PThreads: ${USE_PTHREADS}")
endif()
message(STATUS " Use system GLM: ${ENABLE_SYSTEM_GLM}")
message(STATUS " Link UI with shared lib: ${ENABLE_SHARED_LINKING}")
message(STATUS "")
Expand Down