changeset 2340:b5a04d983647

fix mingw build
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 17 Jul 2017 22:35:42 +0200
parents 6e26d363dc53
children 157584fa9c21
files OrthancServer/DicomProtocol/DicomUserConnection.cpp Resources/CMake/DcmtkConfiguration.cmake
diffstat 2 files changed, 14 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancServer/DicomProtocol/DicomUserConnection.cpp	Mon Jul 17 19:19:08 2017 +0200
+++ b/OrthancServer/DicomProtocol/DicomUserConnection.cpp	Mon Jul 17 22:35:42 2017 +0200
@@ -105,7 +105,8 @@
  * but this string must be 256 bytes or less.
  * http://msdn.microsoft.com/en-us/library/windows/desktop/ms738527(v=vs.85).aspx
  **/
-#define HOST_NAME_MAX 256
+#  define HOST_NAME_MAX 256
+#  include <winsock.h>
 #endif 
 
 
--- a/Resources/CMake/DcmtkConfiguration.cmake	Mon Jul 17 19:19:08 2017 +0200
+++ b/Resources/CMake/DcmtkConfiguration.cmake	Mon Jul 17 22:35:42 2017 +0200
@@ -95,8 +95,19 @@
     ${DCMTK_SOURCES_DIR}/config/include/dcmtk/config/osconfig.h)
 
   if (NOT USE_DCMTK_360)
+    # Configure Wine if cross-compiling for Windows
+    if (CMAKE_CROSSCOMPILING AND WIN32)
+      include(${DCMTK_SOURCES_DIR}/CMake/dcmtkUseWine.cmake)
+      FIND_PROGRAM(WINE_WINE_PROGRAM wine)
+      FIND_PROGRAM(WINE_WINEPATH_PROGRAM winepath)
+      list(APPEND DCMTK_TRY_COMPILE_REQUIRED_CMAKE_FLAGS "-DCMAKE_EXE_LINKER_FLAGS=-static")
+    endif()
+
     # This step must be after the generation of "osconfig.h"
     INSPECT_FUNDAMENTAL_ARITHMETIC_TYPES()
+
+    link_libraries(-lnetapi32)  # For NetWkstaUserGetInfo@12
+    link_libraries(-liphlpapi)  # For GetAdaptersInfo@8
   endif()
 
   AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmdata/libsrc DCMTK_SOURCES)
@@ -182,6 +193,7 @@
   elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
     list(REMOVE_ITEM DCMTK_SOURCES 
       ${DCMTK_SOURCES_DIR}/oflog/libsrc/unixsock.cc
+      ${DCMTK_SOURCES_DIR}/oflog/libsrc/clfsap.cc
       )
 
     if (CMAKE_COMPILER_IS_GNUCXX AND DCMTK_PATCH_MINGW64)