From 3e5f9834d7981b2516c5a022bd1b201b5b792b6d Mon Sep 17 00:00:00 2001 From: Dhruv Gramopadhye Date: Thu, 7 Dec 2023 20:41:04 -0500 Subject: [PATCH] Add allocate function as emscripten dep Web version crashes when you try to make a constraint. After debugging, addressed the issue with this PR. Emscripten does some optimization stuff and ends up dropping certain functions, including the alloacte function called in solvespace's C++ Unwrap method. To reproduce/test bug: - Open the web version - Create a rectangle - Create a length constraint on one the rectangle edges --- cmake/Platform/Emscripten.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/Platform/Emscripten.cmake b/cmake/Platform/Emscripten.cmake index 160f2e51..93dfd202 100644 --- a/cmake/Platform/Emscripten.cmake +++ b/cmake/Platform/Emscripten.cmake @@ -10,7 +10,7 @@ set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE) # FIXME(emscripten): Suppress non-c-typedef-for-linkage warnings in solvespace.h add_compile_options(-Wno-non-c-typedef-for-linkage) - +add_link_options(-s EXPORTED_RUNTIME_METHODS=[allocate]) # Enable optimization. Workaround for "too many locals" error when runs on browser. if(CMAKE_BUILD_TYPE STREQUAL Release)