changeset 1377:601d34afdab9

patch for recent versions of MinGW
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 29 May 2015 11:50:14 +0200
parents 65a000d823c4
children 5dabfaf6034b
files Resources/CMake/Compiler.cmake Resources/CMake/DcmtkConfiguration.cmake Resources/CMake/GoogleLogConfiguration.cmake Resources/EmbedResources.py
diffstat 4 files changed, 17 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/Resources/CMake/Compiler.cmake	Thu May 28 16:48:36 2015 +0200
+++ b/Resources/CMake/Compiler.cmake	Fri May 29 11:50:14 2015 +0200
@@ -70,6 +70,10 @@
   if (${CMAKE_COMPILER_IS_GNUCXX})
     # This is a patch for MinGW64
     SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--allow-multiple-definition -static-libgcc -static-libstdc++")
+
+    # This line is necessary to compile with recent versions of MinGW,
+    # otherwise "libwinpthread-1.dll" is not statically linked.
+    SET(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} -Wl,-Bstatic -lstdc++ -lpthread -Wl,-Bdynamic")
   endif()
 
 elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
--- a/Resources/CMake/DcmtkConfiguration.cmake	Thu May 28 16:48:36 2015 +0200
+++ b/Resources/CMake/DcmtkConfiguration.cmake	Fri May 29 11:50:14 2015 +0200
@@ -118,6 +118,12 @@
         )
     endif()
 
+    # This patch improves speed, even for Windows
+    execute_process(
+      COMMAND patch -p0 -N -i ${ORTHANC_ROOT}/Resources/Patches/dcmtk-linux-speed.patch
+      WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
+      )
+
   endif()
 
   list(REMOVE_ITEM DCMTK_SOURCES 
--- a/Resources/CMake/GoogleLogConfiguration.cmake	Thu May 28 16:48:36 2015 +0200
+++ b/Resources/CMake/GoogleLogConfiguration.cmake	Fri May 29 11:50:14 2015 +0200
@@ -76,8 +76,10 @@
         )
     endif()
 
+    # Patches for MinGW
     execute_process(
-      COMMAND patch -N port.h ${ORTHANC_ROOT}/Resources/Patches/glog-port-h.diff 
+      #COMMAND patch -N port.h ${ORTHANC_ROOT}/Resources/Patches/glog-port-h.diff 
+      COMMAND patch -N port.h ${ORTHANC_ROOT}/Resources/Patches/glog-port-h-v2.diff 
       WORKING_DIRECTORY ${GOOGLE_LOG_SOURCES_DIR}/src/windows
       )
     execute_process(
--- a/Resources/EmbedResources.py	Thu May 28 16:48:36 2015 +0200
+++ b/Resources/EmbedResources.py	Fri May 29 11:50:14 2015 +0200
@@ -229,6 +229,10 @@
         cpp.write("0x%02x" % c)
         pos += 1
 
+    # Zero-size array are disallowed, so we put one single void character in it.
+    if pos == 0:
+        cpp.write('  0')
+
     cpp.write('  };\n')
     cpp.write('    static const size_t resource%dSize = %d;\n' % (item['Index'], pos))