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