Mercurial > hg > orthanc
annotate OrthancFramework/Resources/CMake/WebAssembly/ArithmeticTests/CMakeLists.txt @ 5023:c8c98389080f
use constant for multiply occurring string
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 17 Jun 2022 07:23:57 +0200 |
parents | 43e613a7756b |
children | 0ea402b4d901 |
rev | line source |
---|---|
4120
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4049
diff
changeset
|
1 # Orthanc - A Lightweight, RESTful DICOM Store |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4049
diff
changeset
|
2 # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4049
diff
changeset
|
3 # Department, University Hospital of Liege, Belgium |
4870
43e613a7756b
upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4831
diff
changeset
|
4 # Copyright (C) 2017-2022 Osimis S.A., Belgium |
43e613a7756b
upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4831
diff
changeset
|
5 # Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
4120
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4049
diff
changeset
|
6 # |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4049
diff
changeset
|
7 # This program is free software: you can redistribute it and/or |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4049
diff
changeset
|
8 # modify it under the terms of the GNU Lesser General Public License |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4049
diff
changeset
|
9 # as published by the Free Software Foundation, either version 3 of |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4049
diff
changeset
|
10 # the License, or (at your option) any later version. |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4049
diff
changeset
|
11 # |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4049
diff
changeset
|
12 # This program is distributed in the hope that it will be useful, but |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4049
diff
changeset
|
13 # WITHOUT ANY WARRANTY; without even the implied warranty of |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4049
diff
changeset
|
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4049
diff
changeset
|
15 # Lesser General Public License for more details. |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4049
diff
changeset
|
16 # |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4049
diff
changeset
|
17 # You should have received a copy of the GNU Lesser General Public |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4049
diff
changeset
|
18 # License along with this program. If not, see |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4049
diff
changeset
|
19 # <http://www.gnu.org/licenses/>. |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4049
diff
changeset
|
20 |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4049
diff
changeset
|
21 |
4049
47e9e788224c
removing occurrences of ORTHANC_ROOT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
22 # source ~/Downloads/emsdk/emsdk_env.sh |
4315
e62bd014ae5c
removed EMSCRIPTEN_SET_LLVM_WASM_BACKEND option for CMake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4120
diff
changeset
|
23 # cmake .. -DCMAKE_TOOLCHAIN_FILE=${EMSDK}/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=/tmp/wasm-install/ |
2510
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
24 # make install |
4049
47e9e788224c
removing occurrences of ORTHANC_ROOT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
25 # cd /tmp/wasm-install |
47e9e788224c
removing occurrences of ORTHANC_ROOT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
26 # python -m SimpleHTTPServer 8000 |
47e9e788224c
removing occurrences of ORTHANC_ROOT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
27 # firefox http://localhost:8000/ |
2510
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
28 # -> Copy the result as "../arith.h" |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
29 |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
30 |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
31 cmake_minimum_required(VERSION 2.8.3) |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
32 |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
33 |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
34 ##################################################################### |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
35 ## Configuration of the Emscripten compiler for WebAssembly target |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
36 ##################################################################### |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
37 |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
38 set(WASM_FLAGS "-s WASM=1 -s DISABLE_EXCEPTION_CATCHING=0") |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
39 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WASM_FLAGS}") |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
40 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WASM_FLAGS}") |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
41 |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
42 # Turn on support for debug exceptions |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
43 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s DISABLE_EXCEPTION_CATCHING=0") |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
44 |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
45 |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
46 ##################################################################### |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
47 ## Prepare DCMTK 3.6.2 |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
48 ##################################################################### |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
49 |
4049
47e9e788224c
removing occurrences of ORTHANC_ROOT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
50 include(${CMAKE_SOURCE_DIR}/../../Compiler.cmake) |
47e9e788224c
removing occurrences of ORTHANC_ROOT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
51 include(${CMAKE_SOURCE_DIR}/../../DownloadPackage.cmake) |
2510
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
52 |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
53 set(DCMTK_SOURCES_DIR ${CMAKE_BINARY_DIR}/dcmtk-3.6.2) |
3135 | 54 set(DCMTK_URL "http://orthanc.osimis.io/ThirdPartyDownloads/dcmtk-3.6.2.tar.gz") |
2510
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
55 set(DCMTK_MD5 "d219a4152772985191c9b89d75302d12") |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
56 |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
57 if (IS_DIRECTORY "${DCMTK_SOURCES_DIR}") |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
58 set(FirstRun OFF) |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
59 else() |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
60 set(FirstRun ON) |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
61 endif() |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
62 |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
63 DownloadPackage(${DCMTK_MD5} ${DCMTK_URL} "${DCMTK_SOURCES_DIR}") |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
64 |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
65 if (FirstRun) |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
66 message("Patching file") |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
67 execute_process( |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
68 COMMAND ${PATCH_EXECUTABLE} -p0 -N -i |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
69 ${CMAKE_SOURCE_DIR}/arith.patch |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
70 WORKING_DIRECTORY ${DCMTK_SOURCES_DIR}/config/tests |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
71 RESULT_VARIABLE Failure |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
72 ) |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
73 |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
74 if (Failure) |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
75 message(FATAL_ERROR "Error while patching a file") |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
76 endif() |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
77 endif() |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
78 |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
79 |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
80 ##################################################################### |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
81 ## Build the DCMTK tests for arithmetics |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
82 ##################################################################### |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
83 |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
84 # https://github.com/kripken/emscripten/wiki/WebAssembly#web-server-setup |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
85 file(WRITE ${CMAKE_BINARY_DIR}/.htaccess " |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
86 AddType application/wasm .wasm |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
87 AddOutputFilterByType DEFLATE application/wasm |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
88 ") |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
89 |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
90 file(WRITE ${CMAKE_BINARY_DIR}/dcmtk/config/osconfig.h " |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
91 #pragma once |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
92 #define HAVE_CMATH 1 |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
93 #define HAVE_MATH_H 1 |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
94 #define HAVE_PROTOTYPE_FINITE 1 |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
95 #define HAVE_PROTOTYPE_STD__ISINF 1 |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
96 #define HAVE_PROTOTYPE_STD__ISNAN 1 |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
97 #define HAVE_STD_NAMESPACE 1 |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
98 #define HAVE_STRSTREAM 1 |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
99 #define SIZEOF_VOID_P 4 |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
100 #define USE_STD_CXX_INCLUDES |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
101 ") |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
102 |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
103 include_directories( |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
104 ${DCMTK_SOURCES_DIR}/ofstd/include |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
105 ${CMAKE_BINARY_DIR} |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
106 ) |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
107 |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
108 add_executable(dcmtk |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
109 ${DCMTK_SOURCES_DIR}/config/tests/arith.cc |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
110 ${CMAKE_SOURCE_DIR}/Run2.cpp |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
111 ) |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
112 |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
113 install(TARGETS dcmtk DESTINATION .) |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
114 |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
115 install(FILES |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
116 ${CMAKE_BINARY_DIR}/.htaccess |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
117 ${CMAKE_BINARY_DIR}/dcmtk.wasm |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
118 ${CMAKE_SOURCE_DIR}/app.js |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
119 ${CMAKE_SOURCE_DIR}/index.html |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
120 DESTINATION . |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
121 ) |