comparison OrthancStone/Resources/WebAssemblyUnitTests/CMakeLists.txt @ 1901:184b0aeae1af

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