changeset 1827:21ccc00839f7 StoneWebViewer-2.0

upgrade to Emscripten 2.0.23
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 27 May 2021 11:05:59 +0200
parents d6b83b4cedcd
children 8bc9ba6f7518 f025fa32127b
files Applications/StoneWebViewer/NEWS Applications/StoneWebViewer/WebApplication/app.js Applications/StoneWebViewer/WebApplication/index.html Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp Applications/StoneWebViewer/WebAssembly/docker-build.sh Applications/StoneWebViewer/WebAssembly/docker-internal.sh
diffstat 6 files changed, 45 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/Applications/StoneWebViewer/NEWS	Thu May 27 09:11:36 2021 +0200
+++ b/Applications/StoneWebViewer/NEWS	Thu May 27 11:05:59 2021 +0200
@@ -10,9 +10,11 @@
 * New argument "token" to set HTTP header "Authorization: Bearer <token>"
   for each request to the DICOMweb server
 * Fix issue #197 (Support for passing credentials with all HTTP requests)
+* Emscripten version: 2.0.23
 
 
 Version 1.0 (2020-12-02)
 ========================
 
 * Initial release
+* Emscripten version: 1.39.17-upstream
--- a/Applications/StoneWebViewer/WebApplication/app.js	Thu May 27 09:11:36 2021 +0200
+++ b/Applications/StoneWebViewer/WebApplication/app.js	Thu May 27 11:05:59 2021 +0200
@@ -401,7 +401,8 @@
       creatingArchive: false,
       archiveJob: '',
       mouseTool: 0,
-      stoneWebViewerVersion: 'Unknown',
+      stoneWebViewerVersion: '...',
+      emscriptenVersion: '...',
 
       modalWarning: false,
       modalNotDiagnostic: false,
@@ -1088,8 +1089,8 @@
   
   console.warn('Stone properly initialized');
 
-  stone.LoadStoneWebViewerVersion();
-  app.stoneWebViewerVersion = stone.GetStringBuffer();
+  app.stoneWebViewerVersion = stone.GetStoneWebViewerVersion();
+  app.emscriptenVersion = stone.GetEmscriptenVersion();
   
   app.SetCombinedToolActions();
   
--- a/Applications/StoneWebViewer/WebApplication/index.html	Thu May 27 09:11:36 2021 +0200
+++ b/Applications/StoneWebViewer/WebApplication/index.html	Thu May 27 11:05:59 2021 +0200
@@ -22,7 +22,7 @@
       <div class="wvInfoScreen" v-show="modalNotDiagnostic" style="display: none">
         <div class="wvInfoPopup">
           <div class="wvInfoPopupLogo">
-            <a href="https://www.osimis.io" target="_blank">
+            <a href="https://www.orthanc-server.com/" target="_blank">
               <img style="width: 340px;" src="img/orthanc.png"/>
             </a>
           </div>
@@ -35,7 +35,8 @@
             </p>
             <h3>Versions</h3>
             <p>
-              Stone Web viewer: {{ stoneWebViewerVersion }}
+              Stone Web viewer: {{ stoneWebViewerVersion }} <br/>
+              Emscripten compiler: {{ emscriptenVersion }}
             </p>
           </div>
           <div class="wvInfoPopupForm">
@@ -56,7 +57,7 @@
       <div class="wvInfoScreen" v-show="modalPreferences" style="display: none">
         <div class="wvInfoPopup">
           <div class="wvInfoPopupLogo">
-            <a href="https://www.osimis.io" target="_blank">
+            <a href="https://www.orthanc-server.com/" target="_blank">
               <img style="width: 340px;" src="img/orthanc.png"/>
             </a>
           </div>
@@ -67,6 +68,11 @@
               reviewing their images,<br> for research and for quality
               assurance.
             </p>
+            <h3>Versions</h3>
+            <p>
+              Stone Web viewer: {{ stoneWebViewerVersion }} <br/>
+              Emscripten compiler: {{ emscriptenVersion }}
+            </p>
             <h3>User preferences</h3>
           </div>
           <div class="wvInfoPopupForm">
--- a/Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp	Thu May 27 09:11:36 2021 +0200
+++ b/Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp	Thu May 27 11:05:59 2021 +0200
@@ -3482,13 +3482,22 @@
   
 
   EMSCRIPTEN_KEEPALIVE
-  void LoadStoneWebViewerVersion()
+  const char* GetStoneWebViewerVersion()
   {
-    try
-    {
-      stringBuffer_.assign(STONE_WEB_VIEWER_VERSION);
-    }
-    EXTERN_CATCH_EXCEPTIONS;
+    return STONE_WEB_VIEWER_VERSION;
+  }
+  
+
+  EMSCRIPTEN_KEEPALIVE
+  const char* GetEmscriptenVersion()
+  {
+    // WARNING - "static" is important, otherwise the string would be
+    // freed when returning to JavaScript
+    static const std::string EMSCRIPTEN_VERSION = (
+      boost::lexical_cast<std::string>(__EMSCRIPTEN_major__) + "." +
+      boost::lexical_cast<std::string>(__EMSCRIPTEN_minor__) + "." +
+      boost::lexical_cast<std::string>(__EMSCRIPTEN_tiny__));
+    return EMSCRIPTEN_VERSION.c_str();
   }
   
 
--- a/Applications/StoneWebViewer/WebAssembly/docker-build.sh	Thu May 27 09:11:36 2021 +0200
+++ b/Applications/StoneWebViewer/WebAssembly/docker-build.sh	Thu May 27 11:05:59 2021 +0200
@@ -21,7 +21,9 @@
 
 set -ex
 
-IMAGE=jodogne/wasm-builder:1.39.17-upstream
+# NB: Sources of the "jodogne/wasm-builder" Docker image:
+# https://github.com/jodogne/OrthancDocker/tree/master/wasm-builder
+IMAGE=jodogne/wasm-builder:2.0.23
 #IMAGE=wasm-builder
 
 if [ "$1" != "Debug" -a "$1" != "Release" ]; then
@@ -29,6 +31,14 @@
     exit -1
 fi
 
+if [ "$2" == "" ]; then
+    echo "No branch provided, trying to identify the current branch"
+    STONE_BRANCH=`hg identify -b`
+    echo "Detected branch of the Stone Web viewer: ${STONE_BRANCH}"
+else
+    STONE_BRANCH=$2    
+fi
+
 if [ -t 1 ]; then
     # TTY is available => use interactive mode
     DOCKER_FLAGS='-i'
@@ -40,6 +50,7 @@
 
 docker run -t ${DOCKER_FLAGS} --rm \
     --user $(id -u):$(id -g) \
+    -e STONE_BRANCH=${STONE_BRANCH} \
     -v ${ROOT_DIR}:/source:ro \
     -v ${ROOT_DIR}/wasm-binaries:/target:rw ${IMAGE} \
     bash /source/Applications/StoneWebViewer/WebAssembly/docker-internal.sh $1
--- a/Applications/StoneWebViewer/WebAssembly/docker-internal.sh	Thu May 27 09:11:36 2021 +0200
+++ b/Applications/StoneWebViewer/WebAssembly/docker-internal.sh	Thu May 27 11:05:59 2021 +0200
@@ -26,16 +26,15 @@
 # Use a folder that is writeable by non-root users for the Emscripten cache
 export EM_CACHE=/tmp/emscripten-cache
 
-# Get the Orthanc framework
-cd /tmp/
-hg clone https://hg.orthanc-server.com/orthanc/
-
 # Make a copy of the read-only folder containing the source code into
 # a writeable folder, because of "DownloadPackage.cmake" that writes
 # to the "ThirdPartyDownloads" folder next to the "CMakeLists.txt"
 cd /source
 hg clone /source /tmp/source-writeable
 
+cd /tmp/source-writeable
+hg up -c ${STONE_BRANCH}
+
 mkdir /tmp/build
 cd /tmp/build
 
@@ -43,7 +42,6 @@
       -DCMAKE_BUILD_TYPE=$1 \
       -DORTHANC_STONE_INSTALL_PREFIX=/target/StoneWebViewer \
       -DCMAKE_TOOLCHAIN_FILE=${EMSDK}/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake \
-      -DORTHANC_FRAMEWORK_ROOT=/tmp/orthanc/OrthancFramework/Sources \
       -DSTATIC_BUILD=ON \
       -G Ninja