Mercurial > hg > orthanc-stone
changeset 1530:3eca4f9c2827
sync
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 04 Aug 2020 14:37:41 +0200 |
parents | c1d991462c7b |
children | d3cafeef07bb |
files | OrthancStone/Resources/CMake/OrthancStoneConfiguration.cmake OrthancStone/Resources/CMake/OrthancStoneParameters.cmake OrthancStone/Resources/Orthanc/CMake/DownloadOrthancFramework.cmake OrthancStone/Samples/RtViewerPlugin/CMakeLists.txt OrthancStone/Samples/RtViewerPlugin/Plugin.cpp OrthancStone/Samples/RtViewerPlugin/docker-internal.sh OrthancStone/Samples/WebAssembly/docker-internal.sh StoneWebViewer/Plugin/CMakeLists.txt StoneWebViewer/Plugin/Plugin.cpp StoneWebViewer/Plugin/docker-internal.sh StoneWebViewer/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h StoneWebViewer/WebAssembly/docker-internal.sh |
diffstat | 12 files changed, 86 insertions(+), 76 deletions(-) [+] |
line wrap: on
line diff
--- a/OrthancStone/Resources/CMake/OrthancStoneConfiguration.cmake Sun Aug 02 15:46:25 2020 +0200 +++ b/OrthancStone/Resources/CMake/OrthancStoneConfiguration.cmake Tue Aug 04 14:37:41 2020 +0200 @@ -26,32 +26,6 @@ include(${CMAKE_CURRENT_LIST_DIR}/../Orthanc/CMake/DownloadOrthancFramework.cmake) link_libraries(${ORTHANC_FRAMEWORK_LIBRARIES}) - # Switch to the C++11 standard if the version of JsonCpp is 1.y.z - if (EXISTS ${JSONCPP_INCLUDE_DIR}/json/version.h) - file(STRINGS - "${JSONCPP_INCLUDE_DIR}/json/version.h" - JSONCPP_VERSION_MAJOR1 REGEX - ".*define JSONCPP_VERSION_MAJOR.*") - - if (NOT JSONCPP_VERSION_MAJOR1) - message(FATAL_ERROR "Unable to extract the major version of JsonCpp") - endif() - - string(REGEX REPLACE - ".*JSONCPP_VERSION_MAJOR.*([0-9]+)$" "\\1" - JSONCPP_VERSION_MAJOR ${JSONCPP_VERSION_MAJOR1}) - message("JsonCpp major version: ${JSONCPP_VERSION_MAJOR}") - - if (JSONCPP_VERSION_MAJOR GREATER 0) - message("Switching to C++11 standard") - if (CMAKE_COMPILER_IS_GNUCXX) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11") - elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") - endif() - endif() - endif() - else() if (ENABLE_DCMTK) set(ENABLE_LOCALE ON) @@ -61,10 +35,8 @@ endif() endif() - include(${ORTHANC_FRAMEWORK_ROOT}/Resources/CMake/OrthancFrameworkConfiguration.cmake) - include_directories( - ${ORTHANC_FRAMEWORK_ROOT}/Sources/ - ) + include(${ORTHANC_FRAMEWORK_ROOT}/../Resources/CMake/OrthancFrameworkConfiguration.cmake) + include_directories(${ORTHANC_FRAMEWORK_ROOT}) endif()
--- a/OrthancStone/Resources/CMake/OrthancStoneParameters.cmake Sun Aug 02 15:46:25 2020 +0200 +++ b/OrthancStone/Resources/CMake/OrthancStoneParameters.cmake Tue Aug 04 14:37:41 2020 +0200 @@ -54,7 +54,7 @@ if (NOT ORTHANC_FRAMEWORK_SOURCE STREQUAL "system") include(${CMAKE_CURRENT_LIST_DIR}/../Orthanc/CMake/DownloadOrthancFramework.cmake) - include(${ORTHANC_FRAMEWORK_ROOT}/Resources/CMake/OrthancFrameworkParameters.cmake) + include(${ORTHANC_FRAMEWORK_ROOT}/../Resources/CMake/OrthancFrameworkParameters.cmake) unset(STANDALONE_BUILD CACHE) set(STANDALONE_BUILD ON) # Embed DCMTK's dictionaries in static builds
--- a/OrthancStone/Resources/Orthanc/CMake/DownloadOrthancFramework.cmake Sun Aug 02 15:46:25 2020 +0200 +++ b/OrthancStone/Resources/Orthanc/CMake/DownloadOrthancFramework.cmake Tue Aug 04 14:37:41 2020 +0200 @@ -110,6 +110,8 @@ set(ORTHANC_FRAMEWORK_MD5 "ce5f689e852b01d3672bd3d2f952a5ef") elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.7.1") set(ORTHANC_FRAMEWORK_MD5 "3c171217f930abe80246997bdbcaf7cc") + elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.7.2") + set(ORTHANC_FRAMEWORK_MD5 "328f94dcbd78c169655a13f7ad58a2c2") # Below this point are development snapshots that were used to # release some plugin, before an official release of the Orthanc @@ -125,7 +127,7 @@ endif() endif() -elseif (NOT ORTHANC_FRAMEWORK_SOURCE STREQUAL "system") +elseif (ORTHANC_FRAMEWORK_SOURCE STREQUAL "path") message("Using the Orthanc framework from a path of the filesystem. Assuming mainline version.") set(ORTHANC_FRAMEWORK_MAJOR 999) set(ORTHANC_FRAMEWORK_MINOR 999) @@ -175,17 +177,14 @@ ## if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "path") - if (NOT DEFINED ORTHANC_FRAMEWORK_ROOT) + if (NOT DEFINED ORTHANC_FRAMEWORK_ROOT OR + ORTHANC_FRAMEWORK_ROOT STREQUAL "") message(FATAL_ERROR "The variable ORTHANC_FRAMEWORK_ROOT must provide the path to the sources of Orthanc") endif() if (NOT EXISTS ${ORTHANC_FRAMEWORK_ROOT}) message(FATAL_ERROR "Non-existing directory: ${ORTHANC_FRAMEWORK_ROOT}") endif() - - if (NOT EXISTS ${ORTHANC_FRAMEWORK_ROOT}/Resources/CMake/OrthancFrameworkParameters.cmake) - message(FATAL_ERROR "Directory not containing the source code of the Orthanc framework: ${ORTHANC_FRAMEWORK_ROOT}") - endif() endif() @@ -232,16 +231,6 @@ if (Failure) message(FATAL_ERROR "Error while running Mercurial") endif() - - unset(ORTHANC_FRAMEWORK_ROOT CACHE) - set(ORTHANC_FRAMEWORK_ROOT "${ORTHANC_ROOT}/OrthancFramework" CACHE - STRING "Path to the Orthanc framework source directory") - - if (NOT EXISTS ${ORTHANC_FRAMEWORK_ROOT}/Resources/CMake/OrthancFrameworkParameters.cmake) - message(FATAL_ERROR "Directory not containing the source code of the Orthanc framework: ${ORTHANC_ROOT}") - endif() - - unset(ORTHANC_ROOT) endif() @@ -252,7 +241,8 @@ ## if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "archive") - if (NOT DEFINED ORTHANC_FRAMEWORK_ARCHIVE) + if (NOT DEFINED ORTHANC_FRAMEWORK_ARCHIVE OR + ORTHANC_FRAMEWORK_ARCHIVE STREQUAL "") message(FATAL_ERROR "The variable ORTHANC_FRAMEWORK_ARCHIVE must provide the path to the sources of Orthanc") endif() endif() @@ -369,18 +359,45 @@ message(FATAL_ERROR "The Orthanc framework was not uncompressed at the proper location. Check the CMake instructions.") endif() endif() +endif() + + + +## +## Determine the path to the sources of the Orthanc framework +## + +if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "archive" OR + ORTHANC_FRAMEWORK_SOURCE STREQUAL "hg" OR + ORTHANC_FRAMEWORK_SOURCE STREQUAL "web") + if (NOT DEFINED ORTHANC_ROOT OR + NOT DEFINED ORTHANC_FRAMEWORK_MAJOR OR + NOT DEFINED ORTHANC_FRAMEWORK_MINOR OR + NOT DEFINED ORTHANC_FRAMEWORK_REVISION) + message(FATAL_ERROR "Internal error in the DownloadOrthancFramework.cmake file") + endif() unset(ORTHANC_FRAMEWORK_ROOT CACHE) - set(ORTHANC_FRAMEWORK_ROOT "${ORTHANC_ROOT}/OrthancFramework" CACHE - STRING "Path to the Orthanc framework source directory") - if (NOT EXISTS ${ORTHANC_FRAMEWORK_ROOT}/Resources/CMake/OrthancFrameworkParameters.cmake) - message(FATAL_ERROR "Directory not containing the source code of the Orthanc framework: ${ORTHANC_ROOT}") + if ("${ORTHANC_FRAMEWORK_MAJOR}.${ORTHANC_FRAMEWORK_MINOR}.${ORTHANC_FRAMEWORK_REVISION}" VERSION_LESS "1.7.2") + set(ORTHANC_FRAMEWORK_ROOT "${ORTHANC_ROOT}/Core" CACHE + STRING "Path to the Orthanc framework source directory") + set(ENABLE_PLUGINS_VERSION_SCRIPT OFF) + else() + set(ORTHANC_FRAMEWORK_ROOT "${ORTHANC_ROOT}/OrthancFramework/Sources" CACHE + STRING "Path to the Orthanc framework source directory") endif() unset(ORTHANC_ROOT) endif() +if (NOT ORTHANC_FRAMEWORK_SOURCE STREQUAL "system") + if (NOT EXISTS ${ORTHANC_FRAMEWORK_ROOT}/OrthancException.h OR + NOT EXISTS ${ORTHANC_FRAMEWORK_ROOT}/../Resources/CMake/OrthancFrameworkParameters.cmake) + message(FATAL_ERROR "Directory not containing the source code of the Orthanc framework: ${ORTHANC_FRAMEWORK_ROOT}") + endif() +endif() + ## @@ -425,6 +442,35 @@ message(FATAL_ERROR "Please install the libjsoncpp-dev package") endif() + # Switch to the C++11 standard if the version of JsonCpp is 1.y.z + # (same as variable JSONCPP_CXX11 in the source code of Orthanc) + if (EXISTS ${JSONCPP_INCLUDE_DIR}/json/version.h) + file(STRINGS + "${JSONCPP_INCLUDE_DIR}/json/version.h" + JSONCPP_VERSION_MAJOR1 REGEX + ".*define JSONCPP_VERSION_MAJOR.*") + + if (NOT JSONCPP_VERSION_MAJOR1) + message(FATAL_ERROR "Unable to extract the major version of JsonCpp") + endif() + + string(REGEX REPLACE + ".*JSONCPP_VERSION_MAJOR.*([0-9]+)$" "\\1" + JSONCPP_VERSION_MAJOR ${JSONCPP_VERSION_MAJOR1}) + message("JsonCpp major version: ${JSONCPP_VERSION_MAJOR}") + + if (JSONCPP_VERSION_MAJOR GREATER 0) + message("Switching to C++11 standard, as version of JsonCpp is >= 1.0.0") + if (CMAKE_COMPILER_IS_GNUCXX) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11") + elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + endif() + endif() + else() + message("Unable to detect the major version of JsonCpp, assuming < 1.0.0") + endif() + # Look for mandatory dependency Boost (cf. BoostConfiguration.cmake) include(FindBoost) find_package(Boost COMPONENTS filesystem thread system date_time regex ${ORTHANC_BOOST_COMPONENTS}) @@ -517,8 +563,4 @@ unset(CMAKE_REQUIRED_INCLUDES) unset(CMAKE_REQUIRED_LIBRARIES) - - if (NOT "${ORTHANC_FRAMEWORK_ROOT}" STREQUAL "") - include_directories(${ORTHANC_FRAMEWORK_ROOT}) - endif() endif()
--- a/OrthancStone/Samples/RtViewerPlugin/CMakeLists.txt Sun Aug 02 15:46:25 2020 +0200 +++ b/OrthancStone/Samples/RtViewerPlugin/CMakeLists.txt Tue Aug 04 14:37:41 2020 +0200 @@ -32,19 +32,17 @@ # Download and setup the Orthanc framework include(${CMAKE_SOURCE_DIR}/../../../OrthancStone/Resources/Orthanc/CMake/DownloadOrthancFramework.cmake) +include_directories(${ORTHANC_FRAMEWORK_ROOT}) + if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "system") link_libraries(${ORTHANC_FRAMEWORK_LIBRARIES}) else() - include(${ORTHANC_FRAMEWORK_ROOT}/Resources/CMake/OrthancFrameworkParameters.cmake) + include(${ORTHANC_FRAMEWORK_ROOT}/../Resources/CMake/OrthancFrameworkParameters.cmake) set(ENABLE_MODULE_IMAGES OFF) set(ENABLE_MODULE_JOBS OFF) set(ENABLE_MODULE_DICOM OFF) - include(${ORTHANC_FRAMEWORK_ROOT}/Resources/CMake/OrthancFrameworkConfiguration.cmake) - - include_directories( - ${ORTHANC_FRAMEWORK_ROOT}/Sources - ) + include(${ORTHANC_FRAMEWORK_ROOT}/../Resources/CMake/OrthancFrameworkConfiguration.cmake) endif() include(${CMAKE_SOURCE_DIR}/Resources/Orthanc/Plugins/OrthancPluginsExports.cmake)
--- a/OrthancStone/Samples/RtViewerPlugin/Plugin.cpp Sun Aug 02 15:46:25 2020 +0200 +++ b/OrthancStone/Samples/RtViewerPlugin/Plugin.cpp Tue Aug 04 14:37:41 2020 +0200 @@ -107,7 +107,7 @@ { OrthancPlugins::SetGlobalContext(context); -#if defined(ORTHANC_FRAMEWORK_VERSION_IS_ABOVE) // This indicates Orthanc framework >= 1.7.2 +#if ORTHANC_FRAMEWORK_VERSION_IS_ABOVE(1, 7, 2) Orthanc::Logging::InitializePluginContext(context); #else Orthanc::Logging::Initialize(context);
--- a/OrthancStone/Samples/RtViewerPlugin/docker-internal.sh Sun Aug 02 15:46:25 2020 +0200 +++ b/OrthancStone/Samples/RtViewerPlugin/docker-internal.sh Tue Aug 04 14:37:41 2020 +0200 @@ -19,7 +19,7 @@ -DCMAKE_BUILD_TYPE=$1 \ -DCMAKE_INSTALL_PREFIX=/target/ \ -DCMAKE_TOOLCHAIN_FILE=/tmp/orthanc/OrthancFramework/Resources/Toolchains/LinuxStandardBaseToolchain.cmake \ - -DORTHANC_FRAMEWORK_ROOT=/tmp/orthanc/OrthancFramework \ + -DORTHANC_FRAMEWORK_ROOT=/tmp/orthanc/OrthancFramework/Sources \ -DSTATIC_BUILD=ON \ -DSTONE_BINARIES_RT_VIEWER=/target/RtViewer/ \ -DUSE_LEGACY_JSONCPP=ON \
--- a/OrthancStone/Samples/WebAssembly/docker-internal.sh Sun Aug 02 15:46:25 2020 +0200 +++ b/OrthancStone/Samples/WebAssembly/docker-internal.sh Tue Aug 04 14:37:41 2020 +0200 @@ -23,7 +23,7 @@ -DCMAKE_BUILD_TYPE=$1 \ -DCMAKE_INSTALL_PREFIX=/target \ -DCMAKE_TOOLCHAIN_FILE=${EMSDK}/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake \ - -DORTHANC_FRAMEWORK_ROOT=/tmp/orthanc/OrthancFramework \ + -DORTHANC_FRAMEWORK_ROOT=/tmp/orthanc/OrthancFramework/Sources \ -DSTATIC_BUILD=ON \ -G Ninja
--- a/StoneWebViewer/Plugin/CMakeLists.txt Sun Aug 02 15:46:25 2020 +0200 +++ b/StoneWebViewer/Plugin/CMakeLists.txt Tue Aug 04 14:37:41 2020 +0200 @@ -34,19 +34,17 @@ # Download and setup the Orthanc framework include(${CMAKE_SOURCE_DIR}/../../OrthancStone/Resources/Orthanc/CMake/DownloadOrthancFramework.cmake) +include_directories(${ORTHANC_FRAMEWORK_ROOT}) + if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "system") link_libraries(${ORTHANC_FRAMEWORK_LIBRARIES}) else() - include(${ORTHANC_FRAMEWORK_ROOT}/Resources/CMake/OrthancFrameworkParameters.cmake) + include(${ORTHANC_FRAMEWORK_ROOT}/../Resources/CMake/OrthancFrameworkParameters.cmake) set(ENABLE_MODULE_IMAGES OFF) set(ENABLE_MODULE_JOBS OFF) set(ENABLE_MODULE_DICOM OFF) - include(${ORTHANC_FRAMEWORK_ROOT}/Resources/CMake/OrthancFrameworkConfiguration.cmake) - - include_directories( - ${ORTHANC_FRAMEWORK_ROOT}/Sources - ) + include(${ORTHANC_FRAMEWORK_ROOT}/../Resources/CMake/OrthancFrameworkConfiguration.cmake) endif() include(${CMAKE_SOURCE_DIR}/../Resources/Orthanc/Plugins/OrthancPluginsExports.cmake)
--- a/StoneWebViewer/Plugin/Plugin.cpp Sun Aug 02 15:46:25 2020 +0200 +++ b/StoneWebViewer/Plugin/Plugin.cpp Tue Aug 04 14:37:41 2020 +0200 @@ -165,7 +165,7 @@ { OrthancPlugins::SetGlobalContext(context); -#if defined(ORTHANC_FRAMEWORK_VERSION_IS_ABOVE) // This indicates Orthanc framework >= 1.7.2 +#if ORTHANC_FRAMEWORK_VERSION_IS_ABOVE(1, 7, 2) Orthanc::Logging::InitializePluginContext(context); #else Orthanc::Logging::Initialize(context);
--- a/StoneWebViewer/Plugin/docker-internal.sh Sun Aug 02 15:46:25 2020 +0200 +++ b/StoneWebViewer/Plugin/docker-internal.sh Tue Aug 04 14:37:41 2020 +0200 @@ -18,7 +18,7 @@ -DCMAKE_BUILD_TYPE=$1 \ -DCMAKE_INSTALL_PREFIX=/target/ \ -DCMAKE_TOOLCHAIN_FILE=/tmp/orthanc/OrthancFramework/Resources/Toolchains/LinuxStandardBaseToolchain.cmake \ - -DORTHANC_FRAMEWORK_ROOT=/tmp/orthanc/OrthancFramework \ + -DORTHANC_FRAMEWORK_ROOT=/tmp/orthanc/OrthancFramework/Sources \ -DSTATIC_BUILD=ON \ -DSTONE_BINARIES=/target/StoneWebViewer/ \ -DUSE_LEGACY_JSONCPP=ON \
--- a/StoneWebViewer/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h Sun Aug 02 15:46:25 2020 +0200 +++ b/StoneWebViewer/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h Tue Aug 04 14:37:41 2020 +0200 @@ -1158,9 +1158,9 @@ public: #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 6, 1) - DicomInstance(const OrthancPluginDicomInstance* instance); + explicit DicomInstance(const OrthancPluginDicomInstance* instance); #else - DicomInstance(OrthancPluginDicomInstance* instance); + explicit DicomInstance(OrthancPluginDicomInstance* instance); #endif #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 7, 0)
--- a/StoneWebViewer/WebAssembly/docker-internal.sh Sun Aug 02 15:46:25 2020 +0200 +++ b/StoneWebViewer/WebAssembly/docker-internal.sh Tue Aug 04 14:37:41 2020 +0200 @@ -23,7 +23,7 @@ -DCMAKE_BUILD_TYPE=$1 \ -DCMAKE_INSTALL_PREFIX=/target/StoneWebViewer \ -DCMAKE_TOOLCHAIN_FILE=${EMSDK}/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake \ - -DORTHANC_FRAMEWORK_ROOT=/tmp/orthanc/OrthancFramework \ + -DORTHANC_FRAMEWORK_ROOT=/tmp/orthanc/OrthancFramework/Sources \ -DSTATIC_BUILD=ON \ -G Ninja