Mercurial > hg > orthanc
comparison OrthancFramework/Resources/WebAssembly.txt @ 4063:e00f3d089991 framework
shared library of orthanc framework
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 11 Jun 2020 16:40:34 +0200 |
parents | |
children | e62bd014ae5c |
comparison
equal
deleted
inserted
replaced
4062:0953b3dc3261 | 4063:e00f3d089991 |
---|---|
1 | |
2 ====================================== | |
3 == Notes about WebAssembly =========== | |
4 ====================================== | |
5 | |
6 | |
7 | |
8 Trap mode | |
9 ========= | |
10 | |
11 The BINARYEN_TRAP_MODE specifies what to do when divisions per zero | |
12 (and similar conditions like integer overflows) are encountered. This | |
13 can be set through the option "EMSCRIPTEN_TRAP_MODE" in Orthanc. | |
14 | |
15 | |
16 | |
17 Previous versions (<= 1.7.1) | |
18 ---------------------------- | |
19 | |
20 The "clamp" mode avoids throwing errors, as they cannot be properly | |
21 catched by "try {} catch (...)" constructions. HOWEVER, the "upstream" | |
22 backend of Emscripten (which is now the default) doesn't support this | |
23 option. | |
24 | |
25 In Orthanc <= 1.7.1, the "clamp" mode was used by default. As a | |
26 consequence, there was an old flag "EMSCRIPTEN_SET_LLVM_WASM_BACKEND" | |
27 to setting BINARYEN_TRAP_MODE. | |
28 | |
29 Here is the definition of the parameter that was in | |
30 "OrthancFrameworkParameters.cmake": | |
31 | |
32 >>>>> | |
33 set(EMSCRIPTEN_SET_LLVM_WASM_BACKEND OFF CACHE BOOL "Sets the compiler flags required to use the LLVM Web Assembly backend in emscripten") | |
34 <<<<< | |
35 | |
36 Setting this option to "ON" fixes error: "shared:ERROR: | |
37 BINARYEN_TRAP_MODE is not supported by the LLVM wasm backend" if using | |
38 the "upstream" backend of Emscripten. Here is the corresponding | |
39 implementation that was in "Compiler.cmake": | |
40 | |
41 >>>>> | |
42 if (NOT EMSCRIPTEN_SET_LLVM_WASM_BACKEND) | |
43 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s BINARYEN_TRAP_MODE='\"clamp\"'") | |
44 endif() | |
45 <<<<< | |
46 | |
47 | |
48 | |
49 | |
50 Linker flags | |
51 ============ | |
52 | |
53 Since Orthanc 1.7.2, "Compiler.cmake" doesn't set any linking option | |
54 for Emscripten. In Orthanc <= 1.7.1, the following was done: | |
55 | |
56 >>>>> | |
57 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s EXTRA_EXPORTED_RUNTIME_METHODS='[\"ccall\", \"cwrap\"]'") | |
58 <<<<< |