# HG changeset patch # User Sebastien Jodogne # Date 1593496344 -7200 # Node ID 17f775299b4a7ef61149f6816409e73efe09d724 # Parent b06103a50c95d03a1238b1c0b1ad94c6ef9e90a8 sync diff -r b06103a50c95 -r 17f775299b4a CMakeLists.txt --- a/CMakeLists.txt Fri Jan 31 17:47:55 2020 +0100 +++ b/CMakeLists.txt Tue Jun 30 07:52:24 2020 +0200 @@ -55,7 +55,10 @@ set(ENABLE_ZLIB ON) include(${ORTHANC_ROOT}/Resources/CMake/OrthancFrameworkConfiguration.cmake) -include_directories(${ORTHANC_ROOT}) +include_directories( + ${ORTHANC_ROOT}/Core + ${ORTHANC_ROOT}/Plugins/Samples/Common + ) # Possibly patch the Orthanc framework diff -r b06103a50c95 -r 17f775299b4a Framework/DicomInstanceInfo.cpp --- a/Framework/DicomInstanceInfo.cpp Fri Jan 31 17:47:55 2020 +0100 +++ b/Framework/DicomInstanceInfo.cpp Tue Jun 30 07:52:24 2020 +0200 @@ -19,9 +19,9 @@ #include "DicomInstanceInfo.h" -#include -#include -#include +#include +#include +#include static const char *KEY_ID = "ID"; static const char *KEY_MD5 = "MD5"; diff -r b06103a50c95 -r 17f775299b4a Framework/DownloadArea.cpp --- a/Framework/DownloadArea.cpp Fri Jan 31 17:47:55 2020 +0100 +++ b/Framework/DownloadArea.cpp Tue Jun 30 07:52:24 2020 +0200 @@ -19,10 +19,10 @@ #include "DownloadArea.h" -#include -#include -#include -#include +#include +#include +#include +#include #include #include diff -r b06103a50c95 -r 17f775299b4a Framework/DownloadArea.h --- a/Framework/DownloadArea.h Fri Jan 31 17:47:55 2020 +0100 +++ b/Framework/DownloadArea.h Tue Jun 30 07:52:24 2020 +0200 @@ -21,7 +21,7 @@ #include "TransferScheduler.h" -#include +#include namespace OrthancPlugins { diff -r b06103a50c95 -r 17f775299b4a Framework/HttpQueries/DetectTransferPlugin.cpp --- a/Framework/HttpQueries/DetectTransferPlugin.cpp Fri Jan 31 17:47:55 2020 +0100 +++ b/Framework/HttpQueries/DetectTransferPlugin.cpp Tue Jun 30 07:52:24 2020 +0200 @@ -22,7 +22,7 @@ #include "../TransferToolbox.h" #include "HttpQueriesRunner.h" -#include +#include #include diff -r b06103a50c95 -r 17f775299b4a Framework/HttpQueries/HttpQueriesQueue.cpp --- a/Framework/HttpQueries/HttpQueriesQueue.cpp Fri Jan 31 17:47:55 2020 +0100 +++ b/Framework/HttpQueries/HttpQueriesQueue.cpp Tue Jun 30 07:52:24 2020 +0200 @@ -19,8 +19,8 @@ #include "HttpQueriesQueue.h" -#include -#include +#include +#include namespace OrthancPlugins { diff -r b06103a50c95 -r 17f775299b4a Framework/HttpQueries/HttpQueriesQueue.h --- a/Framework/HttpQueries/HttpQueriesQueue.h Fri Jan 31 17:47:55 2020 +0100 +++ b/Framework/HttpQueries/HttpQueriesQueue.h Tue Jun 30 07:52:24 2020 +0200 @@ -21,7 +21,7 @@ #include "IHttpQuery.h" -#include +#include #include #include diff -r b06103a50c95 -r 17f775299b4a Framework/HttpQueries/HttpQueriesRunner.cpp --- a/Framework/HttpQueries/HttpQueriesRunner.cpp Fri Jan 31 17:47:55 2020 +0100 +++ b/Framework/HttpQueries/HttpQueriesRunner.cpp Tue Jun 30 07:52:24 2020 +0200 @@ -19,7 +19,7 @@ #include "HttpQueriesRunner.h" -#include +#include #include diff -r b06103a50c95 -r 17f775299b4a Framework/HttpQueries/IHttpQuery.h --- a/Framework/HttpQueries/IHttpQuery.h Fri Jan 31 17:47:55 2020 +0100 +++ b/Framework/HttpQueries/IHttpQuery.h Tue Jun 30 07:52:24 2020 +0200 @@ -19,7 +19,7 @@ #pragma once -#include +#include #include diff -r b06103a50c95 -r 17f775299b4a Framework/OrthancInstancesCache.h --- a/Framework/OrthancInstancesCache.h Fri Jan 31 17:47:55 2020 +0100 +++ b/Framework/OrthancInstancesCache.h Tue Jun 30 07:52:24 2020 +0200 @@ -22,7 +22,7 @@ #include "SourceDicomInstance.h" #include "TransferBucket.h" -#include +#include #include diff -r b06103a50c95 -r 17f775299b4a Framework/PullMode/PullJob.cpp --- a/Framework/PullMode/PullJob.cpp Fri Jan 31 17:47:55 2020 +0100 +++ b/Framework/PullMode/PullJob.cpp Tue Jun 30 07:52:24 2020 +0200 @@ -23,7 +23,7 @@ #include "../HttpQueries/HttpQueriesRunner.h" #include "../TransferScheduler.h" -#include +#include #include diff -r b06103a50c95 -r 17f775299b4a Framework/PushMode/ActivePushTransactions.cpp --- a/Framework/PushMode/ActivePushTransactions.cpp Fri Jan 31 17:47:55 2020 +0100 +++ b/Framework/PushMode/ActivePushTransactions.cpp Tue Jun 30 07:52:24 2020 +0200 @@ -21,7 +21,7 @@ #include "../DownloadArea.h" -#include +#include namespace OrthancPlugins diff -r b06103a50c95 -r 17f775299b4a Framework/PushMode/ActivePushTransactions.h --- a/Framework/PushMode/ActivePushTransactions.h Fri Jan 31 17:47:55 2020 +0100 +++ b/Framework/PushMode/ActivePushTransactions.h Tue Jun 30 07:52:24 2020 +0200 @@ -21,7 +21,7 @@ #include "../TransferBucket.h" -#include +#include #include diff -r b06103a50c95 -r 17f775299b4a Framework/PushMode/BucketPushQuery.cpp --- a/Framework/PushMode/BucketPushQuery.cpp Fri Jan 31 17:47:55 2020 +0100 +++ b/Framework/PushMode/BucketPushQuery.cpp Tue Jun 30 07:52:24 2020 +0200 @@ -19,8 +19,8 @@ #include "BucketPushQuery.h" -#include -#include +#include +#include #include diff -r b06103a50c95 -r 17f775299b4a Framework/PushMode/PushJob.cpp --- a/Framework/PushMode/PushJob.cpp Fri Jan 31 17:47:55 2020 +0100 +++ b/Framework/PushMode/PushJob.cpp Tue Jun 30 07:52:24 2020 +0200 @@ -23,7 +23,7 @@ #include "../HttpQueries/HttpQueriesRunner.h" #include "../TransferScheduler.h" -#include +#include #include diff -r b06103a50c95 -r 17f775299b4a Framework/SourceDicomInstance.cpp --- a/Framework/SourceDicomInstance.cpp Fri Jan 31 17:47:55 2020 +0100 +++ b/Framework/SourceDicomInstance.cpp Tue Jun 30 07:52:24 2020 +0200 @@ -19,9 +19,9 @@ #include "SourceDicomInstance.h" -#include -#include -#include +#include +#include +#include namespace OrthancPlugins diff -r b06103a50c95 -r 17f775299b4a Framework/StatefulOrthancJob.h --- a/Framework/StatefulOrthancJob.h Fri Jan 31 17:47:55 2020 +0100 +++ b/Framework/StatefulOrthancJob.h Tue Jun 30 07:52:24 2020 +0200 @@ -19,7 +19,7 @@ #pragma once -#include +#include #include diff -r b06103a50c95 -r 17f775299b4a Framework/TransferBucket.cpp --- a/Framework/TransferBucket.cpp Fri Jan 31 17:47:55 2020 +0100 +++ b/Framework/TransferBucket.cpp Tue Jun 30 07:52:24 2020 +0200 @@ -19,8 +19,8 @@ #include "TransferBucket.h" -#include -#include +#include +#include namespace OrthancPlugins diff -r b06103a50c95 -r 17f775299b4a Framework/TransferQuery.cpp --- a/Framework/TransferQuery.cpp Fri Jan 31 17:47:55 2020 +0100 +++ b/Framework/TransferQuery.cpp Tue Jun 30 07:52:24 2020 +0200 @@ -19,7 +19,7 @@ #include "TransferQuery.h" -#include +#include namespace OrthancPlugins diff -r b06103a50c95 -r 17f775299b4a Framework/TransferScheduler.cpp --- a/Framework/TransferScheduler.cpp Fri Jan 31 17:47:55 2020 +0100 +++ b/Framework/TransferScheduler.cpp Tue Jun 30 07:52:24 2020 +0200 @@ -19,9 +19,9 @@ #include "TransferScheduler.h" -#include -#include -#include +#include +#include +#include namespace OrthancPlugins diff -r b06103a50c95 -r 17f775299b4a Framework/TransferToolbox.cpp --- a/Framework/TransferToolbox.cpp Fri Jan 31 17:47:55 2020 +0100 +++ b/Framework/TransferToolbox.cpp Tue Jun 30 07:52:24 2020 +0200 @@ -19,9 +19,9 @@ #include "TransferToolbox.h" -#include -#include -#include +#include +#include +#include #include #include diff -r b06103a50c95 -r 17f775299b4a Plugin/Plugin.cpp --- a/Plugin/Plugin.cpp Fri Jan 31 17:47:55 2020 +0100 +++ b/Plugin/Plugin.cpp Tue Jun 30 07:52:24 2020 +0200 @@ -24,9 +24,9 @@ #include -#include -#include -#include +#include +#include +#include static bool DisplayPerformanceWarning() @@ -616,7 +616,7 @@ { ORTHANC_PLUGINS_API int32_t OrthancPluginInitialize(OrthancPluginContext* context) { - Orthanc::Logging::Initialize(context); + Orthanc::Logging::InitializePluginContext(context); assert(DisplayPerformanceWarning()); OrthancPlugins::SetGlobalContext(context); diff -r b06103a50c95 -r 17f775299b4a Plugin/PluginContext.cpp --- a/Plugin/PluginContext.cpp Fri Jan 31 17:47:55 2020 +0100 +++ b/Plugin/PluginContext.cpp Tue Jun 30 07:52:24 2020 +0200 @@ -19,7 +19,7 @@ #include "PluginContext.h" -#include +#include namespace OrthancPlugins diff -r b06103a50c95 -r 17f775299b4a Plugin/PluginContext.h --- a/Plugin/PluginContext.h Fri Jan 31 17:47:55 2020 +0100 +++ b/Plugin/PluginContext.h Tue Jun 30 07:52:24 2020 +0200 @@ -22,7 +22,7 @@ #include "../Framework/OrthancInstancesCache.h" #include "../Framework/PushMode/ActivePushTransactions.h" -#include +#include #include diff -r b06103a50c95 -r 17f775299b4a Resources/Orthanc/DownloadOrthancFramework.cmake --- a/Resources/Orthanc/DownloadOrthancFramework.cmake Fri Jan 31 17:47:55 2020 +0100 +++ b/Resources/Orthanc/DownloadOrthancFramework.cmake Tue Jun 30 07:52:24 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() diff -r b06103a50c95 -r 17f775299b4a Resources/Orthanc/LinuxStandardBaseToolchain.cmake --- a/Resources/Orthanc/LinuxStandardBaseToolchain.cmake Fri Jan 31 17:47:55 2020 +0100 +++ b/Resources/Orthanc/LinuxStandardBaseToolchain.cmake Tue Jun 30 07:52:24 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") diff -r b06103a50c95 -r 17f775299b4a Resources/SyncOrthancFolder.py --- a/Resources/SyncOrthancFolder.py Fri Jan 31 17:47:55 2020 +0100 +++ b/Resources/SyncOrthancFolder.py Tue Jun 30 07:52:24 2020 +0200 @@ -12,10 +12,10 @@ TARGET = os.path.join(os.path.dirname(__file__), 'Orthanc') PLUGIN_SDK_VERSION = [ '1.4.2' ] -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 version in PLUGIN_SDK_VERSION: for f in SDK: diff -r b06103a50c95 -r 17f775299b4a UnitTests/UnitTestsMain.cpp --- a/UnitTests/UnitTestsMain.cpp Fri Jan 31 17:47:55 2020 +0100 +++ b/UnitTests/UnitTestsMain.cpp Tue Jun 30 07:52:24 2020 +0200 @@ -19,9 +19,9 @@ #include "../Framework/DownloadArea.h" -#include -#include -#include +#include +#include +#include #include