changeset 495:5bb96a6100c0

fixes for mingw64
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 19 Jul 2013 16:11:13 +0200
parents 012b63028085
children 26b2d71228d8 58841db7b64e
files Resources/CMake/Compiler.cmake Resources/CMake/DcmtkConfiguration.cmake Resources/CMake/GoogleLogConfiguration.cmake Resources/CMake/MongooseConfiguration.cmake Resources/Patches/dcmtk-mingw64.patch Resources/Patches/dcmtk-mingw64.txt
diffstat 6 files changed, 58 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/Resources/CMake/Compiler.cmake	Wed Jul 17 13:45:28 2013 +0200
+++ b/Resources/CMake/Compiler.cmake	Fri Jul 19 16:11:13 2013 +0200
@@ -74,6 +74,12 @@
     -D_CRT_SECURE_NO_WARNINGS=1
     )
   link_libraries(rpcrt4 ws2_32)
+
+  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++")
+  endif()
+
 endif()
 
 
--- a/Resources/CMake/DcmtkConfiguration.cmake	Wed Jul 17 13:45:28 2013 +0200
+++ b/Resources/CMake/DcmtkConfiguration.cmake	Fri Jul 19 16:11:13 2013 +0200
@@ -47,6 +47,15 @@
     list(REMOVE_ITEM DCMTK_SOURCES 
       ${DCMTK_SOURCES_DIR}/oflog/libsrc/unixsock.cc
       )
+
+    if (${CMAKE_COMPILER_IS_GNUCXX})
+      # This is a patch for MinGW64
+      execute_process(
+        COMMAND patch -p0 -i ${CMAKE_SOURCE_DIR}/Resources/Patches/dcmtk-mingw64.patch
+        WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
+        )
+    endif()
+
   endif()
 
   list(REMOVE_ITEM DCMTK_SOURCES 
--- a/Resources/CMake/GoogleLogConfiguration.cmake	Wed Jul 17 13:45:28 2013 +0200
+++ b/Resources/CMake/GoogleLogConfiguration.cmake	Fri Jul 19 16:11:13 2013 +0200
@@ -5,6 +5,12 @@
     "http://www.montefiore.ulg.ac.be/~jodogne/Orthanc/ThirdPartyDownloads/glog-0.3.2.tar.gz"
     "${GOOGLE_LOG_SOURCES_DIR}" "" "")
 
+  #SET(GOOGLE_LOG_SOURCES_DIR ${CMAKE_BINARY_DIR}/glog-0.3.3)
+  #DownloadPackage(
+  #  "a6fd2c22f8996846e34c763422717c18"
+  #  "http://www.montefiore.ulg.ac.be/~jodogne/Orthanc/ThirdPartyDownloads/glog-0.3.3.tar.gz"
+  #  "${GOOGLE_LOG_SOURCES_DIR}" "" "")
+
   set(GOOGLE_LOG_HEADERS
     ${GOOGLE_LOG_SOURCES_DIR}/src/glog/logging.h
     ${GOOGLE_LOG_SOURCES_DIR}/src/glog/raw_logging.h
@@ -97,8 +103,16 @@
       -DNO_FRAME_POINTER=1
       -DGOOGLE_GLOG_DLL_DECL=
       )
+
+    if (${CMAKE_COMPILER_IS_GNUCXX})
+      # This is a patch for MinGW64
+      add_definitions(-D_TIME_H__S=1)
+    endif()
+
   endif()
  
+
+
   add_library(GoogleLog STATIC ${GOOGLE_LOG_SOURCES})
   link_libraries(GoogleLog)
 
--- a/Resources/CMake/MongooseConfiguration.cmake	Wed Jul 17 13:45:28 2013 +0200
+++ b/Resources/CMake/MongooseConfiguration.cmake	Fri Jul 19 16:11:13 2013 +0200
@@ -34,6 +34,12 @@
       )
   endif()
 
+
+  if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows" AND ${CMAKE_COMPILER_IS_GNUCXX})
+    # This is a patch for MinGW64
+    add_definitions(-D_TIMESPEC_DEFINED=1)
+  endif()
+
   source_group(ThirdParty\\Mongoose REGULAR_EXPRESSION ${MONGOOSE_SOURCES_DIR}/.*)
 
 else()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resources/Patches/dcmtk-mingw64.patch	Fri Jul 19 16:11:13 2013 +0200
@@ -0,0 +1,22 @@
+diff -urEb dcmtk-3.6.0.orig/ofstd/include/dcmtk/ofstd/offile.h dcmtk-3.6.0/ofstd/include/dcmtk/ofstd/offile.h
+--- dcmtk-3.6.0.orig/ofstd/include/dcmtk/ofstd/offile.h	2010-12-17 11:50:30.000000000 +0100
++++ dcmtk-3.6.0/ofstd/include/dcmtk/ofstd/offile.h	2013-07-19 15:56:25.688996134 +0200
+@@ -196,7 +196,7 @@
+   OFBool popen(const char *command, const char *modes)
+   {
+     if (file_) fclose();
+-#ifdef _WIN32
++#if 0
+     file_ = _popen(command, modes);
+ #else
+     file_ = :: popen(command, modes);
+@@ -258,7 +258,7 @@
+     {
+       if (popened_)
+       {
+-#ifdef _WIN32
++#if 0
+         result = _pclose(file_);
+ #else
+         result = :: pclose(file_);
+Only in dcmtk-3.6.0/ofstd/include/dcmtk/ofstd: offile.h~
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resources/Patches/dcmtk-mingw64.txt	Fri Jul 19 16:11:13 2013 +0200
@@ -0,0 +1,1 @@
+diff -urEb dcmtk-3.6.0.orig/ dcmtk-3.6.0 > ../Resources/Patches/dcmtk-mingw64.patch