comparison Applications/Samples/CMakeLists.txt @ 466:5055031f4a06 bgo-commands-codegen

- Added browserify to build. This allows using require calls for modules that work with tsc compiler. - removed older stuff related to Protocol Buffers and Flatbuffers - changed triple-slash references to import statements - module prefixes are now added at call sites - added cmake module for filename handling - switched to Ninja for sample build - Added virtual dtor in ICommand
author bgo-osimis
date Mon, 11 Feb 2019 16:00:04 +0100
parents ee41b6a017d7
children 801d2697a1b1
comparison
equal deleted inserted replaced
448:cc47e6eaefb0 466:5055031f4a06
29 if (ENABLE_WASM) 29 if (ENABLE_WASM)
30 ##################################################################### 30 #####################################################################
31 ## Configuration of the Emscripten compiler for WebAssembly target 31 ## Configuration of the Emscripten compiler for WebAssembly target
32 ##################################################################### 32 #####################################################################
33 33
34 set(WASM_FLAGS "-s WASM=1") 34 set(WASM_FLAGS "-s WASM=1 -O0 -g0")
35 message("*****************************************************************************")
36 message("WARNING: optimizations are disabled in emcc!!! Enable them for production use")
37 message("*****************************************************************************")
35 set(WASM_MODULE_NAME "StoneFrameworkModule" CACHE STRING "Name of the WebAssembly module") 38 set(WASM_MODULE_NAME "StoneFrameworkModule" CACHE STRING "Name of the WebAssembly module")
36 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WASM_FLAGS}") 39 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WASM_FLAGS}")
37 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WASM_FLAGS}") 40 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WASM_FLAGS}")
38 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --js-library ${STONE_SOURCES_DIR}/Applications/Samples/samples-library.js --js-library ${STONE_SOURCES_DIR}/Platforms/Wasm/WasmWebService.js --js-library ${STONE_SOURCES_DIR}/Platforms/Wasm/WasmDelayedCallExecutor.js --js-library ${STONE_SOURCES_DIR}/Platforms/Wasm/default-library.js -s EXTRA_EXPORTED_RUNTIME_METHODS='[\"ccall\", \"cwrap\"]'") 41 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --js-library ${STONE_SOURCES_DIR}/Platforms/Wasm/WasmWebService.js --js-library ${STONE_SOURCES_DIR}/Platforms/Wasm/WasmDelayedCallExecutor.js --js-library ${STONE_SOURCES_DIR}/Platforms/Wasm/default-library.js -s EXTRA_EXPORTED_RUNTIME_METHODS='[\"ccall\", \"cwrap\"]'")
39 42
40 # Handling of memory 43 # Handling of memory
41 #set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s ALLOW_MEMORY_GROWTH=1") # Resize 44 #set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s ALLOW_MEMORY_GROWTH=1") # Resize
42 #set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s TOTAL_MEMORY=536870912") # 512MB 45 #set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s TOTAL_MEMORY=536870912") # 512MB
43 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s EXPORT_NAME='\"${WASM_MODULE_NAME}\"' -s ALLOW_MEMORY_GROWTH=1 -s TOTAL_MEMORY=536870912 -s TOTAL_STACK=128000000") # 512MB + resize 46 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s EXPORT_NAME='\"${WASM_MODULE_NAME}\"' -s ALLOW_MEMORY_GROWTH=1 -s TOTAL_MEMORY=536870912 -s TOTAL_STACK=128000000") # 512MB + resize
82 ##################################################################### 85 #####################################################################
83 86
84 LIST(APPEND ORTHANC_BOOST_COMPONENTS program_options) 87 LIST(APPEND ORTHANC_BOOST_COMPONENTS program_options)
85 88
86 include(../../Resources/CMake/OrthancStoneConfiguration.cmake) 89 include(../../Resources/CMake/OrthancStoneConfiguration.cmake)
87 include(../../Resources/CMake/FlatBuffersConfiguration.cmake)
88 90
89 add_library(OrthancStone STATIC 91 add_library(OrthancStone STATIC
90 ${ORTHANC_STONE_SOURCES} 92 ${ORTHANC_STONE_SOURCES}
91 ) 93 )
92 94
167 169
168 ##### SimpleViewer sample (Qt and WASM only) ####### 170 ##### SimpleViewer sample (Qt and WASM only) #######
169 171
170 if (ENABLE_QT OR ENABLE_WASM) 172 if (ENABLE_QT OR ENABLE_WASM)
171 173
172 GenerateCodeFromFlatBufferSchema("${ORTHANC_STONE_ROOT}/Applications/Samples/SimpleViewer/ApplicationCommands.fbs") 174 # GenerateCodeFromFlatBufferSchema("${ORTHANC_STONE_ROOT}/Applications/Samples/SimpleViewer/ApplicationCommands.fbs")
173 175
174 list(APPEND SIMPLE_VIEWER_APPLICATION_SOURCES ${FLATC_AUTOGENERATED_SOURCES}) 176 list(APPEND SIMPLE_VIEWER_APPLICATION_SOURCES ${FLATC_AUTOGENERATED_SOURCES})
175 message(STATUS "SIMPLE_VIEWER_APPLICATION_SOURCES = ${SIMPLE_VIEWER_APPLICATION_SOURCES}") 177 message(STATUS "SIMPLE_VIEWER_APPLICATION_SOURCES = ${SIMPLE_VIEWER_APPLICATION_SOURCES}")
176 message(STATUS "FLATC_AUTOGENERATED_SOURCES = ${FLATC_AUTOGENERATED_SOURCES}") 178 message(STATUS "FLATC_AUTOGENERATED_SOURCES = ${FLATC_AUTOGENERATED_SOURCES}")
177 179