comparison Applications/StoneWebViewer/WebAssembly/CMakeLists.txt @ 2055:d4e769a0961f deep-learning

automating invokation of protobuf in deep-learning
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 18 Apr 2023 10:53:09 +0200
parents 85ab86f10d01
children 5956d7357098
comparison
equal deleted inserted replaced
2053:0d814292a17e 2055:d4e769a0961f
22 cmake_policy(SET CMP0058 NEW) 22 cmake_policy(SET CMP0058 NEW)
23 23
24 project(OrthancStone) 24 project(OrthancStone)
25 include(${CMAKE_SOURCE_DIR}/../Version.cmake) 25 include(${CMAKE_SOURCE_DIR}/../Version.cmake)
26 26
27 include(${CMAKE_SOURCE_DIR}/deep-learning/WebAssembly/Protobuf.cmake) # TODO
28
29 set(ORTHANC_STONE_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}/../../../wasm-binaries/StoneWebViewer" CACHE PATH "Where to put the WebAssembly binaries") 27 set(ORTHANC_STONE_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}/../../../wasm-binaries/StoneWebViewer" CACHE PATH "Where to put the WebAssembly binaries")
30 28
31 29
32 # Configuration of the Emscripten compiler for WebAssembly target 30 # Configuration of the Emscripten compiler for WebAssembly target
33 # --------------------------------------------------------------- 31 # ---------------------------------------------------------------
61 SET(ENABLE_DCMTK_TRANSCODING OFF) 59 SET(ENABLE_DCMTK_TRANSCODING OFF)
62 SET(ENABLE_GOOGLE_TEST OFF) 60 SET(ENABLE_GOOGLE_TEST OFF)
63 SET(ENABLE_LOCALE ON) # Necessary for text rendering 61 SET(ENABLE_LOCALE ON) # Necessary for text rendering
64 SET(ENABLE_PUGIXML ON) # Necessary for OsiriX annotations 62 SET(ENABLE_PUGIXML ON) # Necessary for OsiriX annotations
65 SET(ORTHANC_SANDBOXED ON) 63 SET(ORTHANC_SANDBOXED ON)
64 SET(ENABLE_PROTOBUF ON) # Necessary for deep learning
65 SET(ENABLE_PROTOBUF_COMPILER ON) # Necessary for deep learning
66 66
67 # this will set up the build system for Stone of Orthanc and will 67 # this will set up the build system for Stone of Orthanc and will
68 # populate the ORTHANC_STONE_SOURCES CMake variable 68 # populate the ORTHANC_STONE_SOURCES CMake variable
69 include(${CMAKE_SOURCE_DIR}/../../../OrthancStone/Resources/CMake/OrthancStoneWebAssemblyConfiguration.cmake) 69 include(${CMAKE_SOURCE_DIR}/../../../OrthancStone/Resources/CMake/OrthancStoneWebAssemblyConfiguration.cmake)
70 70
118 ${CMAKE_SOURCE_DIR}/ParseWebAssemblyExports.py 118 ${CMAKE_SOURCE_DIR}/ParseWebAssemblyExports.py
119 OUTPUT 119 OUTPUT
120 ${STONE_WRAPPER} 120 ${STONE_WRAPPER}
121 ) 121 )
122 122
123 add_custom_target(StoneWrapper 123 add_custom_command(
124 OUTPUT
125 ${AUTOGENERATED_DIR}/DeepLearningWorker.pb.h
126 ${AUTOGENERATED_DIR}/DeepLearningWorker.pb.cc
127 COMMAND ${PROTOC_EXECUTABLE} --cpp_out=${AUTOGENERATED_DIR} -I${CMAKE_SOURCE_DIR}
128 ${CMAKE_SOURCE_DIR}/DeepLearningWorker.proto
129 DEPENDS
130 ${CMAKE_SOURCE_DIR}/DeepLearningWorker.proto
131 ProtobufCompiler
132 )
133
134 add_custom_target(AutogeneratedFiles
124 DEPENDS 135 DEPENDS
125 ${STONE_WRAPPER} 136 ${STONE_WRAPPER}
137 ${AUTOGENERATED_DIR}/DeepLearningWorker.pb.cc
126 ) 138 )
127 139
128 140
129 # Define the WASM module 141 # Define the WASM module
130 # --------------------------------------------------------------- 142 # ---------------------------------------------------------------
133 -DSTONE_WEB_VIEWER_VERSION="${STONE_WEB_VIEWER_VERSION}" 145 -DSTONE_WEB_VIEWER_VERSION="${STONE_WEB_VIEWER_VERSION}"
134 ) 146 )
135 147
136 add_executable(StoneWebViewer 148 add_executable(StoneWebViewer
137 ${ORTHANC_STONE_SOURCES} 149 ${ORTHANC_STONE_SOURCES}
138 ${AUTOGENERATED_SOURCES} 150 ${AUTOGENERATED_SOURCES} # Populated by "EmbedResources()"
139 ${PROTOBUF_SOURCES} # TODO 151 ${AUTOGENERATED_DIR}/DeepLearningWorker.pb.cc
140 ${CMAKE_SOURCE_DIR}/Worker.pb.cc # TODO
141 StoneWebViewer.cpp 152 StoneWebViewer.cpp
142 ) 153 )
143 154
144 set_target_properties(StoneWebViewer 155 set_target_properties(StoneWebViewer
145 PROPERTIES 156 PROPERTIES
146 COMPILE_FLAGS "${WASM_FLAGS}" 157 COMPILE_FLAGS "${WASM_FLAGS}"
147 LINK_FLAGS "${WASM_LINKER_FLAGS}" 158 LINK_FLAGS "${WASM_LINKER_FLAGS}"
148 ) 159 )
149 160
150 # Make sure to have the wrapper generated 161 # Make sure to have the wrapper generated
151 add_dependencies(StoneWebViewer StoneWrapper) 162 add_dependencies(StoneWebViewer AutogeneratedFiles)
152 163
153 164
154 # Declare installation files for the module 165 # Declare installation files for the module
155 # --------------------------------------------------------------- 166 # ---------------------------------------------------------------
156 167