changeset 149:d0b02fd48a92

sync
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 29 Jun 2020 19:20:45 +0200
parents 4d3c3e58986d
children d9101318442d
files Framework/Plugins/PluginInitialization.cpp Resources/CMake/DatabasesPluginConfiguration.cmake Resources/Orthanc/DownloadOrthancFramework.cmake Resources/Orthanc/LinuxStandardBaseToolchain.cmake Resources/Orthanc/Sdk-1.5.2/orthanc/OrthancCDatabasePlugin.h Resources/Orthanc/Sdk-1.5.2/orthanc/OrthancCPlugin.h Resources/Orthanc/Sdk-1.5.4/orthanc/OrthancCDatabasePlugin.h Resources/Orthanc/Sdk-1.5.4/orthanc/OrthancCPlugin.h Resources/SyncOrthancFolder.py
diffstat 9 files changed, 170 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/Framework/Plugins/PluginInitialization.cpp	Fri Jun 05 19:19:35 2020 +0200
+++ b/Framework/Plugins/PluginInitialization.cpp	Mon Jun 29 19:20:45 2020 +0200
@@ -45,7 +45,7 @@
                         const std::string& dbms,
                         bool isIndex)
   {
-    Orthanc::Logging::Initialize(context);
+    Orthanc::Logging::InitializePluginContext(context);
     OrthancPlugins::SetGlobalContext(context);
     ImplicitTransaction::SetErrorOnDoubleExecution(false);
 
--- a/Resources/CMake/DatabasesPluginConfiguration.cmake	Fri Jun 05 19:19:35 2020 +0200
+++ b/Resources/CMake/DatabasesPluginConfiguration.cmake	Mon Jun 29 19:20:45 2020 +0200
@@ -22,6 +22,8 @@
 include(${ORTHANC_ROOT}/Resources/CMake/AutoGeneratedCode.cmake)
 
 
+include_directories(${ORTHANC_ROOT}/Core)
+
 if (STATIC_BUILD OR NOT USE_SYSTEM_ORTHANC_SDK)
   if (ORTHANC_SDK_VERSION STREQUAL "0.9.5")
     include_directories(${ORTHANC_DATABASES_ROOT}/Resources/Orthanc/Sdk-0.9.5)
--- a/Resources/Orthanc/DownloadOrthancFramework.cmake	Fri Jun 05 19:19:35 2020 +0200
+++ b/Resources/Orthanc/DownloadOrthancFramework.cmake	Mon Jun 29 19:20:45 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 Jun 05 19:19:35 2020 +0200
+++ b/Resources/Orthanc/LinuxStandardBaseToolchain.cmake	Mon Jun 29 19:20:45 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.5.2/orthanc/OrthancCDatabasePlugin.h	Fri Jun 05 19:19:35 2020 +0200
+++ b/Resources/Orthanc/Sdk-1.5.2/orthanc/OrthancCDatabasePlugin.h	Mon Jun 29 19:20:45 2020 +0200
@@ -6,7 +6,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-2019 Osimis S.A., 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/Orthanc/Sdk-1.5.2/orthanc/OrthancCPlugin.h	Fri Jun 05 19:19:35 2020 +0200
+++ b/Resources/Orthanc/Sdk-1.5.2/orthanc/OrthancCPlugin.h	Mon Jun 29 19:20:45 2020 +0200
@@ -75,7 +75,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-2019 Osimis S.A., 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/Orthanc/Sdk-1.5.4/orthanc/OrthancCDatabasePlugin.h	Fri Jun 05 19:19:35 2020 +0200
+++ b/Resources/Orthanc/Sdk-1.5.4/orthanc/OrthancCDatabasePlugin.h	Mon Jun 29 19:20:45 2020 +0200
@@ -6,7 +6,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-2019 Osimis S.A., 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/Orthanc/Sdk-1.5.4/orthanc/OrthancCPlugin.h	Fri Jun 05 19:19:35 2020 +0200
+++ b/Resources/Orthanc/Sdk-1.5.4/orthanc/OrthancCPlugin.h	Mon Jun 29 19:20:45 2020 +0200
@@ -76,7 +76,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-2019 Osimis S.A., 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 Jun 05 19:19:35 2020 +0200
+++ b/Resources/SyncOrthancFolder.py	Mon Jun 29 19:20:45 2020 +0200
@@ -12,10 +12,10 @@
 
 TARGET = os.path.join(os.path.dirname(__file__), 'Orthanc')
 PLUGIN_SDK_VERSION = [ '0.9.5', '1.4.0', '1.5.2', '1.5.4' ]
-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',
@@ -50,7 +50,7 @@
 for f in FILES:
     commands.append([ 'default',
                       os.path.join('Resources', f),
-                      f ])
+                      os.path.basename(f) ])
 
 for version in PLUGIN_SDK_VERSION:
     for f in SDK: