Files
Mujoco_WASM/cmake/ccd-support-emscripten.patch
T
Matias Manevi 4086261714 Add JavaScript bindings and WASM support
Co-authored-by: Matija Kecman <matijak@google.com>
Co-authored-by: Sebastian Noreña Rendón <sebas.norena@creativa77.com.ar>
Co-authored-by: Kyle Bayes <kylebayes@google.com>
PiperOrigin-RevId: 826479070
Change-Id: I25acf36e6c20b091d8492e10798d028ae66f6733
2025-10-31 07:21:18 -07:00

23 lines
724 B
Diff

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 1407080..b4dea44 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -49,9 +49,14 @@ target_include_directories(ccd PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>)
if(NOT WIN32)
- find_library(LIBM_LIBRARY NAMES m)
- if(NOT LIBM_LIBRARY)
- message(FATAL_ERROR "Could NOT find required library LibM")
+ if (EMSCRIPTEN)
+ set(LIBM_LIBRARY "-lm")
+ message("Subtitute LibM with emscripten -lm")
+ else()
+ find_library(LIBM_LIBRARY NAMES m)
+ if(NOT LIBM_LIBRARY)
+ message(FATAL_ERROR "Could NOT find required library LibM")
+ endif()
endif()
target_link_libraries(ccd "${LIBM_LIBRARY}")
if(BUILD_SHARED_LIBS)