467
edits
Changes
no edit summary
==== Specific ideas for changes ====
As of this writing, you'd need have to disable several features of 3.1.6 to allow for a successful WASM build.
*
* In `src/userengine/user_objectsengine_crossplatform.cc comment out h`, add a conditional block specifically for Emscripten within the line that includes lodepngpreprocessor directive. Inside this block, include the `sort_r.h` header and define the `mjQUICKSORT` and `quicksortfunc` macros appropriately. Replace the bodies of This will separate the mjCHField::LoadPNG handling for Apple, Emscripten, and mjCTexture::LoadPNG functions with a single return statementother platforms.
*
* In src/engine/engine_util_errmem.c update the preprocessor condition in the mju_writeLog function by replacing __STDC_VERSION_TIME_H__ with __EMSCRIPTEN__ in the #if directive. The line should now include __EMSCRIPTEN__ in the condition.** In src/engine/engine_crossplatform.h add a conditional block specifically for Emscripten within the preprocessor directive in the engine_crossplatform.h file. Inside this block, include the sort_r.h header and define the mjQUICKSORT and quicksortfunc macros appropriately. This will separate the handling for Apple, Emscripten, and other platforms.** In the `cmake/MujocoOptions.cmake ` file, remove the `-Wno-int-in-bool-context ` compiler warning flag from the list of warnings.** In the CMakeLists.txt file, make the following changes:
In the `CMakeLists.txt` file, make the following changes:* Change the default values of the options to disable the building of examples, simulate library, tests, and Python utility libraries by setting them to OFF: * Set `MUJOCO_BUILD_EXAMPLES` to OFF. * Set `MUJOCO_BUILD_SIMULATE` to OFF. * Set `MUJOCO_BUILD_TESTS` to OFF. * Set `MUJOCO_TEST_PYTHON_UTIL` to OFF.* Remove the `lodepng` library from the `target_link_libraries` list for the `mujoco` target.
We'd suggest taking a look at https://github.com/stillonearth/MuJoCo-WASM/issues/1 (older 2.3.1 build but still relevant)
emmake make
</syntaxhighlight>
=== Notes ===
* Ensure that the Emscripten environment is correctly activated before starting the build process.
* Regularly clean the build directory to maintain a clean build environment.