changeset 4071:d6b7fb0f9652 framework

improved DownloadOrthancFramework.cmake
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 15 Jun 2020 12:26:45 +0200
parents f1e82dd6acb1
children 3dda0d73193c
files OrthancFramework/Resources/CMake/DownloadOrthancFramework.cmake OrthancFramework/SharedLibrary/CMakeLists.txt OrthancFramework/Sources/Images/PamReader.cpp
diffstat 3 files changed, 23 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancFramework/Resources/CMake/DownloadOrthancFramework.cmake	Fri Jun 12 17:37:11 2020 +0200
+++ b/OrthancFramework/Resources/CMake/DownloadOrthancFramework.cmake	Mon Jun 15 12:26:45 2020 +0200
@@ -195,10 +195,8 @@
   endif()
   
   if (NOT EXISTS ${ORTHANC_FRAMEWORK_ROOT}/Resources/CMake/OrthancFrameworkParameters.cmake)
-    message(FATAL_ERROR "Directory not containing the source code of Orthanc: ${ORTHANC_FRAMEWORK_ROOT}")
+    message(FATAL_ERROR "Directory not containing the source code of the Orthanc framework: ${ORTHANC_FRAMEWORK_ROOT}")
   endif()
-  
-  set(ORTHANC_ROOT ${ORTHANC_FRAMEWORK_ROOT})
 endif()
 
 
@@ -245,6 +243,16 @@
   if (Failure)
     message(FATAL_ERROR "Error while running Mercurial")
   endif()
+
+  unset(ORTHANC_FRAMEWORK_ROOT CACHE)
+  set(ORTHANC_FRAMEWORK_ROOT "${ORTHANC_ROOT}/OrthancFramework" CACHE
+    STRING "Path to the Orthanc framework source directory")
+
+  if (NOT EXISTS ${ORTHANC_FRAMEWORK_ROOT}/Resources/CMake/OrthancFrameworkParameters.cmake)
+    message(FATAL_ERROR "Directory not containing the source code of the Orthanc framework: ${ORTHANC_ROOT}")
+  endif()
+
+  unset(ORTHANC_ROOT)
 endif()
 
 
@@ -372,6 +380,16 @@
       message(FATAL_ERROR "The Orthanc framework was not uncompressed at the proper location. Check the CMake instructions.")
     endif()
   endif()
+
+  unset(ORTHANC_FRAMEWORK_ROOT CACHE)
+  set(ORTHANC_FRAMEWORK_ROOT "${ORTHANC_ROOT}/OrthancFramework" CACHE
+    STRING "Path to the Orthanc framework source directory")
+
+  if (NOT EXISTS ${ORTHANC_FRAMEWORK_ROOT}/Resources/CMake/OrthancFrameworkParameters.cmake)
+    message(FATAL_ERROR "Directory not containing the source code of the Orthanc framework: ${ORTHANC_ROOT}")
+  endif()
+
+  unset(ORTHANC_ROOT)
 endif()
 
 
--- a/OrthancFramework/SharedLibrary/CMakeLists.txt	Fri Jun 12 17:37:11 2020 +0200
+++ b/OrthancFramework/SharedLibrary/CMakeLists.txt	Mon Jun 15 12:26:45 2020 +0200
@@ -52,6 +52,7 @@
   # WebAssembly or asm.js
   set(BOOST_LOCALE_BACKEND "libiconv")
   set(ORTHANC_SANDBOXED ON)
+  set(STANDALONE_BUILD ON)
 
   # Will be used by "../Resources/CMake/EmscriptenParameters.cmake"
   set(WASM_FLAGS "-s SIDE_MODULE=1 -s EXPORT_ALL=1")
--- a/OrthancFramework/Sources/Images/PamReader.cpp	Fri Jun 12 17:37:11 2020 +0200
+++ b/OrthancFramework/Sources/Images/PamReader.cpp	Mon Jun 15 12:26:45 2020 +0200
@@ -242,7 +242,7 @@
         
         for (unsigned int w = 0; w < GetWidth(); ++w, ++pixel)
         {
-#if ORTHANC_ENABLE_WASM == 1
+#if defined(__EMSCRIPTEN__)  // For WebAssembly
           /* 
           
           crash (2019-08-05):