Enable Emscripten threading for MuJoCo WASM builds.

PiperOrigin-RevId: 863309872
Change-Id: I2edabb386f3abc74e507d0419b136b1586d01241
This commit is contained in:
Google DeepMind
2026-01-30 10:57:12 -08:00
committed by Copybara-Service
parent b073cd2ca4
commit 7418d86eda
6 changed files with 80 additions and 9 deletions
+2 -5
View File
@@ -14,8 +14,6 @@
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/wasm/dist")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++20 -O3 -fexceptions")
set(CMAKE_INSTALL_PREFIX ${PROJECT_SOURCE_DIR}/wasm)
include_directories(${PROJECT_SOURCE_DIR}/include)
@@ -33,12 +31,11 @@ if(NOT MUJOCO_WASM_FILES)
message(FATAL_ERROR "No source files found in codegen/generated/")
endif()
add_compile_options(-pthread)
add_compile_options(-fexceptions)
# Set Emscripten linker flags
set(EMCC_LINKER_FLAGS
"--bind"
"-pthread"
"-s PTHREAD_POOL_SIZE=navigator.hardwareConcurrency"
"-s ASSERTIONS=1"
"-s ALLOW_MEMORY_GROWTH=1"
"-s EXPORT_ES6=1"