-
-
Save ochafik/b1c42ecd8e5ada94ba5186de23de12c2 to your computer and use it in GitHub Desktop.
Emscripten OpenSCAD Updated Options
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if (CMAKE_SYSTEM_NAME STREQUAL Emscripten) | |
| set(Boost_USE_STATIC_LIBS ON CACHE BOOL "" FORCE) | |
| set(Boost_USE_STATIC_RUNTIME ON CACHE BOOL "" FORCE) | |
| set(ENABLE_CAIRO OFF CACHE BOOL "" FORCE) | |
| set(ENABLE_TBB OFF CACHE BOOL "" FORCE) | |
| set(NULLGL ON CACHE BOOL "" FORCE) | |
| set(USE_MIMALLOC OFF CACHE BOOL "" FORCE) | |
| set(ENV{PKG_CONFIG_PATH} "/emsdk/upstream/emscripten/cache/sysroot/lib/pkgconfig") | |
| target_compile_definitions(OpenSCAD PRIVATE CGAL_DISABLE_ROUNDING_MATH_CHECK) | |
| # https://emscripten.org/docs/tools_reference/emcc.html | |
| target_compile_options(OpenSCAD PRIVATE -fexceptions) | |
| target_link_libraries(OpenSCAD PRIVATE /emsdk/upstream/emscripten/cache/sysroot/lib/libz.a) | |
| target_link_options(OpenSCAD PUBLIC | |
| # https://emscripten.org/docs/tools_reference/settings_reference.html | |
| -sALLOW_MEMORY_GROWTH=1 | |
| -sEXIT_RUNTIME=1 | |
| -sEXPORTED_RUNTIME_METHODS=['FS','ENV','PATH','callMain','ERRNO_CODES'] | |
| -sFORCE_FILESYSTEM=1 | |
| -fexceptions | |
| -sDISABLE_EXCEPTION_CATCHING=0 | |
| $<$<CONFIG:Debug>:-sMALLOC=emmalloc-memvalidate> | |
| $<$<CONFIG:Debug>:-sASSERTIONS=2> | |
| $<$<CONFIG:Debug>:-sSTACK_OVERFLOW_CHECK=2> | |
| $<$<CONFIG:Debug>:-sEXCEPTION_DEBUG> | |
| # Manifold uses threads well on web | |
| # -sUSE_PTHREADS=0 | |
| # Options that sound good but seem broken: | |
| # -sSTRICT | |
| # $<$<CONFIG:Debug>:-sSAFE_HEAP=1> | |
| # $<$<CONFIG:Debug>:-sCHECK_NULL_WRITES> | |
| ) | |
| if (WASM_BUILD_TYPE STREQUAL "node") | |
| # SHARED_MEMORY | |
| target_link_options(OpenSCAD PUBLIC | |
| -sENVIRONMENT=node | |
| -sSINGLE_FILE | |
| -sNODERAWFS | |
| -sNODEJS_CATCH_EXIT | |
| -sNODE_CODE_CACHING # (maybe broken) | |
| -sABORT_ON_WASM_EXCEPTIONS | |
| -sLOAD_SOURCE_MAP | |
| ) | |
| elseif (WASM_BUILD_TYPE STREQUAL "web") | |
| target_link_options(OpenSCAD PUBLIC | |
| -sENVIRONMENT=web,worker | |
| -sMODULARIZE=1 | |
| -sEXPORT_ES6=1 | |
| -sEXPORT_NAME=OpenSCAD | |
| ) | |
| else() | |
| message(FATAL_ERROR "Invalid WASM_BUILD_TYPE: ${WASM_BUILD_TYPE} (allowed: node, web)") | |
| endif() | |
| endif() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment