comparison Applications/Samples/WebAssembly/CMakeLists.txt @ 1549:a48ae10857b1

packaging of the WebAssembly module
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 13 Aug 2020 15:56:01 +0200
parents 65eccce95882
children b5417e377636
comparison
equal deleted inserted replaced
1548:65eccce95882 1549:a48ae10857b1
14 set(WASM_FLAGS "-s WASM=1 -s FETCH=1") 14 set(WASM_FLAGS "-s WASM=1 -s FETCH=1")
15 if (CMAKE_BUILD_TYPE STREQUAL "Debug") 15 if (CMAKE_BUILD_TYPE STREQUAL "Debug")
16 set(WASM_FLAGS "${WASM_FLAGS} -s SAFE_HEAP=1") 16 set(WASM_FLAGS "${WASM_FLAGS} -s SAFE_HEAP=1")
17 endif() 17 endif()
18 18
19 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WASM_FLAGS}") 19 set(WASM_LINKER_FLAGS "${WASM_LINKER_FLAGS} -s EXTRA_EXPORTED_RUNTIME_METHODS='[\"ccall\", \"cwrap\"]'")
20 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WASM_FLAGS}") 20 set(WASM_LINKER_FLAGS "${WASM_LINKER_FLAGS} -s ERROR_ON_UNDEFINED_SYMBOLS=1")
21 21 set(WASM_LINKER_FLAGS "${WASM_LINKER_FLAGS} -s ASSERTIONS=1 -s DISABLE_EXCEPTION_CATCHING=0")
22 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s EXTRA_EXPORTED_RUNTIME_METHODS='[\"ccall\", \"cwrap\"]'") 22 set(WASM_LINKER_FLAGS "${WASM_LINKER_FLAGS} -s ALLOW_MEMORY_GROWTH=1 -s TOTAL_MEMORY=268435456") # 256MB + resize
23 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s ERROR_ON_UNDEFINED_SYMBOLS=1") 23 set(WASM_LINKER_FLAGS "${WASM_LINKER_FLAGS} -s DISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=1")
24 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s ASSERTIONS=1 -s DISABLE_EXCEPTION_CATCHING=0")
25 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s ALLOW_MEMORY_GROWTH=1 -s TOTAL_MEMORY=268435456") # 256MB + resize
26 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s DISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=1")
27 add_definitions( 24 add_definitions(
28 -DDISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=1 25 -DDISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=1
29 ) 26 )
27
30 28
31 # Stone of Orthanc configuration 29 # Stone of Orthanc configuration
32 # --------------------------------------------------------------- 30 # ---------------------------------------------------------------
33 set(ALLOW_DOWNLOADS ON) 31 set(ALLOW_DOWNLOADS ON)
34 32
76 ../Common/RtViewerApp.h 74 ../Common/RtViewerApp.h
77 ../Common/RtViewerView.cpp 75 ../Common/RtViewerView.cpp
78 ../Common/RtViewerView.h 76 ../Common/RtViewerView.h
79 ) 77 )
80 78
79 set_target_properties(RtViewerWasm
80 PROPERTIES
81 COMPILE_FLAGS "${WASM_FLAGS}"
82 LINK_FLAGS "${WASM_LINKER_FLAGS}"
83 )
84
81 target_link_libraries(RtViewerWasm OrthancStone) 85 target_link_libraries(RtViewerWasm OrthancStone)
82 86
83 # Declare installation files for the module 87 # Declare installation files for the module
84 # --------------------------------------------------------------- 88 # ---------------------------------------------------------------
85 install( 89 install(
110 114
111 add_executable(SingleFrameViewerWasm 115 add_executable(SingleFrameViewerWasm
112 SingleFrameViewer/SingleFrameViewer.cpp 116 SingleFrameViewer/SingleFrameViewer.cpp
113 ) 117 )
114 118
119 set_target_properties(SingleFrameViewerWasm
120 PROPERTIES
121 COMPILE_FLAGS "${WASM_FLAGS}"
122 LINK_FLAGS "${WASM_LINKER_FLAGS}"
123 )
124
115 target_link_libraries(SingleFrameViewerWasm OrthancStone) 125 target_link_libraries(SingleFrameViewerWasm OrthancStone)
116 126
117 # Declare installation files for the module 127 # Declare installation files for the module
118 # --------------------------------------------------------------- 128 # ---------------------------------------------------------------
119 install( 129 install(