changeset 3129:c262b10bfae1

fix build of civetweb for Visual Studio 2008 and LSB
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 16 Jan 2019 12:17:29 +0100
parents b1787ba94eef
children 858abf26bdf5
files Core/Compression/ZipWriter.cpp Core/DicomNetworking/TimeoutDicomConnectionManager.cpp Core/SerializationToolbox.cpp Resources/CMake/CivetwebConfiguration.cmake
diffstat 4 files changed, 22 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/Core/Compression/ZipWriter.cpp	Wed Jan 16 09:52:05 2019 +0100
+++ b/Core/Compression/ZipWriter.cpp	Wed Jan 16 12:17:29 2019 +0100
@@ -59,9 +59,9 @@
   ptime midnight(today);
 
   time_duration sinceMidnight = now - midnight;
-  zfi.tmz_date.tm_sec = sinceMidnight.seconds();  // seconds after the minute - [0,59]
-  zfi.tmz_date.tm_min = sinceMidnight.minutes();  // minutes after the hour - [0,59]
-  zfi.tmz_date.tm_hour = sinceMidnight.hours();  // hours since midnight - [0,23]
+  zfi.tmz_date.tm_sec = static_cast<unsigned int>(sinceMidnight.seconds());  // seconds after the minute - [0,59]
+  zfi.tmz_date.tm_min = static_cast<unsigned int>(sinceMidnight.minutes());  // minutes after the hour - [0,59]
+  zfi.tmz_date.tm_hour = static_cast<unsigned int>(sinceMidnight.hours());  // hours since midnight - [0,23]
 
   // http://www.boost.org/doc/libs/1_35_0/doc/html/boost/gregorian/greg_day.html
   zfi.tmz_date.tm_mday = today.day();  // day of the month - [1,31]
--- a/Core/DicomNetworking/TimeoutDicomConnectionManager.cpp	Wed Jan 16 09:52:05 2019 +0100
+++ b/Core/DicomNetworking/TimeoutDicomConnectionManager.cpp	Wed Jan 16 12:17:29 2019 +0100
@@ -97,7 +97,7 @@
 
   unsigned int TimeoutDicomConnectionManager::GetTimeout()
   {
-    return timeout_.total_milliseconds();
+    return static_cast<unsigned int>(timeout_.total_milliseconds());
   }
 
 
--- a/Core/SerializationToolbox.cpp	Wed Jan 16 09:52:05 2019 +0100
+++ b/Core/SerializationToolbox.cpp	Wed Jan 16 12:17:29 2019 +0100
@@ -53,7 +53,7 @@
         tag = FromDcmtkBridge::ParseTag(name);
         return true;
       }
-      catch (OrthancException& e)
+      catch (OrthancException&)
       {
         return false;
       }
--- a/Resources/CMake/CivetwebConfiguration.cmake	Wed Jan 16 09:52:05 2019 +0100
+++ b/Resources/CMake/CivetwebConfiguration.cmake	Wed Jan 16 12:17:29 2019 +0100
@@ -3,8 +3,25 @@
   set(CIVETWEB_URL "http://www.orthanc-server.com/downloads/third-party/civetweb-1.11.tar.gz")
   set(CIVETWEB_MD5 "b6d2175650a27924bccb747cbe084cd4")
 
+  if (IS_DIRECTORY "${CIVETWEB_SOURCES_DIR}")
+    set(FirstRun OFF)
+  else()
+    set(FirstRun ON)
+  endif()
+
   DownloadPackage(${CIVETWEB_MD5} ${CIVETWEB_URL} "${CIVETWEB_SOURCES_DIR}")
 
+  execute_process(
+    COMMAND ${PATCH_EXECUTABLE} -p0 -N -i
+    ${ORTHANC_ROOT}/Resources/Patches/civetweb-1.11.patch
+    WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
+    RESULT_VARIABLE Failure
+    )
+
+  if (FirstRun AND Failure)
+    message(FATAL_ERROR "Error while patching a file")
+  endif()
+  
   include_directories(
     ${CIVETWEB_SOURCES_DIR}/include
     )
@@ -13,7 +30,6 @@
     ${CIVETWEB_SOURCES_DIR}/src/civetweb.c
     )
 
-
   if (ENABLE_SSL)
     add_definitions(
       -DNO_SSL_DL=1
@@ -29,13 +45,6 @@
       )
   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\\Civetweb REGULAR_EXPRESSION ${CIVETWEB_SOURCES_DIR}/.*)
 
 else()