annotate OrthancFramework/Resources/CMake/WebAssembly/ArithmeticTests/CMakeLists.txt @ 4119:bf7b9edf6b81 framework-lgpl

re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 07 Jul 2020 19:17:56 +0200
parents 47e9e788224c
children 304842a0d152
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4049
47e9e788224c removing occurrences of ORTHANC_ROOT
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
1 # source ~/Downloads/emsdk/emsdk_env.sh
47e9e788224c removing occurrences of ORTHANC_ROOT
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
2 # cmake .. -DCMAKE_TOOLCHAIN_FILE=${EMSDK}/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -DCMAKE_BUILD_TYPE=Debug -DEMSCRIPTEN_SET_LLVM_WASM_BACKEND=ON -DCMAKE_INSTALL_PREFIX=/tmp/wasm-install/
2510
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 # make install
4049
47e9e788224c removing occurrences of ORTHANC_ROOT
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
4 # cd /tmp/wasm-install
47e9e788224c removing occurrences of ORTHANC_ROOT
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
5 # python -m SimpleHTTPServer 8000
47e9e788224c removing occurrences of ORTHANC_ROOT
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
6 # firefox http://localhost:8000/
2510
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 # -> Copy the result as "../arith.h"
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 cmake_minimum_required(VERSION 2.8.3)
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 #####################################################################
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 ## Configuration of the Emscripten compiler for WebAssembly target
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 #####################################################################
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 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
18 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WASM_FLAGS}")
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WASM_FLAGS}")
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 # Turn on support for debug exceptions
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 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
23
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 #####################################################################
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 ## Prepare DCMTK 3.6.2
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 #####################################################################
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28
4049
47e9e788224c removing occurrences of ORTHANC_ROOT
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
29 include(${CMAKE_SOURCE_DIR}/../../Compiler.cmake)
47e9e788224c removing occurrences of ORTHANC_ROOT
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
30 include(${CMAKE_SOURCE_DIR}/../../DownloadPackage.cmake)
2510
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 set(DCMTK_SOURCES_DIR ${CMAKE_BINARY_DIR}/dcmtk-3.6.2)
3135
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2510
diff changeset
33 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
34 set(DCMTK_MD5 "d219a4152772985191c9b89d75302d12")
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 if (IS_DIRECTORY "${DCMTK_SOURCES_DIR}")
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 set(FirstRun OFF)
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 else()
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 set(FirstRun ON)
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 endif()
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 DownloadPackage(${DCMTK_MD5} ${DCMTK_URL} "${DCMTK_SOURCES_DIR}")
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 if (FirstRun)
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 message("Patching file")
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 execute_process(
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 COMMAND ${PATCH_EXECUTABLE} -p0 -N -i
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 ${CMAKE_SOURCE_DIR}/arith.patch
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 WORKING_DIRECTORY ${DCMTK_SOURCES_DIR}/config/tests
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 RESULT_VARIABLE Failure
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 )
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 if (Failure)
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 message(FATAL_ERROR "Error while patching a file")
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 endif()
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 endif()
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 #####################################################################
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 ## Build the DCMTK tests for arithmetics
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 #####################################################################
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 # 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
64 file(WRITE ${CMAKE_BINARY_DIR}/.htaccess "
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 AddType application/wasm .wasm
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 AddOutputFilterByType DEFLATE application/wasm
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67 ")
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 file(WRITE ${CMAKE_BINARY_DIR}/dcmtk/config/osconfig.h "
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 #pragma once
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 #define HAVE_CMATH 1
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72 #define HAVE_MATH_H 1
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73 #define HAVE_PROTOTYPE_FINITE 1
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74 #define HAVE_PROTOTYPE_STD__ISINF 1
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75 #define HAVE_PROTOTYPE_STD__ISNAN 1
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76 #define HAVE_STD_NAMESPACE 1
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77 #define HAVE_STRSTREAM 1
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78 #define SIZEOF_VOID_P 4
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79 #define USE_STD_CXX_INCLUDES
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
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82 include_directories(
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83 ${DCMTK_SOURCES_DIR}/ofstd/include
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84 ${CMAKE_BINARY_DIR}
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85 )
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87 add_executable(dcmtk
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88 ${DCMTK_SOURCES_DIR}/config/tests/arith.cc
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89 ${CMAKE_SOURCE_DIR}/Run2.cpp
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90 )
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92 install(TARGETS dcmtk DESTINATION .)
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94 install(FILES
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95 ${CMAKE_BINARY_DIR}/.htaccess
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96 ${CMAKE_BINARY_DIR}/dcmtk.wasm
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97 ${CMAKE_SOURCE_DIR}/app.js
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98 ${CMAKE_SOURCE_DIR}/index.html
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99 DESTINATION .
04873915beaf configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100 )