comparison Applications/Samples/WebAssembly/CMakeLists.txt @ 2081:3ef91da06636

fix compatibility with Emscripten 3.1.47
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 11 Oct 2023 16:38:38 +0200
parents 07964689cb0b
children a6d5373e471c 352cb0fa57b2
comparison
equal deleted inserted replaced
2080:3ca565841402 2081:3ef91da06636
43 set(WASM_FLAGS "-s WASM=1 -s FETCH=1 -s ASSERTIONS=1 -s DISABLE_EXCEPTION_CATCHING=0") 43 set(WASM_FLAGS "-s WASM=1 -s FETCH=1 -s ASSERTIONS=1 -s DISABLE_EXCEPTION_CATCHING=0")
44 if (CMAKE_BUILD_TYPE STREQUAL "Debug") 44 if (CMAKE_BUILD_TYPE STREQUAL "Debug")
45 set(WASM_FLAGS "${WASM_FLAGS} -s SAFE_HEAP=1") 45 set(WASM_FLAGS "${WASM_FLAGS} -s SAFE_HEAP=1")
46 endif() 46 endif()
47 47
48 set(WASM_LINKER_FLAGS "${WASM_LINKER_FLAGS} -s EXTRA_EXPORTED_RUNTIME_METHODS='[\"ccall\", \"cwrap\"]'") 48 set(WASM_LINKER_FLAGS "${WASM_LINKER_FLAGS} -s EXPORTED_RUNTIME_METHODS='[\"ccall\", \"cwrap\"]'")
49 set(WASM_LINKER_FLAGS "${WASM_LINKER_FLAGS} -s ERROR_ON_UNDEFINED_SYMBOLS=1") 49 set(WASM_LINKER_FLAGS "${WASM_LINKER_FLAGS} -s ERROR_ON_UNDEFINED_SYMBOLS=1")
50 set(WASM_LINKER_FLAGS "${WASM_LINKER_FLAGS} -s ALLOW_MEMORY_GROWTH=1 -s TOTAL_MEMORY=268435456") # 256MB + resize 50 set(WASM_LINKER_FLAGS "${WASM_LINKER_FLAGS} -s ALLOW_MEMORY_GROWTH=1 -s TOTAL_MEMORY=268435456") # 256MB + resize
51 set(WASM_LINKER_FLAGS "${WASM_LINKER_FLAGS} -s DISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=1") 51 set(WASM_LINKER_FLAGS "${WASM_LINKER_FLAGS} -s DISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=1")
52 add_definitions( 52 add_definitions(
53 -DDISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=1 53 -DDISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=1
61 include(${CMAKE_SOURCE_DIR}/../../../OrthancStone/Resources/CMake/OrthancStoneWebAssemblyParameters.cmake) 61 include(${CMAKE_SOURCE_DIR}/../../../OrthancStone/Resources/CMake/OrthancStoneWebAssemblyParameters.cmake)
62 62
63 SET(ENABLE_DCMTK OFF) # Not necessary 63 SET(ENABLE_DCMTK OFF) # Not necessary
64 SET(ENABLE_GOOGLE_TEST OFF) 64 SET(ENABLE_GOOGLE_TEST OFF)
65 SET(ENABLE_LOCALE ON) # Necessary for text rendering 65 SET(ENABLE_LOCALE ON) # Necessary for text rendering
66 SET(ENABLE_MODULE_JOBS OFF)
66 SET(ORTHANC_SANDBOXED ON) 67 SET(ORTHANC_SANDBOXED ON)
67 68
68 # this will set up the build system for Stone of Orthanc and will 69 # this will set up the build system for Stone of Orthanc and will
69 # populate the ORTHANC_STONE_SOURCES CMake variable 70 # populate the ORTHANC_STONE_SOURCES CMake variable
70 include(${CMAKE_SOURCE_DIR}/../../../OrthancStone/Resources/CMake/OrthancStoneWebAssemblyConfiguration.cmake) 71 include(${CMAKE_SOURCE_DIR}/../../../OrthancStone/Resources/CMake/OrthancStoneWebAssemblyConfiguration.cmake)
86 add_library(OrthancStone STATIC 87 add_library(OrthancStone STATIC
87 ${ORTHANC_STONE_SOURCES} 88 ${ORTHANC_STONE_SOURCES}
88 ${AUTOGENERATED_SOURCES} 89 ${AUTOGENERATED_SOURCES}
89 ) 90 )
90 91
92 DefineSourceBasenameForTarget(OrthancStone)
93
94
91 ################################################################################ 95 ################################################################################
92 96
93 # Define the WASM module 97 # Define the WASM module
94 # --------------------------------------------------------------- 98 # ---------------------------------------------------------------
95 99
100 ../Common/RtViewerApp.cpp 104 ../Common/RtViewerApp.cpp
101 ../Common/RtViewerApp.h 105 ../Common/RtViewerApp.h
102 ../Common/RtViewerView.cpp 106 ../Common/RtViewerView.cpp
103 ../Common/RtViewerView.h 107 ../Common/RtViewerView.h
104 ) 108 )
109
110 DefineSourceBasenameForTarget(RtViewerWasm)
105 111
106 set_target_properties(RtViewerWasm 112 set_target_properties(RtViewerWasm
107 PROPERTIES 113 PROPERTIES
108 COMPILE_FLAGS "${WASM_FLAGS}" 114 COMPILE_FLAGS "${WASM_FLAGS}"
109 LINK_FLAGS "${WASM_LINKER_FLAGS}" 115 LINK_FLAGS "${WASM_LINKER_FLAGS}"
141 147
142 add_executable(SingleFrameViewerWasm 148 add_executable(SingleFrameViewerWasm
143 SingleFrameViewer/SingleFrameViewer.cpp 149 SingleFrameViewer/SingleFrameViewer.cpp
144 ) 150 )
145 151
152 DefineSourceBasenameForTarget(SingleFrameViewerWasm)
153
146 set_target_properties(SingleFrameViewerWasm 154 set_target_properties(SingleFrameViewerWasm
147 PROPERTIES 155 PROPERTIES
148 COMPILE_FLAGS "${WASM_FLAGS}" 156 COMPILE_FLAGS "${WASM_FLAGS}"
149 LINK_FLAGS "${WASM_LINKER_FLAGS}" 157 LINK_FLAGS "${WASM_LINKER_FLAGS}"
150 ) 158 )
169 ${CMAKE_SOURCE_DIR}/SingleFrameViewer/SingleFrameViewerApp.js 177 ${CMAKE_SOURCE_DIR}/SingleFrameViewer/SingleFrameViewerApp.js
170 ${CMAKE_SOURCE_DIR}/SingleFrameViewer/index.html 178 ${CMAKE_SOURCE_DIR}/SingleFrameViewer/index.html
171 ${CMAKE_CURRENT_BINARY_DIR}/SingleFrameViewerWasm.wasm 179 ${CMAKE_CURRENT_BINARY_DIR}/SingleFrameViewerWasm.wasm
172 DESTINATION ${ORTHANC_STONE_INSTALL_PREFIX}/SingleFrameViewer/ 180 DESTINATION ${ORTHANC_STONE_INSTALL_PREFIX}/SingleFrameViewer/
173 ) 181 )
182
183
184 # Boost::Math begs for -std=c++14 since Boost 1.82.0
185 set_property(TARGET OrthancStone PROPERTY CXX_STANDARD 14)
186 set_property(TARGET RtViewerWasm PROPERTY CXX_STANDARD 14)
187 set_property(TARGET SingleFrameViewerWasm PROPERTY CXX_STANDARD 14)
188