comparison Applications/Platforms/WebAssembly/UnitTests/CMakeLists.txt @ 1879:b4486f43394a

reorganization
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 12 Jan 2022 09:06:31 +0100
parents OrthancStone/UnitTestsSources/WebAssembly/CMakeLists.txt@a2955abe4c2e
children a05529952510
comparison
equal deleted inserted replaced
1878:c9ccd13c6a3c 1879:b4486f43394a
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 Affero 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 # Affero General Public License for more details.
16 #
17 # You should have received a copy of the GNU Affero General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19
20
21 cmake_minimum_required(VERSION 2.8.3)
22 cmake_policy(SET CMP0058 NEW)
23
24 project(OrthancStone)
25
26 set(ORTHANC_FRAMEWORK_DEFAULT_VERSION "mainline")
27 set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "hg")
28 set(ORTHANC_STONE_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}/../../../../wasm-binaries/" CACHE PATH "Where to put the WebAssembly binaries")
29
30
31 # Configuration of the Emscripten compiler for WebAssembly target
32 # ---------------------------------------------------------------
33 set(USE_WASM ON CACHE BOOL "")
34
35 set(WASM_FLAGS "-s WASM=1 -s FETCH=1 -s ASSERTIONS=1 -s DISABLE_EXCEPTION_CATCHING=0")
36 if (CMAKE_BUILD_TYPE STREQUAL "Debug")
37 set(WASM_FLAGS "${WASM_FLAGS} -s SAFE_HEAP=1")
38 endif()
39
40 set(WASM_LINKER_FLAGS "${WASM_LINKER_FLAGS} -s EXTRA_EXPORTED_RUNTIME_METHODS='[\"ccall\", \"cwrap\"]'")
41 set(WASM_LINKER_FLAGS "${WASM_LINKER_FLAGS} -s ERROR_ON_UNDEFINED_SYMBOLS=1")
42 set(WASM_LINKER_FLAGS "${WASM_LINKER_FLAGS} -s ALLOW_MEMORY_GROWTH=1 -s TOTAL_MEMORY=268435456") # 256MB + resize
43 set(WASM_LINKER_FLAGS "${WASM_LINKER_FLAGS} -s DISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=1")
44 add_definitions(
45 -DDISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=1
46 )
47
48
49 # Stone of Orthanc configuration
50 # ---------------------------------------------------------------
51 set(ALLOW_DOWNLOADS ON)
52
53 include(${CMAKE_SOURCE_DIR}/../OrthancStoneWebAssemblyParameters.cmake)
54
55 SET(ENABLE_DCMTK ON) # Necessary for the tests of the Orthanc framework
56 SET(ENABLE_PUGIXML ON) # Necessary for the tests of the Orthanc framework
57 SET(ENABLE_GOOGLE_TEST OFF)
58 SET(ENABLE_LOCALE ON) # Necessary for text rendering
59 SET(ENABLE_LUA ON) # Necessary for the tests of the Orthanc framework
60 SET(ORTHANC_SANDBOXED ON)
61
62 # this will set up the build system for Stone of Orthanc and will
63 # populate the ORTHANC_STONE_SOURCES CMake variable
64 include(${CMAKE_SOURCE_DIR}/../OrthancStoneWebAssemblyConfiguration.cmake)
65
66
67 ################################################################################
68
69 # Define the WASM module
70 # ---------------------------------------------------------------
71
72 set(USE_SYSTEM_GOOGLE_TEST OFF CACHE BOOL "Use the system version of Google Test")
73 set(USE_GOOGLE_TEST_DEBIAN_PACKAGE OFF CACHE BOOL "Use the sources of Google Test shipped with libgtest-dev (Debian only)")
74 mark_as_advanced(USE_GOOGLE_TEST_DEBIAN_PACKAGE)
75 include(${ORTHANC_STONE_ROOT}/../Resources/Orthanc/CMake/DownloadPackage.cmake)
76 include(${ORTHANC_STONE_ROOT}/../Resources/Orthanc/CMake/GoogleTestConfiguration.cmake)
77
78
79 include(${CMAKE_SOURCE_DIR}/../../../../OrthancStone/UnitTestsSources/UnitTestsSources.cmake)
80 add_executable(UnitTests
81 # Testing Stone
82 ${UNIT_TESTS_SOURCES}
83
84 # Testing the Orthanc Framework
85 ${ORTHANC_FRAMEWORK_ROOT}/../UnitTestsSources/DicomMapTests.cpp
86 ${ORTHANC_FRAMEWORK_ROOT}/../UnitTestsSources/FrameworkTests.cpp
87 ${ORTHANC_FRAMEWORK_ROOT}/../UnitTestsSources/FromDcmtkTests.cpp
88 ${ORTHANC_FRAMEWORK_ROOT}/../UnitTestsSources/ImageProcessingTests.cpp
89 ${ORTHANC_FRAMEWORK_ROOT}/../UnitTestsSources/ImageTests.cpp
90 ${ORTHANC_FRAMEWORK_ROOT}/../UnitTestsSources/JpegLosslessTests.cpp
91 ${ORTHANC_FRAMEWORK_ROOT}/../UnitTestsSources/LoggingTests.cpp
92 ${ORTHANC_FRAMEWORK_ROOT}/../UnitTestsSources/LuaTests.cpp
93 ${ORTHANC_FRAMEWORK_ROOT}/../UnitTestsSources/RestApiTests.cpp
94 ${ORTHANC_FRAMEWORK_ROOT}/../UnitTestsSources/StreamTests.cpp
95 ${ORTHANC_FRAMEWORK_ROOT}/../UnitTestsSources/ToolboxTests.cpp
96
97 # Tests that are not compatible with WebAssembly
98
99 # ${ORTHANC_FRAMEWORK_ROOT}/../UnitTestsSources/FileStorageTests.cpp
100 # ${ORTHANC_FRAMEWORK_ROOT}/../UnitTestsSources/JobsTests.cpp
101 # ${ORTHANC_FRAMEWORK_ROOT}/../UnitTestsSources/MemoryCacheTests.cpp
102 # ${ORTHANC_FRAMEWORK_ROOT}/../UnitTestsSources/SQLiteChromiumTests.cpp
103 # ${ORTHANC_FRAMEWORK_ROOT}/../UnitTestsSources/SQLiteTests.cpp
104 # ${ORTHANC_FRAMEWORK_ROOT}/../UnitTestsSources/ZipTests.cpp
105
106 # Shared files
107 ${AUTOGENERATED_SOURCES}
108 ${BOOST_EXTENDED_SOURCES}
109 ${GOOGLE_TEST_SOURCES}
110 ${ORTHANC_STONE_SOURCES}
111 )
112
113
114 # Declare installation files for the module
115 # ---------------------------------------------------------------
116 install(
117 TARGETS UnitTests
118 RUNTIME DESTINATION ${ORTHANC_STONE_INSTALL_PREFIX}/UnitTests/
119 )
120
121 # Declare installation files for the companion files (web scaffolding)
122 # please note that ${CMAKE_CURRENT_BINARY_DIR}/RtViewerWasm.js
123 # (the generated JS loader for the WASM module) is handled by the `install1`
124 # section above: it is considered to be the binary output of
125 # the linker.
126 # ---------------------------------------------------------------
127 install(
128 FILES
129 ${CMAKE_SOURCE_DIR}/index.html
130 ${CMAKE_CURRENT_BINARY_DIR}/UnitTests.wasm
131 DESTINATION ${ORTHANC_STONE_INSTALL_PREFIX}/UnitTests
132 )