Mercurial > hg > orthanc-stone
comparison Samples/WebAssembly/CMakeLists.txt @ 1432:758fb6958c20 loader-injection-feature
Merge from default
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Tue, 19 May 2020 07:39:03 +0200 |
parents | 9e7015edd107 |
children | 4647636334aa |
comparison
equal
deleted
inserted
replaced
1418:4e7751a4b603 | 1432:758fb6958c20 |
---|---|
1 cmake_minimum_required(VERSION 2.8.3) | |
2 | |
3 project(OrthancStone) | |
4 | |
5 # Configuration of the Emscripten compiler for WebAssembly target | |
6 # --------------------------------------------------------------- | |
7 set(USE_WASM ON CACHE BOOL "") | |
8 set(ORTHANC_FRAMEWORK_ROOT ${CMAKE_CURRENT_LIST_DIR}/../../../orthanc CACHE STRING "") | |
9 set(STONE_ROOT ${CMAKE_CURRENT_LIST_DIR}/../../) | |
10 | |
11 set(EMSCRIPTEN_SET_LLVM_WASM_BACKEND ON CACHE BOOL "") | |
12 | |
13 set(WASM_FLAGS "-s WASM=1 -s FETCH=1") | |
14 if (CMAKE_BUILD_TYPE STREQUAL "Debug") | |
15 set(WASM_FLAGS "${WASM_FLAGS} -s SAFE_HEAP=1") | |
16 endif() | |
17 | |
18 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WASM_FLAGS}") | |
19 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WASM_FLAGS}") | |
20 | |
21 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s EXTRA_EXPORTED_RUNTIME_METHODS='[\"ccall\", \"cwrap\"]'") | |
22 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s ERROR_ON_UNDEFINED_SYMBOLS=1") | |
23 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s ASSERTIONS=1 -s DISABLE_EXCEPTION_CATCHING=0") | |
24 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s ALLOW_MEMORY_GROWTH=1 -s TOTAL_MEMORY=268435456") # 256MB + resize | |
25 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s DISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=1") | |
26 add_definitions( | |
27 -DDISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=1 | |
28 ) | |
29 | |
30 # Stone of Orthanc configuration | |
31 # --------------------------------------------------------------- | |
32 set(ALLOW_DOWNLOADS ON) | |
33 set(ORTHANC_FRAMEWORK_SOURCE "path") | |
34 | |
35 include(${STONE_ROOT}/Resources/CMake/OrthancStoneParameters.cmake) | |
36 include(${ORTHANC_ROOT}/Resources/CMake/DownloadPackage.cmake) | |
37 | |
38 SET(ENABLE_DCMTK ON) | |
39 SET(ENABLE_GOOGLE_TEST OFF) | |
40 SET(ENABLE_LOCALE ON) # Necessary for text rendering | |
41 SET(ENABLE_WASM ON) | |
42 SET(ORTHANC_SANDBOXED ON) | |
43 | |
44 | |
45 # We embed a font to be used for on-screen overlays | |
46 # --------------------------------------------------------------- | |
47 | |
48 DownloadPackage( | |
49 "a24b8136b8f3bb93f166baf97d9328de" | |
50 "http://orthanc.osimis.io/ThirdPartyDownloads/ubuntu-font-family-0.83.zip" | |
51 "${CMAKE_BINARY_DIR}/ubuntu-font-family-0.83") | |
52 | |
53 set(ORTHANC_STONE_APPLICATION_RESOURCES | |
54 UBUNTU_FONT ${CMAKE_BINARY_DIR}/ubuntu-font-family-0.83/Ubuntu-R.ttf | |
55 ) | |
56 | |
57 # this will set up the build system for Stone of Orthanc and will | |
58 # populate the ORTHANC_STONE_SOURCES CMake variable | |
59 include(${STONE_ROOT}/Resources/CMake/OrthancStoneConfiguration.cmake) | |
60 | |
61 include_directories(${STONE_ROOT}) | |
62 include_directories(../Common) | |
63 | |
64 add_library(OrthancStone STATIC | |
65 ${ORTHANC_STONE_SOURCES} | |
66 ) | |
67 | |
68 ################################################################################ | |
69 | |
70 # Define the WASM module | |
71 # --------------------------------------------------------------- | |
72 | |
73 project(RtViewerWasm) | |
74 | |
75 add_executable(RtViewerWasm | |
76 RtViewer/RtViewerWasm.cpp | |
77 ../Common/RtViewerApp.cpp | |
78 ../Common/RtViewerApp.h | |
79 ../Common/RtViewerView.cpp | |
80 ../Common/RtViewerView.h | |
81 ) | |
82 | |
83 target_link_libraries(RtViewerWasm OrthancStone) | |
84 | |
85 # Declare installation files for the module | |
86 # --------------------------------------------------------------- | |
87 install( | |
88 TARGETS RtViewerWasm | |
89 RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/RtViewer/ | |
90 ) | |
91 | |
92 # Declare installation files for the companion files (web scaffolding) | |
93 # please note that ${CMAKE_CURRENT_BINARY_DIR}/RtViewerWasm.js | |
94 # (the generated JS loader for the WASM module) is handled by the `install1` | |
95 # section above: it is considered to be the binary output of | |
96 # the linker. | |
97 # --------------------------------------------------------------- | |
98 install( | |
99 FILES | |
100 ${CMAKE_SOURCE_DIR}/RtViewer/RtViewerWasmApp.js | |
101 ${CMAKE_SOURCE_DIR}/RtViewer/index.html | |
102 ${CMAKE_CURRENT_BINARY_DIR}/RtViewerWasm.wasm | |
103 DESTINATION ${CMAKE_INSTALL_PREFIX}/RtViewer/ | |
104 ) | |
105 | |
106 ################################################################################ | |
107 | |
108 # Define the WASM module | |
109 # --------------------------------------------------------------- | |
110 | |
111 project(SingleFrameViewerWasm) | |
112 | |
113 add_executable(SingleFrameViewerWasm | |
114 SingleFrameViewer/SingleFrameViewer.cpp | |
115 ) | |
116 | |
117 target_link_libraries(SingleFrameViewerWasm OrthancStone) | |
118 | |
119 # Declare installation files for the module | |
120 # --------------------------------------------------------------- | |
121 install( | |
122 TARGETS SingleFrameViewerWasm | |
123 RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/SingleFrameViewer/ | |
124 ) | |
125 | |
126 # Declare installation files for the companion files (web scaffolding) | |
127 # please note that ${CMAKE_CURRENT_BINARY_DIR}/RtViewerWasm.js | |
128 # (the generated JS loader for the WASM module) is handled by the `install1` | |
129 # section above: it is considered to be the binary output of | |
130 # the linker. | |
131 # --------------------------------------------------------------- | |
132 install( | |
133 FILES | |
134 ${CMAKE_SOURCE_DIR}/SingleFrameViewer/SingleFrameViewerApp.js | |
135 ${CMAKE_SOURCE_DIR}/SingleFrameViewer/index.html | |
136 ${CMAKE_CURRENT_BINARY_DIR}/SingleFrameViewerWasm.wasm | |
137 DESTINATION ${CMAKE_INSTALL_PREFIX}/SingleFrameViewer/ | |
138 ) |