changeset 166:9e67a880d35c

sync
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 11 Apr 2018 12:29:58 +0200 (2018-04-11)
parents c2ea17961dfc
children 01248a47aea9
files Orthanc/Resources/CMake/BoostConfiguration.cmake Orthanc/Resources/CMake/Compiler.cmake Orthanc/Resources/CMake/JsonCppConfiguration.cmake Orthanc/Resources/CMake/UuidConfiguration.cmake Orthanc/Resources/LinuxStandardBaseToolchain.cmake Orthanc/Resources/Patches/boost-1.65.1-linux-standard-base.patch Orthanc/Resources/Patches/boost-1.66.0-linux-standard-base.patch Resources/SyncOrthancFolder.py
diffstat 8 files changed, 85 insertions(+), 47 deletions(-) [+]
line wrap: on
line diff
--- a/Orthanc/Resources/CMake/BoostConfiguration.cmake	Thu Mar 08 12:27:20 2018 +0100
+++ b/Orthanc/Resources/CMake/BoostConfiguration.cmake	Wed Apr 11 12:29:58 2018 +0200
@@ -11,10 +11,22 @@
     list(APPEND ORTHANC_BOOST_COMPONENTS locale)
   endif()
 
-  find_package(Boost
-    COMPONENTS filesystem thread system date_time regex ${ORTHANC_BOOST_COMPONENTS})
+  list(APPEND ORTHANC_BOOST_COMPONENTS filesystem thread system date_time regex)
+  find_package(Boost COMPONENTS "${ORTHANC_BOOST_COMPONENTS}")
 
   if (NOT Boost_FOUND)
+    foreach (item ${ORTHANC_BOOST_COMPONENTS})
+      string(TOUPPER ${item} tmp)
+
+      if (Boost_${tmp}_FOUND)
+        set(tmp2 "found")
+      else()
+        set(tmp2 "missing")
+      endif()
+      
+      message("Boost component ${item} - ${tmp2}")
+    endforeach()
+    
     message(FATAL_ERROR "Unable to locate Boost on this system")
   endif()
 
@@ -41,9 +53,9 @@
   ## Parameters for static compilation of Boost 
   ##
   
-  set(BOOST_NAME boost_1_65_1)
-  set(BOOST_BCP_SUFFIX bcpdigest-1.3.1)
-  set(BOOST_MD5 "92c9c603e56bbd7a450a305f08747d90")
+  set(BOOST_NAME boost_1_66_0)
+  set(BOOST_BCP_SUFFIX bcpdigest-1.3.2)
+  set(BOOST_MD5 "4e15b0fd883528be159be9661b6ba20a")
   set(BOOST_URL "http://www.orthanc-server.com/downloads/third-party/${BOOST_NAME}_${BOOST_BCP_SUFFIX}.tar.gz")
   set(BOOST_SOURCES_DIR ${CMAKE_BINARY_DIR}/${BOOST_NAME})
 
@@ -85,11 +97,13 @@
     )
 
   if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase")
-    add_definitions(-DBOOST_SYSTEM_USE_STRERROR=1)
+    add_definitions(
+      -DBOOST_SYSTEM_USE_STRERROR=1
+      )
     
     execute_process(
       COMMAND ${PATCH_EXECUTABLE} -p0 -N -i
-      ${ORTHANC_ROOT}/Resources/Patches/boost-1.65.1-linux-standard-base.patch
+      ${ORTHANC_ROOT}/Resources/Patches/boost-1.66.0-linux-standard-base.patch
       WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
       RESULT_VARIABLE Failure
       )
@@ -133,6 +147,7 @@
       )
 
   elseif (CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
+    # No support for threads in WebAssembly
 
   else()
     message(FATAL_ERROR "Support your platform here")
@@ -242,7 +257,8 @@
             CMAKE_SYSTEM_NAME STREQUAL "kFreeBSD" OR
             CMAKE_SYSTEM_NAME STREQUAL "PNaCl" OR
             CMAKE_SYSTEM_NAME STREQUAL "NaCl32" OR
-            CMAKE_SYSTEM_NAME STREQUAL "NaCl64")
+            CMAKE_SYSTEM_NAME STREQUAL "NaCl64" OR
+            CMAKE_SYSTEM_NAME STREQUAL "Emscripten") # For WebAssembly or asm.js
       list(APPEND BOOST_SOURCES
         ${BOOST_SOURCES_DIR}/libs/locale/src/posix/codecvt.cpp
         ${BOOST_SOURCES_DIR}/libs/locale/src/posix/collate.cpp
--- a/Orthanc/Resources/CMake/Compiler.cmake	Thu Mar 08 12:27:20 2018 +0100
+++ b/Orthanc/Resources/CMake/Compiler.cmake	Wed Apr 11 12:29:58 2018 +0200
@@ -174,16 +174,18 @@
 elseif (CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
   message("Building using Emscripten (for WebAssembly or asm.js targets)")
 
+  # The BINARYEN_TRAP_MODE specifies what to do when divisions per
+  # zero (and similar conditions like integer overflows) are
+  # encountered: The "clamp" mode avoids throwing errors, as they
+  # cannot be properly catched by "try {} catch (...)" constructions.
+  set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s EXTRA_EXPORTED_RUNTIME_METHODS='[\"ccall\", \"cwrap\"]' -s BINARYEN_TRAP_MODE='\"clamp\"'")
+
 else()
   message(FATAL_ERROR "Support your platform here")
 endif()
 
 
 if (DEFINED ENABLE_PROFILING AND ENABLE_PROFILING)
-  if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
-    message(WARNING "Enabling profiling on a non-debug build will not produce full information")
-  endif()
-
   if (CMAKE_COMPILER_IS_GNUCXX)
     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg")
     set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pg")
--- a/Orthanc/Resources/CMake/JsonCppConfiguration.cmake	Thu Mar 08 12:27:20 2018 +0100
+++ b/Orthanc/Resources/CMake/JsonCppConfiguration.cmake	Wed Apr 11 12:29:58 2018 +0200
@@ -1,7 +1,18 @@
+set(JSONCPP_CXX11 OFF)
+
 if (STATIC_BUILD OR NOT USE_SYSTEM_JSONCPP)
-  set(JSONCPP_SOURCES_DIR ${CMAKE_BINARY_DIR}/jsoncpp-0.10.5)
-  set(JSONCPP_URL "http://www.orthanc-server.com/downloads/third-party/jsoncpp-0.10.5.tar.gz")
-  set(JSONCPP_MD5 "db146bac5a126ded9bd728ab7b61ed6b")
+  if (USE_LEGACY_JSONCPP)
+    set(JSONCPP_SOURCES_DIR ${CMAKE_BINARY_DIR}/jsoncpp-0.10.6)
+    set(JSONCPP_URL "http://www.orthanc-server.com/downloads/third-party/jsoncpp-0.10.6.tar.gz")
+    set(JSONCPP_MD5 "13d1991d79697df8cadbc25c93e37c83")
+    add_definitions(-DORTHANC_LEGACY_JSONCPP=1)
+  else()
+    set(JSONCPP_SOURCES_DIR ${CMAKE_BINARY_DIR}/jsoncpp-1.8.4)
+    set(JSONCPP_URL "http://www.orthanc-server.com/downloads/third-party/jsoncpp-1.8.4.tar.gz")
+    set(JSONCPP_MD5 "fa47a3ab6b381869b6a5f20811198662")
+    add_definitions(-DORTHANC_LEGACY_JSONCPP=0)
+    set(JSONCPP_CXX11 ON)
+  endif()
 
   DownloadPackage(${JSONCPP_MD5} ${JSONCPP_URL} "${JSONCPP_SOURCES_DIR}")
 
@@ -48,14 +59,24 @@
       JSONCPP_VERSION_MAJOR ${JSONCPP_VERSION_MAJOR1})
     message("JsonCpp major version: ${JSONCPP_VERSION_MAJOR}")
 
-    if ((CMAKE_COMPILER_IS_GNUCXX OR
-          "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") AND 
-        JSONCPP_VERSION_MAJOR GREATER 0)
-      message("Switching to C++11 standard in gcc/clang, as version of JsonCpp is >= 1.0.0")
-      set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wno-deprecated-declarations")
+    if (JSONCPP_VERSION_MAJOR GREATER 0)
+      set(JSONCPP_CXX11 ON)
     endif()
   else()
     message("Unable to detect the major version of JsonCpp, assuming < 1.0.0")
   endif()
+endif()
 
+
+if (JSONCPP_CXX11)
+  # Osimis has encountered problems when this macro is left at its
+  # default value (1000), so we increase this limit
+  # https://gitlab.kitware.com/third-party/jsoncpp/commit/56df2068470241f9043b676bfae415ed62a0c172
+  add_definitions(-DJSONCPP_DEPRECATED_STACK_LIMIT=5000)
+
+  if (CMAKE_COMPILER_IS_GNUCXX OR
+      "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
+    message("Switching to C++11 standard in gcc/clang, as version of JsonCpp is >= 1.0.0")
+    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wno-deprecated-declarations")
+  endif()
 endif()
--- a/Orthanc/Resources/CMake/UuidConfiguration.cmake	Thu Mar 08 12:27:20 2018 +0100
+++ b/Orthanc/Resources/CMake/UuidConfiguration.cmake	Wed Apr 11 12:29:58 2018 +0200
@@ -39,7 +39,7 @@
     check_include_file("sys/un.h"       HAVE_SYS_UN_H)
     check_include_file("unistd.h"       HAVE_UNISTD_H)
 
-    If (NOT HAVE_NET_IF_H)  # This is the case of OpenBSD
+    if (NOT HAVE_NET_IF_H)  # This is the case of OpenBSD
       unset(HAVE_NET_IF_H CACHE)
       check_include_files("sys/socket.h;net/if.h" HAVE_NET_IF_H)
     endif()
@@ -49,7 +49,8 @@
       check_include_files("sys/socket.h;netinet/tcp.h" HAVE_NETINET_TCP_H)
     endif()
 
-    file(WRITE ${E2FSPROGS_SOURCES_DIR}/lib/uuid/config.h.cmake "
+    if (NOT EXISTS ${E2FSPROGS_SOURCES_DIR}/lib/uuid/config.h)
+      file(WRITE ${E2FSPROGS_SOURCES_DIR}/lib/uuid/config.h.cmake "
 #cmakedefine HAVE_NET_IF_H \@HAVE_NET_IF_H\@
 #cmakedefine HAVE_NET_IF_DL_H \@HAVE_NET_IF_DL_H\@
 #cmakedefine HAVE_NETINET_IN_H \@HAVE_NETINET_IN_H\@
@@ -64,26 +65,23 @@
 #cmakedefine HAVE_SYS_UN_H \@HAVE_SYS_UN_H\@
 #cmakedefine HAVE_UNISTD_H \@HAVE_UNISTD_H\@
 ")
-    
+    endif()
+      
     configure_file(
       ${E2FSPROGS_SOURCES_DIR}/lib/uuid/config.h.cmake
       ${E2FSPROGS_SOURCES_DIR}/lib/uuid/config.h
       )
-    
-    
+      
     configure_file(
       ${E2FSPROGS_SOURCES_DIR}/lib/uuid/uuid.h.in
       ${E2FSPROGS_SOURCES_DIR}/lib/uuid/uuid.h
       )
 
-    file(WRITE
-      ${E2FSPROGS_SOURCES_DIR}/lib/uuid/uuid_types.h
-      "#include <stdint.h>\n")
-
-    #configure_file(
-    #  ${E2FSPROGS_SOURCES_DIR}/lib/uuid/uuid_types.h.in
-    #  ${E2FSPROGS_SOURCES_DIR}/lib/uuid/uuid_types.h
-    #  )
+    if (NOT EXISTS ${E2FSPROGS_SOURCES_DIR}/lib/uuid/uuid_types.h)
+      file(WRITE
+        ${E2FSPROGS_SOURCES_DIR}/lib/uuid/uuid_types.h
+        "#include <stdint.h>\n")
+    endif()
     
     source_group(ThirdParty\\uuid REGULAR_EXPRESSION ${E2FSPROGS_SOURCES_DIR}/.*)
 
--- a/Orthanc/Resources/LinuxStandardBaseToolchain.cmake	Thu Mar 08 12:27:20 2018 +0100
+++ b/Orthanc/Resources/LinuxStandardBaseToolchain.cmake	Wed Apr 11 12:29:58 2018 +0200
@@ -1,4 +1,4 @@
-# LSB_CC=gcc-4.8 LSB_CXX=g++-4.8 cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=../Resources/LinuxStandardBaseToolchain.cmake
+# LSB_CC=gcc-4.8 LSB_CXX=g++-4.8 cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=../Resources/LinuxStandardBaseToolchain.cmake -DUSE_LEGACY_JSONCPP=ON
 
 INCLUDE(CMakeForceCompiler)
 
--- a/Orthanc/Resources/Patches/boost-1.65.1-linux-standard-base.patch	Thu Mar 08 12:27:20 2018 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-diff -urEb boost_1_65_1.orig/boost/move/adl_move_swap.hpp boost_1_65_1/boost/move/adl_move_swap.hpp
---- boost_1_65_1.orig/boost/move/adl_move_swap.hpp	2017-11-08 17:43:20.000000000 +0100
-+++ boost_1_65_1/boost/move/adl_move_swap.hpp	2018-01-02 15:34:48.829052917 +0100
-@@ -28,6 +28,8 @@
- //Try to avoid including <algorithm>, as it's quite big
- #if defined(_MSC_VER) && defined(BOOST_DINKUMWARE_STDLIB)
-    #include <utility>   //Dinkum libraries define std::swap in utility which is lighter than algorithm
-+#elif defined(__LSB_VERSION__)
-+#  include <utility>
- #elif defined(BOOST_GNU_STDLIB)
-    //For non-GCC compilers, where GNUC version is not very reliable, or old GCC versions
-    //use the good old stl_algobase header, which is quite lightweight
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Orthanc/Resources/Patches/boost-1.66.0-linux-standard-base.patch	Wed Apr 11 12:29:58 2018 +0200
@@ -0,0 +1,13 @@
+diff -urEb boost_1_66_0.orig/boost/move/adl_move_swap.hpp boost_1_66_0/boost/move/adl_move_swap.hpp
+--- boost_1_66_0.orig/boost/move/adl_move_swap.hpp	2018-04-11 11:56:16.761768726 +0200
++++ boost_1_66_0/boost/move/adl_move_swap.hpp	2018-04-11 11:57:01.073881330 +0200
+@@ -28,6 +28,8 @@
+ //Try to avoid including <algorithm>, as it's quite big
+ #if defined(_MSC_VER) && defined(BOOST_DINKUMWARE_STDLIB)
+    #include <utility>   //Dinkum libraries define std::swap in utility which is lighter than algorithm
++#elif defined(__LSB_VERSION__)
++#  include <utility>
+ #elif defined(BOOST_GNU_STDLIB)
+    //For non-GCC compilers, where GNUC version is not very reliable, or old GCC versions
+    //use the good old stl_algobase header, which is quite lightweight
+Only in boost_1_66_0/boost/move: adl_move_swap.hpp~
--- a/Resources/SyncOrthancFolder.py	Thu Mar 08 12:27:20 2018 +0100
+++ b/Resources/SyncOrthancFolder.py	Wed Apr 11 12:29:58 2018 +0200
@@ -30,7 +30,7 @@
     'Resources/MinGW-W64-Toolchain32.cmake',
     'Resources/MinGW-W64-Toolchain64.cmake',
     'Resources/MinGWToolchain.cmake',
-    'Resources/Patches/boost-1.65.1-linux-standard-base.patch',
+    'Resources/Patches/boost-1.66.0-linux-standard-base.patch',
     'Resources/ThirdParty/VisualStudio/stdint.h',
     'Resources/WindowsResources.py',
     'Resources/WindowsResources.rc',