# HG changeset patch # User Benjamin Golinvaux # Date 1589866743 -7200 # Node ID 758fb6958c204753ed843aaa2b55eb137ff067ff # Parent 4e7751a4b603d153570daa8b375d31eed4672a95# Parent 1eaf19af15bfce6b87b8e566ae0323b21575f784 Merge from default diff -r 4e7751a4b603 -r 758fb6958c20 .hgignore --- a/.hgignore Mon May 11 17:41:50 2020 +0200 +++ b/.hgignore Tue May 19 07:39:03 2020 +0200 @@ -6,23 +6,21 @@ .vscode/ build*/ CMakeLists.txt.user -Resources/CodeGeneration/.env -Resources/CodeGeneration/.idea -Resources/CodeGeneration/__pycache__ -Resources/CodeGeneration/build/ -Resources/CodeGeneration/build_browser/ -Resources/CodeGeneration/testCppHandler/build/ -Resources/CodeGeneration/testCppHandler/build_msbuild/ -Resources/CodeGeneration/testWasmIntegrated/build-final/ -Resources/CodeGeneration/testWasmIntegrated/build-tsc/ -Resources/CodeGeneration/testWasmIntegrated/build-wasm/ -Resources/CommandTool/flatc-tests/basic/build/ -Resources/CommandTool/protoc-tests/generated_js/ -Resources/CommandTool/protoc-tests/generated_ts/ -Resources/CommandTool/protoc-tests/node_modules/ +Deprecated/Resources/CodeGeneration/.env +Deprecated/Resources/CodeGeneration/.idea +Deprecated/Resources/CodeGeneration/__pycache__ +Deprecated/Resources/CodeGeneration/build/ +Deprecated/Resources/CodeGeneration/build_browser/ +Deprecated/Resources/CodeGeneration/testCppHandler/build/ +Deprecated/Resources/CodeGeneration/testCppHandler/build_msbuild/ +Deprecated/Resources/CodeGeneration/testWasmIntegrated/build-final/ +Deprecated/Resources/CodeGeneration/testWasmIntegrated/build-tsc/ +Deprecated/Resources/CodeGeneration/testWasmIntegrated/build-wasm/ Samples/WebAssembly/*/ThirdPartyDownloads/ +Samples/WebAssembly/ThirdPartyDownloads/ Samples/WebAssembly/*/out Samples/Sdl/*/ThirdPartyDownloads/ +Samples/Sdl/ThirdPartyDownloads/ Samples/Sdl/*/out Samples/Sdl/build*/ Samples/Deprecated/Sdl/ThirdPartyDownloads/ diff -r 4e7751a4b603 -r 758fb6958c20 Framework/Loaders/GenericLoadersContext.cpp --- a/Framework/Loaders/GenericLoadersContext.cpp Mon May 11 17:41:50 2020 +0200 +++ b/Framework/Loaders/GenericLoadersContext.cpp Tue May 19 07:39:03 2020 +0200 @@ -73,7 +73,7 @@ } virtual void GetStatistics(uint64_t& scheduledCommands, - uint64_t& processedCommands) + uint64_t& processedCommands) ORTHANC_OVERRIDE { scheduledCommands = that_.scheduler_->GetTotalScheduled(); processedCommands = that_.scheduler_->GetTotalProcessed(); diff -r 4e7751a4b603 -r 758fb6958c20 Framework/Loaders/GenericLoadersContext.h --- a/Framework/Loaders/GenericLoadersContext.h Mon May 11 17:41:50 2020 +0200 +++ b/Framework/Loaders/GenericLoadersContext.h Tue May 19 07:39:03 2020 +0200 @@ -52,7 +52,7 @@ std::list< boost::shared_ptr > loaders_; virtual void EmitMessage(boost::weak_ptr observer, - const IMessage& message); + const IMessage& message) ORTHANC_OVERRIDE; public: GenericLoadersContext(unsigned int maxHighPriority, diff -r 4e7751a4b603 -r 758fb6958c20 Resources/CMake/BoostExtendedConfiguration.cmake diff -r 4e7751a4b603 -r 758fb6958c20 Samples/Common/RtViewerApp.cpp --- a/Samples/Common/RtViewerApp.cpp Mon May 11 17:41:50 2020 +0200 +++ b/Samples/Common/RtViewerApp.cpp Tue May 19 07:39:03 2020 +0200 @@ -227,10 +227,17 @@ arguments_[key] = value; } - const std::string& RtViewerApp::GetArgument(const std::string& key) const + std::string RtViewerApp::GetArgument(const std::string& key) const { - ORTHANC_ASSERT(HasArgument(key)); - return arguments_.at(key); + std::map::const_iterator found = arguments_.find(key); + if (found == arguments_.end()) + { + throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls); + } + else + { + return found->second; + } } bool RtViewerApp::HasArgument(const std::string& key) const diff -r 4e7751a4b603 -r 758fb6958c20 Samples/Common/RtViewerApp.h --- a/Samples/Common/RtViewerApp.h Mon May 11 17:41:50 2020 +0200 +++ b/Samples/Common/RtViewerApp.h Tue May 19 07:39:03 2020 +0200 @@ -109,7 +109,7 @@ // SetArgument is above (public section) std::map arguments_; - const std::string& GetArgument(const std::string& key) const; + std::string GetArgument(const std::string& key) const; bool HasArgument(const std::string& key) const; /** diff -r 4e7751a4b603 -r 758fb6958c20 Samples/README.md --- a/Samples/README.md Mon May 11 17:41:50 2020 +0200 +++ b/Samples/README.md Tue May 19 07:39:03 2020 +0200 @@ -29,6 +29,27 @@ various ways suitable for the platform (command-line arguments, URL parameters or through the GUI) + +This repo contains two sample projects: + +SingleFrameViewer +----------------- + +This sample application displays a single frame of a Dicom instance that can +be loaded from Orthanc, either by using the Orthanc REST API or through the +Dicomweb server functionality of Orthanc. + +RtViewer +-------- + +This sample application displays set of Radiotherapy data: +- a CT scan +- an RT-Dose +- an RT-Struct + +The WebAssembly version displays 3 viewports with MPR data +while the SDL sample displays a single viewport. + WebAssembly samples =================== @@ -58,17 +79,7 @@ sudo apt-get install -y mercurial unzip npm ninja-build p7zip-full gettext-base ``` -SingleFrameViewer ------------------ - -This sample application displays a single frame of a Dicom instance that can -be loaded from Orthanc, either by using the Orthanc REST API or through the -Dicomweb server functionality of Orthanc. - -This barebones sample uses plain Javascript and requires the -Emscripten toolchain and cmake, in addition to a few standard packages. - -To build it, just launch the `build-wasm-SingleFrameViewer.sh` script from +To build the Wasm samples, just launch the `build-wasm-samples.sh` script from this folder. Optionaly, you can pass the build type as an argument. We suggest that you do *not* use the `Debug` configuration unless you really need it, for the additional checks that are made will lead to a very long @@ -82,12 +93,20 @@ { "Plugins" : ["LibServeFolders.so], "ServeFolders" : { - "/single-frame-viewer" : "..../out/install-stone-wasm-SingleFrameViewer-RelWithDebInfo" + "/single-frame-viewer" : "..../out/install-stone-wasm-samples-RelWithDebInfo/SingleFrameViewer", + "/rt-viewer": "..../out/install-stone-wasm-samples-RelWithDebInfo/RtViewer" } } ``` -You'll then be able to open the demo at `http://localhost:8042/single-frame-viewer/index.html` +You'll then be able to open the single-frame-viewer demo at `http://localhost:8042/single-frame-viewer/index.html` + +The rt-viewer demo at +`http://localhost:8044/rt-viewer/index.html?ctseries=a04ecf01-79b2fc33-58239f7e-ad9db983-28e81afa&rtdose=eac822ef-a395f94e-e8121fe0-8411fef8-1f7bffad&rtstruct=54460695-ba3885ee-ddf61ac0-f028e31d-a6e474d9`. Note that you must provide 3 ids in the url: + +- the CT series Orthanc ID +- the RT-Dose instance Orthanc ID +- the RT-Struct instance Orthanc ID RtViewer @@ -129,9 +148,6 @@ Native samples ================= -SdlSimpleViewer ---------------- - ### Windows build Here's how to build the SdlSimpleViewer example using Visual Studio 2019 @@ -155,7 +171,7 @@ -DALLOW_DOWNLOADS=ON ` -DSTATIC_BUILD=ON ` -DOPENSSL_NO_CAPIENG=ON ` - ../orthanc-stone/Samples/Sdl/SimpleViewer + ../orthanc-stone/Samples/Sdl $solutionPath = ls -filter *.sln Write-Host "Solution file(s) available at: $solutionPath" @@ -176,7 +192,9 @@ port 8042 and launch: ``` -./SingleFrameViewer --orthanc http://localhost:8042 --instance 7fc84013-abef174e-3354ca83-b9cdb2a4-f1a74368 +./SdlSimpleViewer --orthanc http://localhost:8042 --instance 7fc84013-abef174e-3354ca83-b9cdb2a4-f1a74368 + +./RtViewerSdl --orthanc http://localhost:8042 --ctseries a04ecf01-79b2fc33-58239f7e-ad9db983-28e81afa --rtdose 830a69ff-8e4b5ee3-b7f966c8-bccc20fb-d322dceb --rtstruct 54460695-ba3885ee-ddf61ac0-f028e31d-a6e474d9 ``` RtViewer diff -r 4e7751a4b603 -r 758fb6958c20 Samples/Sdl/CMakeLists.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Samples/Sdl/CMakeLists.txt Tue May 19 07:39:03 2020 +0200 @@ -0,0 +1,108 @@ +cmake_minimum_required(VERSION 2.8.10) + +project(OrthancStone) + +set(ORTHANC_FRAMEWORK_SOURCE "path" CACHE STRING "select the source of Orthanc") +set(ORTHANC_FRAMEWORK_ROOT ${CMAKE_CURRENT_LIST_DIR}/../../../orthanc CACHE STRING "select the root path of Orthanc") +set(STONE_ROOT ${CMAKE_CURRENT_LIST_DIR}/../../) + +include(${STONE_ROOT}/Resources/CMake/OrthancStoneParameters.cmake) +include(${ORTHANC_ROOT}/Resources/CMake/DownloadPackage.cmake) + +set(ALLOW_DOWNLOADS ON) +if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") + set(STATIC_BUILD ON) +endif() +set(ENABLE_GOOGLE_TEST ON) +set(ENABLE_LOCALE ON) # Necessary for text rendering +set(ENABLE_SDL ON) +set(ENABLE_DCMTK ON) # <== +set(ENABLE_OPENGL ON) # <== +set(ENABLE_WEB_CLIENT ON) +set(ORTHANC_SANDBOXED OFF) + +DownloadPackage( + "a24b8136b8f3bb93f166baf97d9328de" + "http://orthanc.osimis.io/ThirdPartyDownloads/ubuntu-font-family-0.83.zip" + "${CMAKE_BINARY_DIR}/ubuntu-font-family-0.83") + +set(ORTHANC_STONE_APPLICATION_RESOURCES + UBUNTU_FONT ${CMAKE_BINARY_DIR}/ubuntu-font-family-0.83/Ubuntu-R.ttf + ) + +list(APPEND ORTHANC_BOOST_COMPONENTS program_options) +include(${STONE_ROOT}/Resources/CMake/OrthancStoneConfiguration.cmake) +include(${STONE_ROOT}/Resources/CMake/BoostExtendedConfiguration.cmake) +include(${STONE_ROOT}/Resources/CMake/Utilities.cmake) + +include_directories(${STONE_ROOT}) +include_directories(../Common) + +add_definitions( + -DORTHANC_ENABLE_LOGGING=1 + -DORTHANC_ENABLE_LOGGING_PLUGIN=0 + -DORTHANC_ENABLE_PUGIXML=0 + -DORTHANC_DEFAULT_DICOM_ENCODING=Encoding_Latin1 + ) + +SortFilesInSourceGroups() + +add_library(OrthancStone STATIC + ${ORTHANC_STONE_SOURCES} + ) + + +############################# +project(RtViewerSdl) + +add_executable(RtViewerSdl + RtViewer/RtViewerSdl.cpp + SdlHelpers.h + ../Common/RtViewerApp.cpp + ../Common/RtViewerApp.h + ../Common/RtViewerView.cpp + ../Common/RtViewerView.h + ../Common/SampleHelpers.h + ) + +target_link_libraries(RtViewerSdl OrthancStone ${DCMTK_LIBRARIES}) + +############################# +project(SdlSimpleViewer) + +add_executable(SdlSimpleViewer + SdlHelpers.h + ../Common/SampleHelpers.h + SingleFrameViewer/SdlSimpleViewerApplication.h + SingleFrameViewer/SdlSimpleViewer.cpp + ${BOOST_EXTENDED_SOURCES} + ) + +target_link_libraries(SdlSimpleViewer OrthancStone ${DCMTK_LIBRARIES}) + +############################# +project(UnitTests) + +add_executable(UnitTests + ${GOOGLE_TEST_SOURCES} + ${ORTHANC_STONE_ROOT}/UnitTestsSources/GenericToolboxTests.cpp + ${ORTHANC_STONE_ROOT}/UnitTestsSources/ImageToolboxTests.cpp + ${ORTHANC_STONE_ROOT}/UnitTestsSources/PixelTestPatternsTests.cpp + ${ORTHANC_STONE_ROOT}/UnitTestsSources/TestCommands.cpp + ${ORTHANC_STONE_ROOT}/UnitTestsSources/TestMessageBroker.cpp + ${ORTHANC_STONE_ROOT}/UnitTestsSources/TestStrategy.cpp + ${ORTHANC_STONE_ROOT}/UnitTestsSources/TestStructureSet.cpp + ${ORTHANC_STONE_ROOT}/UnitTestsSources/UnitTestsMain.cpp +) + +target_link_libraries(UnitTests OrthancStone) + +add_custom_command( + TARGET UnitTests + POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy + "${ORTHANC_STONE_ROOT}/UnitTestsSources/72c773ac-5059f2c4-2e6a9120-4fd4bca1-45701661.json" + "$/72c773ac-5059f2c4-2e6a9120-4fd4bca1-45701661.json" +) + +target_link_libraries(UnitTests OrthancStone ${DCMTK_LIBRARIES}) diff -r 4e7751a4b603 -r 758fb6958c20 Samples/Sdl/RtViewer/RtViewerSdl.cpp --- a/Samples/Sdl/RtViewer/RtViewerSdl.cpp Mon May 11 17:41:50 2020 +0200 +++ b/Samples/Sdl/RtViewer/RtViewerSdl.cpp Tue May 19 07:39:03 2020 +0200 @@ -24,6 +24,7 @@ // Stone of Orthanc includes #include +#include #include #include #include @@ -43,6 +44,13 @@ #include + +#if !defined(__APPLE__) +/** + * OpenGL: "OS X does not seem to support debug output functionality + * (as gathered online)." + * https://learnopengl.com/In-Practice/Debugging + **/ static void GLAPIENTRY OpenGLMessageCallback(GLenum source, GLenum type, @@ -59,13 +67,16 @@ type, severity, message); } } +#endif namespace OrthancStone { void RtViewerView::EnableGLDebugOutput() { +#if !defined(__APPLE__) glEnable(GL_DEBUG_OUTPUT); glDebugMessageCallback(OpenGLMessageCallback, 0); +#endif } boost::shared_ptr RtViewerView::CreateViewport(const std::string& canvasId) @@ -222,7 +233,7 @@ if (windowID == curWindowID) return view; } - return NULL; + return boost::shared_ptr(); } void RtViewerApp::SdlRunLoop(const std::vector >& views, diff -r 4e7751a4b603 -r 758fb6958c20 Samples/Sdl/SdlHelpers.h --- a/Samples/Sdl/SdlHelpers.h Mon May 11 17:41:50 2020 +0200 +++ b/Samples/Sdl/SdlHelpers.h Tue May 19 07:39:03 2020 +0200 @@ -112,7 +112,8 @@ if (windowID == curWindowID) return sdlViewport; } - return NULL; + + return boost::shared_ptr(); } } diff -r 4e7751a4b603 -r 758fb6958c20 Samples/Sdl/SingleFrameViewer/SdlSimpleViewer.cpp --- a/Samples/Sdl/SingleFrameViewer/SdlSimpleViewer.cpp Mon May 11 17:41:50 2020 +0200 +++ b/Samples/Sdl/SingleFrameViewer/SdlSimpleViewer.cpp Tue May 19 07:39:03 2020 +0200 @@ -231,8 +231,6 @@ } catch (Orthanc::OrthancException& e) { - auto test = e.What(); - fprintf(stdout, test); LOG(ERROR) << "OrthancException: " << e.What(); return -1; } diff -r 4e7751a4b603 -r 758fb6958c20 Samples/WebAssembly/CMakeLists.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Samples/WebAssembly/CMakeLists.txt Tue May 19 07:39:03 2020 +0200 @@ -0,0 +1,138 @@ +cmake_minimum_required(VERSION 2.8.3) + +project(OrthancStone) + +# Configuration of the Emscripten compiler for WebAssembly target +# --------------------------------------------------------------- +set(USE_WASM ON CACHE BOOL "") +set(ORTHANC_FRAMEWORK_ROOT ${CMAKE_CURRENT_LIST_DIR}/../../../orthanc CACHE STRING "") +set(STONE_ROOT ${CMAKE_CURRENT_LIST_DIR}/../../) + +set(EMSCRIPTEN_SET_LLVM_WASM_BACKEND ON CACHE BOOL "") + +set(WASM_FLAGS "-s WASM=1 -s FETCH=1") +if (CMAKE_BUILD_TYPE STREQUAL "Debug") + set(WASM_FLAGS "${WASM_FLAGS} -s SAFE_HEAP=1") +endif() + +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WASM_FLAGS}") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WASM_FLAGS}") + +set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s EXTRA_EXPORTED_RUNTIME_METHODS='[\"ccall\", \"cwrap\"]'") +set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s ERROR_ON_UNDEFINED_SYMBOLS=1") +set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s ASSERTIONS=1 -s DISABLE_EXCEPTION_CATCHING=0") +set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s ALLOW_MEMORY_GROWTH=1 -s TOTAL_MEMORY=268435456") # 256MB + resize +set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s DISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=1") +add_definitions( + -DDISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=1 +) + +# Stone of Orthanc configuration +# --------------------------------------------------------------- +set(ALLOW_DOWNLOADS ON) +set(ORTHANC_FRAMEWORK_SOURCE "path") + +include(${STONE_ROOT}/Resources/CMake/OrthancStoneParameters.cmake) +include(${ORTHANC_ROOT}/Resources/CMake/DownloadPackage.cmake) + +SET(ENABLE_DCMTK ON) +SET(ENABLE_GOOGLE_TEST OFF) +SET(ENABLE_LOCALE ON) # Necessary for text rendering +SET(ENABLE_WASM ON) +SET(ORTHANC_SANDBOXED ON) + + +# We embed a font to be used for on-screen overlays +# --------------------------------------------------------------- + +DownloadPackage( + "a24b8136b8f3bb93f166baf97d9328de" + "http://orthanc.osimis.io/ThirdPartyDownloads/ubuntu-font-family-0.83.zip" + "${CMAKE_BINARY_DIR}/ubuntu-font-family-0.83") + +set(ORTHANC_STONE_APPLICATION_RESOURCES + UBUNTU_FONT ${CMAKE_BINARY_DIR}/ubuntu-font-family-0.83/Ubuntu-R.ttf + ) + +# this will set up the build system for Stone of Orthanc and will +# populate the ORTHANC_STONE_SOURCES CMake variable +include(${STONE_ROOT}/Resources/CMake/OrthancStoneConfiguration.cmake) + +include_directories(${STONE_ROOT}) +include_directories(../Common) + +add_library(OrthancStone STATIC + ${ORTHANC_STONE_SOURCES} + ) + +################################################################################ + +# Define the WASM module +# --------------------------------------------------------------- + +project(RtViewerWasm) + +add_executable(RtViewerWasm + RtViewer/RtViewerWasm.cpp + ../Common/RtViewerApp.cpp + ../Common/RtViewerApp.h + ../Common/RtViewerView.cpp + ../Common/RtViewerView.h + ) + +target_link_libraries(RtViewerWasm OrthancStone) + +# Declare installation files for the module +# --------------------------------------------------------------- +install( + TARGETS RtViewerWasm + RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/RtViewer/ + ) + +# Declare installation files for the companion files (web scaffolding) +# please note that ${CMAKE_CURRENT_BINARY_DIR}/RtViewerWasm.js +# (the generated JS loader for the WASM module) is handled by the `install1` +# section above: it is considered to be the binary output of +# the linker. +# --------------------------------------------------------------- +install( + FILES + ${CMAKE_SOURCE_DIR}/RtViewer/RtViewerWasmApp.js + ${CMAKE_SOURCE_DIR}/RtViewer/index.html + ${CMAKE_CURRENT_BINARY_DIR}/RtViewerWasm.wasm + DESTINATION ${CMAKE_INSTALL_PREFIX}/RtViewer/ + ) + +################################################################################ + +# Define the WASM module +# --------------------------------------------------------------- + +project(SingleFrameViewerWasm) + +add_executable(SingleFrameViewerWasm + SingleFrameViewer/SingleFrameViewer.cpp + ) + +target_link_libraries(SingleFrameViewerWasm OrthancStone) + +# Declare installation files for the module +# --------------------------------------------------------------- +install( + TARGETS SingleFrameViewerWasm + RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/SingleFrameViewer/ + ) + +# Declare installation files for the companion files (web scaffolding) +# please note that ${CMAKE_CURRENT_BINARY_DIR}/RtViewerWasm.js +# (the generated JS loader for the WASM module) is handled by the `install1` +# section above: it is considered to be the binary output of +# the linker. +# --------------------------------------------------------------- +install( + FILES + ${CMAKE_SOURCE_DIR}/SingleFrameViewer/SingleFrameViewerApp.js + ${CMAKE_SOURCE_DIR}/SingleFrameViewer/index.html + ${CMAKE_CURRENT_BINARY_DIR}/SingleFrameViewerWasm.wasm + DESTINATION ${CMAKE_INSTALL_PREFIX}/SingleFrameViewer/ + ) diff -r 4e7751a4b603 -r 758fb6958c20 Samples/build-wasm-RtViewer.sh --- a/Samples/build-wasm-RtViewer.sh Mon May 11 17:41:50 2020 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -#!/bin/bash -# -# usage: -# to build the sample in Debug: -# ./build-wasm-RtViewer.sh -# -# to build the sample in Debug: -# ./build-wasm-RtViewer.sh Release - -set -e - -if [ ! -d "WebAssembly" ]; then - echo "This script must be run from the Samples folder one level below orthanc-stone" - exit 1 -fi - - -currentDir=$(pwd) -samplesRootDir=$(pwd) -devrootDir=$(pwd)/../../ - -buildType=${1:-RelWithDebInfo} -buildFolderName="$devrootDir/out/build-stone-wasm-RtViewer-$buildType" -installFolderName="$devrootDir/out/install-stone-wasm-RtViewer-$buildType" - -mkdir -p $buildFolderName -# change current folder to the build folder -pushd $buildFolderName - -# configure the environment to use Emscripten -source ~/apps/emsdk/emsdk_env.sh - -emcmake cmake -G "Ninja" \ - -DCMAKE_BUILD_TYPE=$buildType \ - -DCMAKE_INSTALL_PREFIX=$installFolderName \ - -DSTATIC_BUILD=ON -DALLOW_DOWNLOADS=ON \ - $samplesRootDir/WebAssembly/RtViewer - -# perform build + installation -ninja install - -# restore the original working folder -popd - -echo "If all went well, the output files can be found in $installFolderName:" - -ls $installFolderName diff -r 4e7751a4b603 -r 758fb6958c20 Samples/build-wasm-SingleFrameViewer.sh --- a/Samples/build-wasm-SingleFrameViewer.sh Mon May 11 17:41:50 2020 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -#!/bin/bash -# -# usage: -# to build the sample in Debug: -# ./build-wasm-SingleFrameViewer.sh -# -# to build the sample in Debug: -# ./build-wasm-SingleFrameViewer.sh Release - -set -e - -if [ ! -d "WebAssembly" ]; then - echo "This script must be run from the Samples folder one level below orthanc-stone" - exit 1 -fi - - -currentDir=$(pwd) -samplesRootDir=$(pwd) -devrootDir=$(pwd)/../../ - -buildType=${1:-RelWithDebInfo} -buildFolderName="$devrootDir/out/build-stone-wasm-SingleFrameViewer-$buildType" -installFolderName="$devrootDir/out/install-stone-wasm-SingleFrameViewer-$buildType" - -mkdir -p $buildFolderName -# change current folder to the build folder -pushd $buildFolderName - -# configure the environment to use Emscripten -source ~/apps/emsdk/emsdk_env.sh - -emcmake cmake -G "Ninja" \ - -DCMAKE_BUILD_TYPE=$buildType \ - -DCMAKE_INSTALL_PREFIX=$installFolderName \ - -DSTATIC_BUILD=ON -DALLOW_DOWNLOADS=ON \ - $samplesRootDir/WebAssembly/SingleFrameViewer - -# perform build + installation -ninja install - -# restore the original working folder -popd - -echo "If all went well, the output files can be found in $installFolderName:" - -ls $installFolderName \ No newline at end of file diff -r 4e7751a4b603 -r 758fb6958c20 Samples/build-wasm-samples.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Samples/build-wasm-samples.sh Tue May 19 07:39:03 2020 +0200 @@ -0,0 +1,48 @@ +#!/bin/bash +# +# usage: +# to build the samples in RelWithDebInfo: +# ./build-wasm-samples.sh +# +# to build the samples in Release: +# ./build-wasm-samples.sh Release + +set -e + +if [ ! -d "WebAssembly" ]; then + echo "This script must be run from the Samples folder one level below orthanc-stone" + exit 1 +fi + + +currentDir=$(pwd) +samplesRootDir=$(pwd) +devrootDir=$(pwd)/../../ + +buildType=${1:-RelWithDebInfo} +buildFolderName="$devrootDir/out/build-stone-wasm-samples-$buildType" +installFolderName="$devrootDir/out/install-stone-wasm-samples-$buildType" + +mkdir -p $buildFolderName +# change current folder to the build folder +pushd $buildFolderName + +# configure the environment to use Emscripten +source ~/apps/emsdk/emsdk_env.sh + +emcmake cmake -G "Ninja" \ + -DCMAKE_BUILD_TYPE=$buildType \ + -DCMAKE_INSTALL_PREFIX=$installFolderName \ + -DSTATIC_BUILD=ON -DALLOW_DOWNLOADS=ON \ + $samplesRootDir/WebAssembly + +# perform build + installation +ninja +ninja install + +# restore the original working folder +popd + +echo "If all went well, the output files can be found in $installFolderName:" + +ls $installFolderName \ No newline at end of file diff -r 4e7751a4b603 -r 758fb6958c20 UnitTestsSources/CMakeLists.txt --- a/UnitTestsSources/CMakeLists.txt Mon May 11 17:41:50 2020 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,122 +0,0 @@ -cmake_minimum_required(VERSION 2.8.3) -project(OrthancStone) - -set(ORTHANC_FRAMEWORK_SOURCE "path") -set(ORTHANC_FRAMEWORK_ROOT ${CMAKE_CURRENT_LIST_DIR}/../../orthanc) -set(STONE_ROOT ${CMAKE_CURRENT_LIST_DIR}/../) - -include(../Resources/CMake/OrthancStoneParameters.cmake) - -set(ENABLE_STONE_DEPRECATED ON) # Need deprecated classes for these samples - -if (OPENSSL_NO_CAPIENG) -add_definitions(-DOPENSSL_NO_CAPIENG=1) -endif() - -set(ENABLE_SDL OFF CACHE BOOL "Target SDL Native application") -set(ENABLE_WASM OFF CACHE BOOL "Target WASM application") -set(ENABLE_UNITTESTS ON BOOL "Enable unit tests") - - -if (ENABLE_WASM) - set(ORTHANC_SANDBOXED ON) - if (ENABLE_SDL) - message("ENABLE_SDL is only supported in native (incompatible with ENABLE_WASM)") - endif() - set(ENABLE_NATIVE OFF) - set(ORTHANC_SANDBOXED OFF) - set(ENABLE_CRYPTO_OPTIONS ON) - set(ENABLE_GOOGLE_TEST ON) - set(ENABLE_WEB_CLIENT ON) -elseif (ENABLE_SDL) - set(ENABLE_NATIVE ON) - set(ORTHANC_SANDBOXED OFF) - set(ENABLE_CRYPTO_OPTIONS ON) - set(ENABLE_GOOGLE_TEST ON) - set(ENABLE_WEB_CLIENT ON) -else() - set(ENABLE_NATIVE ON) - set(ENABLE_OPENGL OFF) -endif() - -##################################################################### -## Configuration for Orthanc -##################################################################### - -if (ORTHANC_STONE_VERSION STREQUAL "mainline") - set(ORTHANC_FRAMEWORK_VERSION "mainline") - set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "hg") -else() - set(ORTHANC_FRAMEWORK_VERSION "1.4.1") - set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "web") -endif() - -set(ORTHANC_FRAMEWORK_SOURCE "${ORTHANC_FRAMEWORK_DEFAULT_SOURCE}" CACHE STRING "Source of the Orthanc source code (can be \"hg\", \"archive\", \"web\" or \"path\")") -set(ORTHANC_FRAMEWORK_ARCHIVE "" CACHE STRING "Path to the Orthanc archive, if ORTHANC_FRAMEWORK_SOURCE is \"archive\"") -set(ORTHANC_FRAMEWORK_ROOT "" CACHE STRING "Path to the Orthanc source directory, if ORTHANC_FRAMEWORK_SOURCE is \"path\"") - -add_definitions( - -DORTHANC_ENABLE_LOGGING_PLUGIN=0 - ) - -##################################################################### -## Build a static library containing the Orthanc Stone framework -##################################################################### - -LIST(APPEND ORTHANC_BOOST_COMPONENTS program_options) - -include(../Resources/CMake/OrthancStoneConfiguration.cmake) - -add_library(OrthancStone STATIC - ${ORTHANC_STONE_SOURCES} - ) - -include_directories(${ORTHANC_STONE_ROOT}) - -##################################################################### -## Build the unit tests -##################################################################### - -if (ENABLE_UNITTESTS) - add_executable(UnitTests - ${GOOGLE_TEST_SOURCES} - ${ORTHANC_STONE_ROOT}/UnitTestsSources/GenericToolboxTests.cpp - ${ORTHANC_STONE_ROOT}/UnitTestsSources/ImageToolboxTests.cpp - ${ORTHANC_STONE_ROOT}/UnitTestsSources/PixelTestPatternsTests.cpp - ${ORTHANC_STONE_ROOT}/UnitTestsSources/TestCommands.cpp - ${ORTHANC_STONE_ROOT}/UnitTestsSources/TestMessageBroker.cpp - ${ORTHANC_STONE_ROOT}/UnitTestsSources/TestStrategy.cpp - ${ORTHANC_STONE_ROOT}/UnitTestsSources/TestStructureSet.cpp - ${ORTHANC_STONE_ROOT}/UnitTestsSources/UnitTestsMain.cpp - ) - - target_link_libraries(UnitTests OrthancStone) - - add_custom_command( - TARGET UnitTests - POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy - "${ORTHANC_STONE_ROOT}/UnitTestsSources/72c773ac-5059f2c4-2e6a9120-4fd4bca1-45701661.json" - "$/72c773ac-5059f2c4-2e6a9120-4fd4bca1-45701661.json" - ) - -endif() - -##################################################################### -## Generate the documentation if Doxygen is present -##################################################################### - -find_package(Doxygen) -if (DOXYGEN_FOUND) - configure_file( - ${ORTHANC_STONE_ROOT}/Resources/OrthancStone.doxygen - ${CMAKE_CURRENT_BINARY_DIR}/OrthancStone.doxygen - @ONLY) - - add_custom_target(doc - ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/OrthancStone.doxygen - COMMENT "Generating documentation with Doxygen" VERBATIM - ) -else() - message("Doxygen not found. The documentation will not be built.") -endif()