Mercurial > hg > orthanc-stone
annotate OrthancStone/Resources/Orthanc/CMake/EmscriptenParameters.cmake @ 1739:9ac2a65d4172
upgrade to year 2021
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 06 Jan 2021 17:50:00 +0100 |
parents | a48ae10857b1 |
children | da224ae2a994 |
rev | line source |
---|---|
1549
a48ae10857b1
packaging of the WebAssembly module
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1 # Orthanc - A Lightweight, RESTful DICOM Store |
a48ae10857b1
packaging of the WebAssembly module
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2 # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
a48ae10857b1
packaging of the WebAssembly module
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3 # Department, University Hospital of Liege, Belgium |
1739
9ac2a65d4172
upgrade to year 2021
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1549
diff
changeset
|
4 # Copyright (C) 2017-2021 Osimis S.A., Belgium |
1549
a48ae10857b1
packaging of the WebAssembly module
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
5 # |
a48ae10857b1
packaging of the WebAssembly module
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
6 # This program is free software: you can redistribute it and/or |
a48ae10857b1
packaging of the WebAssembly module
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
7 # modify it under the terms of the GNU Lesser General Public License |
a48ae10857b1
packaging of the WebAssembly module
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
8 # as published by the Free Software Foundation, either version 3 of |
a48ae10857b1
packaging of the WebAssembly module
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
9 # the License, or (at your option) any later version. |
a48ae10857b1
packaging of the WebAssembly module
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
10 # |
a48ae10857b1
packaging of the WebAssembly module
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
11 # This program is distributed in the hope that it will be useful, but |
a48ae10857b1
packaging of the WebAssembly module
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
12 # WITHOUT ANY WARRANTY; without even the implied warranty of |
a48ae10857b1
packaging of the WebAssembly module
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
a48ae10857b1
packaging of the WebAssembly module
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
14 # Lesser General Public License for more details. |
a48ae10857b1
packaging of the WebAssembly module
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
15 # |
a48ae10857b1
packaging of the WebAssembly module
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
16 # You should have received a copy of the GNU Lesser General Public |
a48ae10857b1
packaging of the WebAssembly module
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
17 # License along with this program. If not, see |
a48ae10857b1
packaging of the WebAssembly module
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
18 # <http://www.gnu.org/licenses/>. |
a48ae10857b1
packaging of the WebAssembly module
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
19 |
a48ae10857b1
packaging of the WebAssembly module
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
20 |
a48ae10857b1
packaging of the WebAssembly module
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
21 # https://github.com/emscripten-core/emscripten/blob/master/src/settings.js |
a48ae10857b1
packaging of the WebAssembly module
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
22 |
a48ae10857b1
packaging of the WebAssembly module
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
23 if (NOT "${EMSCRIPTEN_TRAP_MODE}" STREQUAL "") |
a48ae10857b1
packaging of the WebAssembly module
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
24 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s BINARYEN_TRAP_MODE='\"${EMSCRIPTEN_TRAP_MODE}\"'") |
a48ae10857b1
packaging of the WebAssembly module
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
25 endif() |
a48ae10857b1
packaging of the WebAssembly module
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
26 |
a48ae10857b1
packaging of the WebAssembly module
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
27 # "DISABLE_EXCEPTION_CATCHING" is a "compile+link" option. HOWEVER, |
a48ae10857b1
packaging of the WebAssembly module
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
28 # setting it inside "WASM_FLAGS" creates link errors, at least with |
a48ae10857b1
packaging of the WebAssembly module
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
29 # side modules. TODO: Understand why |
a48ae10857b1
packaging of the WebAssembly module
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
30 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s DISABLE_EXCEPTION_CATCHING=0") |
a48ae10857b1
packaging of the WebAssembly module
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
31 #set(WASM_FLAGS "${WASM_FLAGS} -s DISABLE_EXCEPTION_CATCHING=0") |
a48ae10857b1
packaging of the WebAssembly module
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
32 |
a48ae10857b1
packaging of the WebAssembly module
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
33 if (EMSCRIPTEN_TARGET_MODE STREQUAL "wasm") |
a48ae10857b1
packaging of the WebAssembly module
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
34 # WebAssembly |
a48ae10857b1
packaging of the WebAssembly module
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
35 set(WASM_FLAGS "${WASM_FLAGS} -s WASM=1") |
a48ae10857b1
packaging of the WebAssembly module
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
36 |
a48ae10857b1
packaging of the WebAssembly module
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
37 elseif (EMSCRIPTEN_TARGET_MODE STREQUAL "asm.js") |
a48ae10857b1
packaging of the WebAssembly module
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
38 # asm.js targeting IE 11 |
a48ae10857b1
packaging of the WebAssembly module
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
39 set(WASM_FLAGS "-s WASM=0 -s ASM_JS=2 -s LEGACY_VM_SUPPORT=1") |
a48ae10857b1
packaging of the WebAssembly module
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
40 |
a48ae10857b1
packaging of the WebAssembly module
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
41 else() |
a48ae10857b1
packaging of the WebAssembly module
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
42 message(FATAL_ERROR "Bad value for EMSCRIPTEN_TARGET_MODE: ${EMSCRIPTEN_TARGET_MODE}") |
a48ae10857b1
packaging of the WebAssembly module
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
43 endif() |
a48ae10857b1
packaging of the WebAssembly module
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
44 |
a48ae10857b1
packaging of the WebAssembly module
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
45 if (CMAKE_BUILD_TYPE STREQUAL "Debug") |
a48ae10857b1
packaging of the WebAssembly module
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
46 set(WASM_FLAGS "${WASM_FLAGS} -s SAFE_HEAP=1 -s ASSERTIONS=1") |
a48ae10857b1
packaging of the WebAssembly module
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
47 endif() |
a48ae10857b1
packaging of the WebAssembly module
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
48 |
a48ae10857b1
packaging of the WebAssembly module
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
49 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WASM_FLAGS}") |
a48ae10857b1
packaging of the WebAssembly module
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
50 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WASM_FLAGS}") |