Skip to content

Commit

Permalink
Add pthreads option for emscripten
Browse files Browse the repository at this point in the history
  • Loading branch information
Blaquewithaq committed Mar 6, 2024
1 parent b658ccc commit 2eb0a41
Showing 1 changed file with 9 additions and 0 deletions.
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

0 comments on commit 2eb0a41

Please sign in to comment.