changeset 2547:8b6b0b6ece6b

MinGW, ORTHANC_FRAMEWORK_URL
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 18 Apr 2018 10:23:40 +0200
parents 6d5e36e1256f
children 85468baba6a8 1e180dd30d17
files INSTALL OrthancServer/OrthancInitialization.cpp Resources/DownloadOrthancFramework.cmake Resources/MinGWToolchain.cmake
diffstat 4 files changed, 45 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/INSTALL	Tue Apr 17 19:19:27 2018 +0200
+++ b/INSTALL	Wed Apr 18 10:23:40 2018 +0200
@@ -95,13 +95,35 @@
 Cross-Compilation for Windows under GNU/Linux
 ---------------------------------------------
 
-To cross-compile Windows binaries under Linux using MinGW-W64, please
-use the following command:
+Some versions of MinGW-W64 might have problems with C++11 (notably
+those shipped in Ubuntu 16.04 LTS, in the "mingw-w64" package). Use
+the following command to disable C++11:
 
 # cd ~/OrthancBuild
-# cmake -DCMAKE_TOOLCHAIN_FILE=~/Orthanc/Resources/MinGW-W64-Toolchain32.cmake -DSTATIC_BUILD=ON -DSTANDALONE_BUILD=ON -DUSE_DCMTK_360=ON -DCMAKE_BUILD_TYPE=Debug ~/Orthanc
+# cmake ~/Orthanc \
+        -DCMAKE_BUILD_TYPE=Debug \
+        -DCMAKE_TOOLCHAIN_FILE=~/Orthanc/Resources/MinGW-W64-Toolchain32.cmake \
+        -DSTANDALONE_BUILD=ON \
+        -DSTATIC_BUILD=ON \
+        -DUSE_LEGACY_JSONCPP=ON
 # make
 
-For older MinGW32, use the following CMake invokation:
+NB: Use the toolchain "MinGW-W64-Toolchain64.cmake" to produce 64bit
+Windows binaries.
+
+
+
+Legacy MinGW32 compilers (notably those shipped in Ubuntu 14.04 LTS,
+in the "mingw32" package) are incompatible with DCMTK 3.6.2 and
+C++11. Use the following command to force using DCMTK 3.6.0 and
+disable C++11:
 
-# cmake -DCMAKE_TOOLCHAIN_FILE=~/Orthanc/Resources/MinGWToolchain.cmake -DSTATIC_BUILD=ON -DSTANDALONE_BUILD=ON -DCMAKE_BUILD_TYPE=Debug -DUSE_DCMTK_360=ON -DUSE_LEGACY_JSONCPP=ON ~/Orthanc
+# cd ~/OrthancBuild
+# cmake ~/Orthanc \
+        -DCMAKE_BUILD_TYPE=Debug \
+        -DCMAKE_TOOLCHAIN_FILE=~/Orthanc/Resources/MinGWToolchain.cmake \
+        -DSTANDALONE_BUILD=ON \
+        -DSTATIC_BUILD=ON \
+        -DUSE_DCMTK_360=ON \
+        -DUSE_LEGACY_JSONCPP=ON
+# make
--- a/OrthancServer/OrthancInitialization.cpp	Tue Apr 17 19:19:27 2018 +0200
+++ b/OrthancServer/OrthancInitialization.cpp	Wed Apr 18 10:23:40 2018 +0200
@@ -32,6 +32,12 @@
 
 
 #include "PrecompiledHeadersServer.h"
+
+#if defined(_WIN32)
+// "Please include winsock2.h before windows.h"
+#  include <winsock2.h>
+#endif
+
 #include "OrthancInitialization.h"
 
 #include "../Core/HttpClient.h"
--- a/Resources/DownloadOrthancFramework.cmake	Tue Apr 17 19:19:27 2018 +0200
+++ b/Resources/DownloadOrthancFramework.cmake	Wed Apr 18 10:23:40 2018 +0200
@@ -206,12 +206,17 @@
 
 
 ##
-## Case of the Orthanc framework downloaded from the official Web site
+## Case of the Orthanc framework downloaded from the Web
 ##
 
 if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "web")
-  set(ORTHANC_FRAMEMORK_FILENAME Orthanc-${ORTHANC_FRAMEWORK_VERSION}.tar.gz)
-  set(ORTHANC_FRAMEWORK_URL "https://www.orthanc-server.com/downloads/get.php?path=/orthanc/${ORTHANC_FRAMEMORK_FILENAME}")
+  if (DEFINED ORTHANC_FRAMEWORK_URL)
+    string(REGEX REPLACE "^.*/" "" ORTHANC_FRAMEMORK_FILENAME "${ORTHANC_FRAMEWORK_URL}")
+  else()
+    # Default case: Download from the official Web site
+    set(ORTHANC_FRAMEMORK_FILENAME Orthanc-${ORTHANC_FRAMEWORK_VERSION}.tar.gz)
+    set(ORTHANC_FRAMEWORK_URL "https://www.orthanc-server.com/downloads/get.php?path=/orthanc/${ORTHANC_FRAMEMORK_FILENAME}")
+  endif()
 
   set(ORTHANC_FRAMEWORK_ARCHIVE "${CMAKE_SOURCE_DIR}/ThirdPartyDownloads/${ORTHANC_FRAMEMORK_FILENAME}")
 
@@ -220,7 +225,7 @@
       message(FATAL_ERROR "CMake is not allowed to download from Internet. Please set the ALLOW_DOWNLOADS option to ON")
     endif()
 
-    message("Downloading: ${ORTHANC_FRAMEWORK_ARCHIVE}")
+    message("Downloading: ${ORTHANC_FRAMEWORK_URL}")
 
     file(DOWNLOAD
       "${ORTHANC_FRAMEWORK_URL}" "${ORTHANC_FRAMEWORK_ARCHIVE}" 
--- a/Resources/MinGWToolchain.cmake	Tue Apr 17 19:19:27 2018 +0200
+++ b/Resources/MinGWToolchain.cmake	Wed Apr 18 10:23:40 2018 +0200
@@ -15,3 +15,6 @@
 set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
 set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
 set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
+
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DSTACK_SIZE_PARAM_IS_A_RESERVATION=0x10000" CACHE INTERNAL "" FORCE)
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSTACK_SIZE_PARAM_IS_A_RESERVATION=0x10000" CACHE INTERNAL "" FORCE)