Skip to content

Commit d272b42

Browse files
author
Grant Karapetyan
committed
Enable pthreads in wasm build
1 parent d4295a6 commit d272b42

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,9 @@ IF(MR_EMSCRIPTEN)
8686
include_directories(${MESHLIB_THIRDPARTY_INCLUDE_DIR}/googletest/googletest/include)
8787
include_directories(${MESHLIB_THIRDPARTY_INCLUDE_DIR}/libzip/lib)
8888
include_directories(${THIRDPARTY_LIB_DIR}/libzip)
89-
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s ALLOW_MEMORY_GROWTH=1")
89+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
90+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-pthreads-mem-growth") # look https://github.com/emscripten-core/emscripten/issues/8287
91+
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pthread -s PTHREAD_POOL_SIZE_STRICT=0 -s ALLOW_MEMORY_GROWTH=1")
9092
ENDIF() # MR_EMSCRIPTEN
9193
9294
enable_testing()

thirdparty/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-sign-compare -Wno-unknown-pra
1313
-Wno-unused-function -Wno-unused-variable -Wno-comment -Wno-parentheses -Wno-int-in-bool-context -Wno-strict-aliasing")
1414
# -Werror")
1515

16+
IF(MR_EMSCRIPTEN)
17+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
18+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread")
19+
ENDIF()
20+
1621
IF(APPLE OR MR_EMSCRIPTEN)
1722
add_subdirectory(./expected ./expected)
1823
ELSE()

0 commit comments

Comments
 (0)