changeset 32:79d871605ffd

sync
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 30 Jun 2020 07:38:31 +0200
parents c304ffca5d80
children b9c536bf598b 53dbed29949a
files CMakeLists.txt Plugin/AccessedResource.cpp Plugin/AssociativeArray.cpp Plugin/AuthorizationParserBase.cpp Plugin/AuthorizationWebService.cpp Plugin/CachedAuthorizationService.cpp Plugin/DefaultAuthorizationParser.cpp Plugin/Enumerations.cpp Plugin/Enumerations.h Plugin/MemoryCache.h Plugin/OrthancResource.cpp Plugin/Plugin.cpp Plugin/ResourceHierarchyCache.cpp Plugin/Token.cpp Resources/Orthanc/DownloadOrthancFramework.cmake Resources/Orthanc/LinuxStandardBaseToolchain.cmake Resources/Orthanc/Sdk-1.3.1/orthanc/OrthancCPlugin.h Resources/SyncOrthancFolder.py
diffstat 18 files changed, 191 insertions(+), 33 deletions(-) [+]
line wrap: on
line diff
--- a/CMakeLists.txt	Fri Jan 31 17:51:30 2020 +0100
+++ b/CMakeLists.txt	Tue Jun 30 07:38:31 2020 +0200
@@ -47,9 +47,15 @@
 include(${ORTHANC_ROOT}/Resources/CMake/OrthancFrameworkParameters.cmake)
 
 set(ENABLE_LOCALE OFF)           # Disable support for locales (notably in Boost)
+set(ENABLE_MODULE_IMAGES OFF)
+set(ENABLE_MODULE_JOBS OFF)
+set(ENABLE_MODULE_DICOM OFF)
 
 include(${ORTHANC_ROOT}/Resources/CMake/OrthancFrameworkConfiguration.cmake)
-include_directories(${ORTHANC_ROOT})
+include_directories(
+  ${ORTHANC_ROOT}/Core
+  ${ORTHANC_ROOT}/Plugins/Samples/Common
+  )
 
 
 # Check that the Orthanc SDK headers are available
--- a/Plugin/AccessedResource.cpp	Fri Jan 31 17:51:30 2020 +0100
+++ b/Plugin/AccessedResource.cpp	Tue Jun 30 07:38:31 2020 +0200
@@ -18,7 +18,7 @@
 
 #include "AccessedResource.h"
 
-#include <Core/OrthancException.h>
+#include <OrthancException.h>
 
 namespace OrthancPlugins
 {
--- a/Plugin/AssociativeArray.cpp	Fri Jan 31 17:51:30 2020 +0100
+++ b/Plugin/AssociativeArray.cpp	Tue Jun 30 07:38:31 2020 +0200
@@ -18,7 +18,7 @@
 
 #include "AssociativeArray.h"
 
-#include <Core/Toolbox.h>
+#include <Toolbox.h>
 
 namespace OrthancPlugins
 {
--- a/Plugin/AuthorizationParserBase.cpp	Fri Jan 31 17:51:30 2020 +0100
+++ b/Plugin/AuthorizationParserBase.cpp	Tue Jun 30 07:38:31 2020 +0200
@@ -18,7 +18,7 @@
 
 #include "AuthorizationParserBase.h"
 
-#include <Core/OrthancException.h>
+#include <OrthancException.h>
 
 namespace OrthancPlugins
 {
--- a/Plugin/AuthorizationWebService.cpp	Fri Jan 31 17:51:30 2020 +0100
+++ b/Plugin/AuthorizationWebService.cpp	Tue Jun 30 07:38:31 2020 +0200
@@ -18,8 +18,8 @@
 
 #include "AuthorizationWebService.h"
 
-#include <Core/Logging.h>
-#include <Plugins/Samples/Common/OrthancPluginCppWrapper.h>
+#include <Logging.h>
+#include <OrthancPluginCppWrapper.h>
 
 namespace OrthancPlugins
 {
--- a/Plugin/CachedAuthorizationService.cpp	Fri Jan 31 17:51:30 2020 +0100
+++ b/Plugin/CachedAuthorizationService.cpp	Tue Jun 30 07:38:31 2020 +0200
@@ -18,7 +18,7 @@
 
 #include "CachedAuthorizationService.h"
 
-#include <Core/OrthancException.h>
+#include <OrthancException.h>
 
 #include <boost/lexical_cast.hpp>
 
--- a/Plugin/DefaultAuthorizationParser.cpp	Fri Jan 31 17:51:30 2020 +0100
+++ b/Plugin/DefaultAuthorizationParser.cpp	Tue Jun 30 07:38:31 2020 +0200
@@ -18,7 +18,7 @@
 
 #include "DefaultAuthorizationParser.h"
 
-#include <Core/OrthancException.h>
+#include <OrthancException.h>
 
 namespace OrthancPlugins
 {
--- a/Plugin/Enumerations.cpp	Fri Jan 31 17:51:30 2020 +0100
+++ b/Plugin/Enumerations.cpp	Tue Jun 30 07:38:31 2020 +0200
@@ -19,8 +19,8 @@
 
 #include "Enumerations.h"
 
-#include <Core/OrthancException.h>
-#include <Core/Toolbox.h>
+#include <OrthancException.h>
+#include <Toolbox.h>
 
 namespace OrthancPlugins
 {
--- a/Plugin/Enumerations.h	Fri Jan 31 17:51:30 2020 +0100
+++ b/Plugin/Enumerations.h	Tue Jun 30 07:38:31 2020 +0200
@@ -18,7 +18,7 @@
 
 #pragma once
 
-#include <Core/Enumerations.h>
+#include <Enumerations.h>
 
 namespace OrthancPlugins
 {
--- a/Plugin/MemoryCache.h	Fri Jan 31 17:51:30 2020 +0100
+++ b/Plugin/MemoryCache.h	Tue Jun 30 07:38:31 2020 +0200
@@ -19,7 +19,8 @@
 #pragma once
 
 #include "ICacheFactory.h"
-#include <Core/Cache/LeastRecentlyUsedIndex.h>
+
+#include <Cache/LeastRecentlyUsedIndex.h>
 
 #include <boost/thread/mutex.hpp>
 
--- a/Plugin/OrthancResource.cpp	Fri Jan 31 17:51:30 2020 +0100
+++ b/Plugin/OrthancResource.cpp	Tue Jun 30 07:38:31 2020 +0200
@@ -18,7 +18,7 @@
 
 #include "OrthancResource.h"
 
-#include <Plugins/Samples/Common/OrthancPluginCppWrapper.h>
+#include <OrthancPluginCppWrapper.h>
 
 namespace OrthancPlugins
 {
--- a/Plugin/Plugin.cpp	Fri Jan 31 17:51:30 2020 +0100
+++ b/Plugin/Plugin.cpp	Tue Jun 30 07:38:31 2020 +0200
@@ -22,9 +22,9 @@
 #include "AuthorizationWebService.h"
 #include "MemoryCache.h"
 
-#include <Plugins/Samples/Common/OrthancPluginCppWrapper.h>
-#include <Core/Logging.h>
-#include <Core/Toolbox.h>
+#include <OrthancPluginCppWrapper.h>
+#include <Logging.h>
+#include <Toolbox.h>
 
 
 // Configuration of the authorization plugin
@@ -256,7 +256,7 @@
       return -1;
     }
 
-    Orthanc::Logging::Initialize(context);
+    Orthanc::Logging::InitializePluginContext(context);
     OrthancPluginSetDescription(context, "Advanced authorization plugin for Orthanc.");
 
     try
--- a/Plugin/ResourceHierarchyCache.cpp	Fri Jan 31 17:51:30 2020 +0100
+++ b/Plugin/ResourceHierarchyCache.cpp	Tue Jun 30 07:38:31 2020 +0200
@@ -18,8 +18,8 @@
 
 #include "ResourceHierarchyCache.h"
 
-#include <Core/Logging.h>
-#include <Core/OrthancException.h>
+#include <Logging.h>
+#include <OrthancException.h>
 
 #include <boost/lexical_cast.hpp>
 
--- a/Plugin/Token.cpp	Fri Jan 31 17:51:30 2020 +0100
+++ b/Plugin/Token.cpp	Tue Jun 30 07:38:31 2020 +0200
@@ -18,7 +18,7 @@
 
 #include "Token.h"
 
-#include <Core/OrthancException.h>
+#include <OrthancException.h>
 
 namespace OrthancPlugins
 { 
--- a/Resources/Orthanc/DownloadOrthancFramework.cmake	Fri Jan 31 17:51:30 2020 +0100
+++ b/Resources/Orthanc/DownloadOrthancFramework.cmake	Tue Jun 30 07:38:31 2020 +0200
@@ -35,11 +35,12 @@
 ##
 
 if (NOT DEFINED ORTHANC_FRAMEWORK_SOURCE OR
-    (NOT ORTHANC_FRAMEWORK_SOURCE STREQUAL "hg" AND
+    (NOT ORTHANC_FRAMEWORK_SOURCE STREQUAL "system" AND
+     NOT ORTHANC_FRAMEWORK_SOURCE STREQUAL "hg" AND
      NOT ORTHANC_FRAMEWORK_SOURCE STREQUAL "web" AND
      NOT ORTHANC_FRAMEWORK_SOURCE STREQUAL "archive" AND
      NOT ORTHANC_FRAMEWORK_SOURCE STREQUAL "path"))
-  message(FATAL_ERROR "The variable ORTHANC_FRAMEWORK_SOURCE must be set to \"hg\", \"web\", \"archive\" or \"path\"")
+  message(FATAL_ERROR "The variable ORTHANC_FRAMEWORK_SOURCE must be set to \"system\", \"hg\", \"web\", \"archive\" or \"path\"")
 endif()
 
 
@@ -112,10 +113,30 @@
         set(ORTHANC_FRAMEWORK_MD5 "e1b76f01116d9b5d4ac8cc39980560e3")
       elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.5.8")
         set(ORTHANC_FRAMEWORK_MD5 "82323e8c49a667f658a3639ea4dbc336")
+      elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.6.0")
+        set(ORTHANC_FRAMEWORK_MD5 "eab428d6e53f61e847fa360bb17ebe25")
+      elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.6.1")
+        set(ORTHANC_FRAMEWORK_MD5 "3971f5de96ba71dc9d3f3690afeaa7c0")
+      elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.7.0")
+        set(ORTHANC_FRAMEWORK_MD5 "ce5f689e852b01d3672bd3d2f952a5ef")
+      elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.7.1")
+        set(ORTHANC_FRAMEWORK_MD5 "3c171217f930abe80246997bdbcaf7cc")
+
+      # Below this point are development snapshots that were used to
+      # release some plugin, before an official release of the Orthanc
+      # framework was available. Here is the command to be used to
+      # generate a proper archive:
+      #
+      #   $ hg archive /tmp/Orthanc-`hg id -i | sed 's/\+//'`.tar.gz
+      #
+      elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "ae0e3fd609df")
+        # DICOMweb 1.1 (framework pre-1.6.0)
+        set(ORTHANC_FRAMEWORK_MD5 "7e09e9b530a2f527854f0b782d7e0645")
       endif()
     endif()
   endif()
-else()
+
+elseif (NOT ORTHANC_FRAMEWORK_SOURCE STREQUAL "system")
   message("Using the Orthanc framework from a path of the filesystem. Assuming mainline version.")
   set(ORTHANC_FRAMEWORK_MAJOR 999)
   set(ORTHANC_FRAMEWORK_MINOR 999)
@@ -203,7 +224,7 @@
   else()
     message("Forking the Orthanc source repository using Mercurial")
     execute_process(
-      COMMAND ${ORTHANC_FRAMEWORK_HG} clone "https://bitbucket.org/sjodogne/orthanc"
+      COMMAND ${ORTHANC_FRAMEWORK_HG} clone "https://hg.orthanc-server.com/orthanc/"
       WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
       RESULT_VARIABLE Failure
       )    
@@ -352,3 +373,125 @@
     endif()
   endif()
 endif()
+
+
+
+##
+## Case of the Orthanc framework installed as a shared library in a
+## GNU/Linux distribution (typically Debian)
+##
+
+if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "system")
+  set(ORTHANC_FRAMEWORK_LIBDIR "" CACHE PATH "")
+
+  if (CMAKE_SYSTEM_NAME STREQUAL "Windows" AND
+      CMAKE_COMPILER_IS_GNUCXX) # MinGW
+    set(DYNAMIC_MINGW_STDLIB ON)   # Disable static linking against libc (to throw exceptions)
+    set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-libstdc++")
+    set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libstdc++")
+  endif()
+  
+  include(CheckIncludeFile)
+  include(CheckIncludeFileCXX)
+  include(FindPythonInterp)
+  include(${CMAKE_CURRENT_LIST_DIR}/Compiler.cmake)
+  include(${CMAKE_CURRENT_LIST_DIR}/DownloadPackage.cmake)
+  include(${CMAKE_CURRENT_LIST_DIR}/AutoGeneratedCode.cmake)
+  set(EMBED_RESOURCES_PYTHON ${CMAKE_CURRENT_LIST_DIR}/EmbedResources.py)
+
+  if (NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "Windows" AND
+      NOT ORTHANC_FRAMEWORK_STATIC)
+    # Look for mandatory dependency JsonCpp (cf. JsonCppConfiguration.cmake)
+    find_path(JSONCPP_INCLUDE_DIR json/reader.h
+      /usr/include/jsoncpp
+      /usr/local/include/jsoncpp
+      )
+
+    message("JsonCpp include dir: ${JSONCPP_INCLUDE_DIR}")
+    include_directories(${JSONCPP_INCLUDE_DIR})
+    link_libraries(jsoncpp)
+
+    CHECK_INCLUDE_FILE_CXX(${JSONCPP_INCLUDE_DIR}/json/reader.h HAVE_JSONCPP_H)
+    if (NOT HAVE_JSONCPP_H)
+      message(FATAL_ERROR "Please install the libjsoncpp-dev package")
+    endif()
+
+    # Look for mandatory dependency Boost (cf. BoostConfiguration.cmake)
+    include(FindBoost)
+    find_package(Boost COMPONENTS filesystem thread system date_time regex)
+
+    if (NOT Boost_FOUND)
+      message(FATAL_ERROR "Unable to locate Boost on this system")
+    endif()
+    
+    include_directories(${Boost_INCLUDE_DIRS})
+    link_libraries(${Boost_LIBRARIES})
+
+    # Optional component - Lua
+    if (ENABLE_LUA)
+      include(FindLua)
+
+      if (NOT LUA_FOUND)
+        message(FATAL_ERROR "Please install the liblua-dev package")
+      endif()
+
+      include_directories(${LUA_INCLUDE_DIR})
+      link_libraries(${LUA_LIBRARIES})
+    endif()
+
+    # Optional component - SQLite
+    if (ENABLE_SQLITE)    
+      CHECK_INCLUDE_FILE(sqlite3.h HAVE_SQLITE_H)
+      if (NOT HAVE_SQLITE_H)
+        message(FATAL_ERROR "Please install the libsqlite3-dev package")
+      endif()
+      link_libraries(sqlite3)
+    endif()
+  endif()
+
+  # Optional component - Google Test
+  if (ENABLE_GOOGLE_TEST)
+    set(USE_SYSTEM_GOOGLE_TEST ON CACHE BOOL "Use the system version of Google Test")
+    set(USE_GOOGLE_TEST_DEBIAN_PACKAGE OFF CACHE BOOL "Use the sources of Google Test shipped with libgtest-dev (Debian only)")
+    mark_as_advanced(USE_GOOGLE_TEST_DEBIAN_PACKAGE)
+    include(${CMAKE_CURRENT_LIST_DIR}/GoogleTestConfiguration.cmake)
+  endif()
+
+  # Look for Orthanc framework shared library
+  include(CheckCXXSymbolExists)
+
+  if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
+    set(ORTHANC_FRAMEWORK_INCLUDE_DIR ${ORTHANC_FRAMEWORK_ROOT})
+    include_directories(${ORTHANC_FRAMEWORK_ROOT}/..)
+  else()
+    find_path(ORTHANC_FRAMEWORK_INCLUDE_DIR OrthancFramework.h
+      /usr/include/orthanc-framework
+      /usr/local/include/orthanc-framework
+      ${ORTHANC_FRAMEWORK_ROOT}
+      )
+  endif()
+  
+  message("Orthanc framework include dir: ${ORTHANC_FRAMEWORK_INCLUDE_DIR}")
+  include_directories(${ORTHANC_FRAMEWORK_INCLUDE_DIR})
+  
+  set(CMAKE_REQUIRED_INCLUDES "${ORTHANC_FRAMEWORK_INCLUDE_DIR}")
+
+  if (NOT "${ORTHANC_FRAMEWORK_LIBDIR}" STREQUAL "")
+    set(CMAKE_REQUIRED_LIBRARIES "-L${ORTHANC_FRAMEWORK_LIBDIR} -lOrthancFramework")
+  else()
+    set(CMAKE_REQUIRED_LIBRARIES "OrthancFramework")
+  endif()
+  
+  check_cxx_symbol_exists("Orthanc::InitializeFramework" "OrthancFramework.h" HAVE_ORTHANC_FRAMEWORK)
+  if(NOT HAVE_ORTHANC_FRAMEWORK)
+    message(FATAL_ERROR "Cannot find the Orthanc framework")
+  endif()
+
+  if (NOT "${ORTHANC_FRAMEWORK_ROOT}" STREQUAL "")
+    include_directories(${ORTHANC_FRAMEWORK_ROOT})
+  endif()
+
+  if (NOT "${ORTHANC_FRAMEWORK_LIBDIR}" STREQUAL "")
+    link_directories(${ORTHANC_FRAMEWORK_LIBDIR})
+  endif()
+endif()
--- a/Resources/Orthanc/LinuxStandardBaseToolchain.cmake	Fri Jan 31 17:51:30 2020 +0100
+++ b/Resources/Orthanc/LinuxStandardBaseToolchain.cmake	Tue Jun 30 07:38:31 2020 +0200
@@ -1,11 +1,19 @@
-# 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 -DUSE_LEGACY_LIBICU=ON -DBOOST_LOCALE_BACKEND=icu
+#
+# Full build, as used on the BuildBot CIS:
+#
+#   $ 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 -DUSE_LEGACY_LIBICU=ON -DBOOST_LOCALE_BACKEND=icu -DENABLE_PKCS11=ON -G Ninja
+#
+# Or, more lightweight version (without libp11 and ICU):
+#
+#   $ 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 -G Ninja
+#
 
 INCLUDE(CMakeForceCompiler)
 
-SET(LSB_PATH $ENV{LSB_PATH})
-SET(LSB_CC $ENV{LSB_CC})
-SET(LSB_CXX $ENV{LSB_CXX})
-SET(LSB_TARGET_VERSION "4.0")
+SET(LSB_PATH $ENV{LSB_PATH} CACHE STRING "")
+SET(LSB_CC $ENV{LSB_CC} CACHE STRING "")
+SET(LSB_CXX $ENV{LSB_CXX} CACHE STRING "")
+SET(LSB_TARGET_VERSION "4.0" CACHE STRING "")
 
 IF ("${LSB_PATH}" STREQUAL "")
   SET(LSB_PATH "/opt/lsb")
--- a/Resources/Orthanc/Sdk-1.3.1/orthanc/OrthancCPlugin.h	Fri Jan 31 17:51:30 2020 +0100
+++ b/Resources/Orthanc/Sdk-1.3.1/orthanc/OrthancCPlugin.h	Tue Jun 30 07:38:31 2020 +0200
@@ -74,7 +74,7 @@
  * Orthanc - A Lightweight, RESTful DICOM Store
  * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
  * Department, University Hospital of Liege, Belgium
- * Copyright (C) 2017-2020 Osimis S.A., Belgium
+ * Copyright (C) 2017 Osimis, Belgium
  *
  * This program is free software: you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
--- a/Resources/SyncOrthancFolder.py	Fri Jan 31 17:51:30 2020 +0100
+++ b/Resources/SyncOrthancFolder.py	Tue Jun 30 07:38:31 2020 +0200
@@ -12,10 +12,10 @@
 
 TARGET = os.path.join(os.path.dirname(__file__), 'Orthanc')
 PLUGIN_SDK_VERSION = '1.3.1'
-REPOSITORY = 'https://bitbucket.org/sjodogne/orthanc/raw'
+REPOSITORY = 'https://hg.orthanc-server.com/orthanc/raw-file'
 
 FILES = [
-    'DownloadOrthancFramework.cmake',
+    'CMake/DownloadOrthancFramework.cmake',
     'LinuxStandardBaseToolchain.cmake',
     'MinGW-W64-Toolchain32.cmake',
     'MinGW-W64-Toolchain64.cmake',
@@ -49,7 +49,7 @@
 for f in FILES:
     commands.append([ 'default',
                       os.path.join('Resources', f),
-                      f ])
+                      os.path.basename(f) ])
 
 for f in SDK:
     commands.append([