diff Resources/CMake/DcmtkConfigurationStatic-3.6.2.cmake @ 3786:3801435e34a1 SylvainRouquette/fix-issue169-95b752c

integration Orthanc-1.6.0->SylvainRouquette
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 19 Mar 2020 11:48:30 +0100
parents 0654d0838de8
children
line wrap: on
line diff
--- a/Resources/CMake/DcmtkConfigurationStatic-3.6.2.cmake	Wed Mar 18 08:59:06 2020 +0100
+++ b/Resources/CMake/DcmtkConfigurationStatic-3.6.2.cmake	Thu Mar 19 11:48:30 2020 +0100
@@ -12,7 +12,12 @@
 
 set(DCMTK_BINARY_DIR ${DCMTK_SOURCES_DIR}/)
 set(DCMTK_CMAKE_INCLUDE ${DCMTK_SOURCES_DIR}/)
-set(DCMTK_WITH_THREADS ON)
+
+if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
+  set(DCMTK_WITH_THREADS OFF)  # Disable thread support in wasm/asm.js
+else()
+  set(DCMTK_WITH_THREADS ON)
+endif()
 
 add_definitions(-DDCMTK_INSIDE_LOG4CPLUS=1)
 
@@ -31,7 +36,7 @@
   message("Applying patch to detect mathematic primitives in DCMTK 3.6.2 with C++11")
   execute_process(
     COMMAND ${PATCH_EXECUTABLE} -p0 -N -i
-    ${ORTHANC_ROOT}/Resources/Patches/dcmtk-3.6.2-cmath.patch
+    ${ORTHANC_ROOT}/Resources/Patches/dcmtk-3.6.2.patch
     WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
     RESULT_VARIABLE Failure
     )
@@ -39,6 +44,11 @@
   if (Failure)
     message(FATAL_ERROR "Error while patching a file")
   endif()
+
+  configure_file(
+    ${ORTHANC_ROOT}/Resources/Patches/dcmtk-dcdict_orthanc.cc
+    ${DCMTK_SOURCES_DIR}/dcmdata/libsrc/dcdict_orthanc.cc
+    COPYONLY)
 else()
   message("The patches for DCMTK have already been applied")
 endif()
@@ -72,18 +82,21 @@
   SET(DCMTK_ENABLE_CHARSET_CONVERSION "iconv" CACHE STRING "")
   SET(HAVE_SYS_GETTID 0 CACHE INTERNAL "")
 
-  execute_process(
-    COMMAND ${PATCH_EXECUTABLE} -p0 -N -i
-    ${ORTHANC_ROOT}/Resources/Patches/dcmtk-3.6.2-linux-standard-base.patch
-    WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
-    RESULT_VARIABLE Failure
-    )
+  if (FirstRun)
+    execute_process(
+      COMMAND ${PATCH_EXECUTABLE} -p0 -N -i
+      ${ORTHANC_ROOT}/Resources/Patches/dcmtk-3.6.2-linux-standard-base.patch
+      WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
+      RESULT_VARIABLE Failure
+      )
 
-  if (FirstRun AND Failure)
-    message(FATAL_ERROR "Error while patching a file")
+    if (Failure)
+      message(FATAL_ERROR "Error while patching a file")
+    endif()
   endif()
 endif()
 
+
 SET(DCMTK_SOURCE_DIR ${DCMTK_SOURCES_DIR})
 include(${DCMTK_SOURCES_DIR}/CMake/CheckFunctionWithHeaderExists.cmake)
 include(${DCMTK_SOURCES_DIR}/CMake/GenerateDCMTKConfigure.cmake)
@@ -163,19 +176,6 @@
 endif()
 
 
-if (ORTHANC_SANDBOXED)
-  configure_file(
-    ${ORTHANC_ROOT}/Resources/WebAssembly/dcdict.h
-    ${DCMTK_SOURCES_DIR}/dcmdata/include/dcmtk/dcmdata/dcdict.h
-    COPYONLY)
-  
-  configure_file(
-    ${ORTHANC_ROOT}/Resources/WebAssembly/dcdict.cc
-    ${DCMTK_SOURCES_DIR}/dcmdata/libsrc/dcdict.cc
-    COPYONLY)
-endif()
-
-
 #set_source_files_properties(${DCMTK_SOURCES}
 #  PROPERTIES COMPILE_DEFINITIONS
 #  "PACKAGE_VERSION=\"${DCMTK_PACKAGE_VERSION}\";PACKAGE_VERSION_NUMBER=\"${DCMTK_VERSION_NUMBER}\"")