Mercurial > hg > orthanc-stone
comparison OrthancStone/UnitTestsSources/WebAssembly/CMakeLists.txt @ 1877:a2955abe4c2e
skeleton for the RenderingPlugin
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 12 Jan 2022 08:23:38 +0100 |
parents | UnitTestsSources/WebAssembly/CMakeLists.txt@7053b8a0aaec |
children |
comparison
equal
deleted
inserted
replaced
1876:b1f510e601d2 | 1877:a2955abe4c2e |
---|---|
1 # Stone of Orthanc | |
2 # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
3 # Department, University Hospital of Liege, Belgium | |
4 # Copyright (C) 2017-2022 Osimis S.A., Belgium | |
5 # Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium | |
6 # | |
7 # This program is free software: you can redistribute it and/or | |
8 # modify it under the terms of the GNU Lesser General Public License | |
9 # as published by the Free Software Foundation, either version 3 of | |
10 # the License, or (at your option) any later version. | |
11 # | |
12 # This program is distributed in the hope that it will be useful, but | |
13 # WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 # Lesser General Public License for more details. | |
16 # | |
17 # You should have received a copy of the GNU Lesser General Public | |
18 # License along with this program. If not, see | |
19 # <http://www.gnu.org/licenses/>. | |
20 | |
21 | |
22 cmake_minimum_required(VERSION 2.8.3) | |
23 cmake_policy(SET CMP0058 NEW) | |
24 | |
25 project(OrthancStone) | |
26 | |
27 set(ORTHANC_FRAMEWORK_DEFAULT_VERSION "mainline") | |
28 set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "hg") | |
29 set(ORTHANC_STONE_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}/../../../wasm-binaries/" CACHE PATH "Where to put the WebAssembly binaries") | |
30 | |
31 | |
32 # Configuration of the Emscripten compiler for WebAssembly target | |
33 # --------------------------------------------------------------- | |
34 set(USE_WASM ON CACHE BOOL "") | |
35 | |
36 set(WASM_FLAGS "-s WASM=1 -s FETCH=1 -s ASSERTIONS=1 -s DISABLE_EXCEPTION_CATCHING=0") | |
37 if (CMAKE_BUILD_TYPE STREQUAL "Debug") | |
38 set(WASM_FLAGS "${WASM_FLAGS} -s SAFE_HEAP=1") | |
39 endif() | |
40 | |
41 set(WASM_LINKER_FLAGS "${WASM_LINKER_FLAGS} -s EXTRA_EXPORTED_RUNTIME_METHODS='[\"ccall\", \"cwrap\"]'") | |
42 set(WASM_LINKER_FLAGS "${WASM_LINKER_FLAGS} -s ERROR_ON_UNDEFINED_SYMBOLS=1") | |
43 set(WASM_LINKER_FLAGS "${WASM_LINKER_FLAGS} -s ALLOW_MEMORY_GROWTH=1 -s TOTAL_MEMORY=268435456") # 256MB + resize | |
44 set(WASM_LINKER_FLAGS "${WASM_LINKER_FLAGS} -s DISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=1") | |
45 add_definitions( | |
46 -DDISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=1 | |
47 ) | |
48 | |
49 | |
50 # Stone of Orthanc configuration | |
51 # --------------------------------------------------------------- | |
52 set(ALLOW_DOWNLOADS ON) | |
53 | |
54 include(${CMAKE_SOURCE_DIR}/../../Applications/Platforms/WebAssembly/OrthancStoneWebAssemblyParameters.cmake) | |
55 | |
56 SET(ENABLE_DCMTK ON) # Necessary for the tests of the Orthanc framework | |
57 SET(ENABLE_PUGIXML ON) # Necessary for the tests of the Orthanc framework | |
58 SET(ENABLE_GOOGLE_TEST OFF) | |
59 SET(ENABLE_LOCALE ON) # Necessary for text rendering | |
60 SET(ENABLE_LUA ON) # Necessary for the tests of the Orthanc framework | |
61 SET(ORTHANC_SANDBOXED ON) | |
62 | |
63 # this will set up the build system for Stone of Orthanc and will | |
64 # populate the ORTHANC_STONE_SOURCES CMake variable | |
65 include(${CMAKE_SOURCE_DIR}/../../Applications/Platforms/WebAssembly/OrthancStoneWebAssemblyConfiguration.cmake) | |
66 | |
67 | |
68 ################################################################################ | |
69 | |
70 # Define the WASM module | |
71 # --------------------------------------------------------------- | |
72 | |
73 set(USE_SYSTEM_GOOGLE_TEST OFF CACHE BOOL "Use the system version of Google Test") | |
74 set(USE_GOOGLE_TEST_DEBIAN_PACKAGE OFF CACHE BOOL "Use the sources of Google Test shipped with libgtest-dev (Debian only)") | |
75 mark_as_advanced(USE_GOOGLE_TEST_DEBIAN_PACKAGE) | |
76 include(${ORTHANC_STONE_ROOT}/../Resources/Orthanc/CMake/DownloadPackage.cmake) | |
77 include(${ORTHANC_STONE_ROOT}/../Resources/Orthanc/CMake/GoogleTestConfiguration.cmake) | |
78 | |
79 | |
80 include(${CMAKE_SOURCE_DIR}/../UnitTestsSources.cmake) | |
81 add_executable(UnitTests | |
82 # Testing Stone | |
83 ${UNIT_TESTS_SOURCES} | |
84 | |
85 # Testing the Orthanc Framework | |
86 ${ORTHANC_FRAMEWORK_ROOT}/../UnitTestsSources/DicomMapTests.cpp | |
87 ${ORTHANC_FRAMEWORK_ROOT}/../UnitTestsSources/FrameworkTests.cpp | |
88 ${ORTHANC_FRAMEWORK_ROOT}/../UnitTestsSources/FromDcmtkTests.cpp | |
89 ${ORTHANC_FRAMEWORK_ROOT}/../UnitTestsSources/ImageProcessingTests.cpp | |
90 ${ORTHANC_FRAMEWORK_ROOT}/../UnitTestsSources/ImageTests.cpp | |
91 ${ORTHANC_FRAMEWORK_ROOT}/../UnitTestsSources/JpegLosslessTests.cpp | |
92 ${ORTHANC_FRAMEWORK_ROOT}/../UnitTestsSources/LoggingTests.cpp | |
93 ${ORTHANC_FRAMEWORK_ROOT}/../UnitTestsSources/LuaTests.cpp | |
94 ${ORTHANC_FRAMEWORK_ROOT}/../UnitTestsSources/RestApiTests.cpp | |
95 ${ORTHANC_FRAMEWORK_ROOT}/../UnitTestsSources/StreamTests.cpp | |
96 ${ORTHANC_FRAMEWORK_ROOT}/../UnitTestsSources/ToolboxTests.cpp | |
97 | |
98 # Tests that are not compatible with WebAssembly | |
99 | |
100 # ${ORTHANC_FRAMEWORK_ROOT}/../UnitTestsSources/FileStorageTests.cpp | |
101 # ${ORTHANC_FRAMEWORK_ROOT}/../UnitTestsSources/JobsTests.cpp | |
102 # ${ORTHANC_FRAMEWORK_ROOT}/../UnitTestsSources/MemoryCacheTests.cpp | |
103 # ${ORTHANC_FRAMEWORK_ROOT}/../UnitTestsSources/SQLiteChromiumTests.cpp | |
104 # ${ORTHANC_FRAMEWORK_ROOT}/../UnitTestsSources/SQLiteTests.cpp | |
105 # ${ORTHANC_FRAMEWORK_ROOT}/../UnitTestsSources/ZipTests.cpp | |
106 | |
107 # Shared files | |
108 ${AUTOGENERATED_SOURCES} | |
109 ${BOOST_EXTENDED_SOURCES} | |
110 ${GOOGLE_TEST_SOURCES} | |
111 ${ORTHANC_STONE_SOURCES} | |
112 ) | |
113 | |
114 | |
115 # Declare installation files for the module | |
116 # --------------------------------------------------------------- | |
117 install( | |
118 TARGETS UnitTests | |
119 RUNTIME DESTINATION ${ORTHANC_STONE_INSTALL_PREFIX}/UnitTests/ | |
120 ) | |
121 | |
122 # Declare installation files for the companion files (web scaffolding) | |
123 # please note that ${CMAKE_CURRENT_BINARY_DIR}/RtViewerWasm.js | |
124 # (the generated JS loader for the WASM module) is handled by the `install1` | |
125 # section above: it is considered to be the binary output of | |
126 # the linker. | |
127 # --------------------------------------------------------------- | |
128 install( | |
129 FILES | |
130 ${CMAKE_SOURCE_DIR}/index.html | |
131 ${CMAKE_CURRENT_BINARY_DIR}/UnitTests.wasm | |
132 DESTINATION ${ORTHANC_STONE_INSTALL_PREFIX}/UnitTests | |
133 ) |