Mercurial > hg > orthanc
changeset 4034:78ee0155ec67
trying to use orthanc frameworking with web-viewer plugin
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 10 Jun 2020 10:14:15 +0200 |
parents | 0763630a42ef |
children | c6e82885f570 5e26d004838c |
files | CMakeLists.txt Core/FileStorage/FilesystemStorage.h Plugins/Samples/Common/OrthancPluginException.h Resources/CMake/AutoGeneratedCode.cmake Resources/CMake/OrthancFrameworkConfiguration.cmake Resources/EmbedResources.py |
diffstat | 6 files changed, 16 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/CMakeLists.txt Tue Jun 09 21:45:54 2020 +0200 +++ b/CMakeLists.txt Wed Jun 10 10:14:15 2020 +0200 @@ -214,6 +214,7 @@ EmbedResources( --namespace=Orthanc.ServerResources --target=OrthancServerResources + --framework-path=${CMAKE_SOURCE_DIR}/Core ${ORTHANC_EMBEDDED_FILES} )
--- a/Core/FileStorage/FilesystemStorage.h Tue Jun 09 21:45:54 2020 +0200 +++ b/Core/FileStorage/FilesystemStorage.h Wed Jun 10 10:14:15 2020 +0200 @@ -33,6 +33,8 @@ #pragma once +#include "../OrthancFramework.h" + #if !defined(ORTHANC_SANDBOXED) # error The macro ORTHANC_SANDBOXED must be defined #endif
--- a/Plugins/Samples/Common/OrthancPluginException.h Tue Jun 09 21:45:54 2020 +0200 +++ b/Plugins/Samples/Common/OrthancPluginException.h Wed Jun 10 10:14:15 2020 +0200 @@ -39,7 +39,7 @@ #if HAS_ORTHANC_EXCEPTION == 1 -# include "../../../Core/OrthancException.h" +# include <OrthancException.h> # define ORTHANC_PLUGINS_ERROR_ENUMERATION ::Orthanc::ErrorCode # define ORTHANC_PLUGINS_EXCEPTION_CLASS ::Orthanc::OrthancException # define ORTHANC_PLUGINS_GET_ERROR_CODE(code) ::Orthanc::ErrorCode_ ## code
--- a/Resources/CMake/AutoGeneratedCode.cmake Tue Jun 09 21:45:54 2020 +0200 +++ b/Resources/CMake/AutoGeneratedCode.cmake Wed Jun 10 10:14:15 2020 +0200 @@ -1,3 +1,5 @@ +set(EMBED_RESOURCES_PYTHON "${CMAKE_CURRENT_LIST_DIR}/../EmbedResources.py" + CACHE INTERNAL "Path to the EmbedResources.py script from Orthanc") set(AUTOGENERATED_DIR "${CMAKE_CURRENT_BINARY_DIR}/AUTOGENERATED") set(AUTOGENERATED_SOURCES) @@ -43,14 +45,10 @@ OUTPUT "${TARGET_BASE}.h" "${TARGET_BASE}.cpp" - COMMAND - ${PYTHON_EXECUTABLE} - "${ORTHANC_ROOT}/Resources/EmbedResources.py" - ${SCRIPT_OPTIONS} - "${TARGET_BASE}" - ${SCRIPT_ARGUMENTS} + COMMAND ${PYTHON_EXECUTABLE} ${EMBED_RESOURCES_PYTHON} + ${SCRIPT_OPTIONS} "${TARGET_BASE}" ${SCRIPT_ARGUMENTS} DEPENDS - "${ORTHANC_ROOT}/Resources/EmbedResources.py" + ${EMBED_RESOURCES_PYTHON} ${DEPENDENCIES} )
--- a/Resources/CMake/OrthancFrameworkConfiguration.cmake Tue Jun 09 21:45:54 2020 +0200 +++ b/Resources/CMake/OrthancFrameworkConfiguration.cmake Wed Jun 10 10:14:15 2020 +0200 @@ -679,6 +679,7 @@ EmbedResources( --namespace=Orthanc.FrameworkResources --target=OrthancFrameworkResources + --framework-path=${ORTHANC_ROOT}/Core ${LIBICU_RESOURCES} ${DCMTK_DICTIONARIES} )
--- a/Resources/EmbedResources.py Tue Jun 09 21:45:54 2020 +0200 +++ b/Resources/EmbedResources.py Wed Jun 10 10:14:15 2020 +0200 @@ -43,6 +43,7 @@ OUT_OF_RANGE_EXCEPTION = '::Orthanc::OrthancException(::Orthanc::ErrorCode_ParameterOutOfRange)' INEXISTENT_PATH_EXCEPTION = '::Orthanc::OrthancException(::Orthanc::ErrorCode_InexistentItem)' NAMESPACE = 'Orthanc.EmbeddedResources' +FRAMEWORK_PATH = None ARGS = [] for i in range(len(sys.argv)): @@ -57,6 +58,8 @@ INEXISTENT_PATH_EXCEPTION = '%s("Unknown path in a directory resource")' % EXCEPTION_CLASS elif sys.argv[i].startswith('--namespace='): NAMESPACE = sys.argv[i][sys.argv[i].find('=') + 1 : ] + elif sys.argv[i].startswith('--framework-path='): + FRAMEWORK_PATH = sys.argv[i][sys.argv[i].find('=') + 1 : ] if len(ARGS) < 2 or len(ARGS) % 2 != 0: print ('Usage:') @@ -280,8 +283,10 @@ if USE_SYSTEM_EXCEPTION: cpp.write('#include <stdexcept>') +elif FRAMEWORK_PATH != None: + cpp.write('#include "%s/OrthancException.h"' % FRAMEWORK_PATH) else: - cpp.write('#include "%s/Core/OrthancException.h"' % os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) + cpp.write('#include <OrthancException.h>') cpp.write(""" #include <stdint.h>