comparison OrthancFramework/Resources/CMake/EmscriptenParameters.cmake @ 4949:49bd6504f15e

fix builds on recent versions of emscripten
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 21 Mar 2022 12:11:21 +0100
parents 43e613a7756b
children 15ce7af202f1
comparison
equal deleted inserted replaced
4948:5f6b13202e85 4949:49bd6504f15e
23 23
24 if (NOT "${EMSCRIPTEN_TRAP_MODE}" STREQUAL "") 24 if (NOT "${EMSCRIPTEN_TRAP_MODE}" STREQUAL "")
25 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s BINARYEN_TRAP_MODE='\"${EMSCRIPTEN_TRAP_MODE}\"'") 25 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s BINARYEN_TRAP_MODE='\"${EMSCRIPTEN_TRAP_MODE}\"'")
26 endif() 26 endif()
27 27
28 # If "-O3" is used (the default in "Release" mode), this results in a
29 # too large memory consumption in "wasm-opt", at least in Emscripten
30 # 3.1.7, which ultimately crashes the compiler. So we force "-O2"
31 # (this also has the advantage of speeding up the build):
32 set(CMAKE_CXX_FLAGS_RELEASE "-O2")
33
28 # "DISABLE_EXCEPTION_CATCHING" is a "compile+link" option. HOWEVER, 34 # "DISABLE_EXCEPTION_CATCHING" is a "compile+link" option. HOWEVER,
29 # setting it inside "WASM_FLAGS" creates link errors, at least with 35 # setting it inside "WASM_FLAGS" creates link errors, at least with
30 # side modules. TODO: Understand why 36 # side modules. TODO: Understand why
31 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s DISABLE_EXCEPTION_CATCHING=0") 37 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s DISABLE_EXCEPTION_CATCHING=0")
38
39 # "-Wno-unused-command-line-argument" is used to avoid annoying
40 # warnings about setting WASM, FETCH and ASSERTIONS, which was
41 # required for earlier versions of emsdk:
42 # https://groups.google.com/g/emscripten-discuss/c/VX4enWfadUE
43 set(WASM_FLAGS "${WASM_FLAGS} -Wno-unused-command-line-argument")
44
32 #set(WASM_FLAGS "${WASM_FLAGS} -s DISABLE_EXCEPTION_CATCHING=0") 45 #set(WASM_FLAGS "${WASM_FLAGS} -s DISABLE_EXCEPTION_CATCHING=0")
33 46
34 if (EMSCRIPTEN_TARGET_MODE STREQUAL "wasm") 47 if (EMSCRIPTEN_TARGET_MODE STREQUAL "wasm")
35 # WebAssembly 48 # WebAssembly
36 set(WASM_FLAGS "${WASM_FLAGS} -s WASM=1") 49 set(WASM_FLAGS "${WASM_FLAGS} -s WASM=1")