# HG changeset patch # User Sebastien Jodogne # Date 1647861145 -3600 # Node ID fc6009c43bd97aba1373ef69bac5e32dcb5bcdc4 # Parent 9c52c0376ad7091411c32a7808bc94f707945f96 sync diff -r 9c52c0376ad7 -r fc6009c43bd9 OrthancStone/Resources/Orthanc/CMake/EmscriptenParameters.cmake --- a/OrthancStone/Resources/Orthanc/CMake/EmscriptenParameters.cmake Mon Mar 21 10:29:47 2022 +0100 +++ b/OrthancStone/Resources/Orthanc/CMake/EmscriptenParameters.cmake Mon Mar 21 12:12:25 2022 +0100 @@ -25,6 +25,12 @@ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s BINARYEN_TRAP_MODE='\"${EMSCRIPTEN_TRAP_MODE}\"'") endif() +# If "-O3" is used (the default in "Release" mode), this results in a +# too large memory consumption in "wasm-opt", at least in Emscripten +# 3.1.7, which ultimately crashes the compiler. So we force "-O2" +# (this also has the advantage of speeding up the build): +set(CMAKE_CXX_FLAGS_RELEASE "-O2") + # "DISABLE_EXCEPTION_CATCHING" is a "compile+link" option. HOWEVER, # setting it inside "WASM_FLAGS" creates link errors, at least with # side modules. TODO: Understand why