Mercurial > hg > orthanc-dicomweb
changeset 455:32a7a591ebae
sync
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 01 Jul 2020 16:18:33 +0200 |
parents | 59ecea46e2ff |
children | c061d4c345c8 |
files | CMakeLists.txt Resources/Orthanc/CMake/Compiler.cmake Resources/Orthanc/CMake/DownloadOrthancFramework.cmake Resources/Orthanc/Plugins/VersionScript.map Resources/Orthanc/Plugins/VersionScriptPlugins.map Resources/SyncOrthancFolder.py |
diffstat | 6 files changed, 108 insertions(+), 74 deletions(-) [+] |
line wrap: on
line diff
--- a/CMakeLists.txt Tue Jun 30 09:33:50 2020 +0200 +++ b/CMakeLists.txt Wed Jul 01 16:18:33 2020 +0200 @@ -58,7 +58,7 @@ ${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD" OR ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" OR ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD") - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--version-script=${CMAKE_SOURCE_DIR}/Resources/Orthanc/Plugins/VersionScript.map") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--version-script=${CMAKE_SOURCE_DIR}/Resources/Orthanc/Plugins/VersionScriptPlugins.map") endif() @@ -73,7 +73,7 @@ link_libraries(OrthancFramework) else() include(${CMAKE_SOURCE_DIR}/Resources/Orthanc/CMake/DownloadOrthancFramework.cmake) - include(${ORTHANC_ROOT}/Resources/CMake/OrthancFrameworkParameters.cmake) + include(${ORTHANC_FRAMEWORK_ROOT}/Resources/CMake/OrthancFrameworkParameters.cmake) set(ENABLE_LOCALE ON) # Enable support for locales (notably in Boost) set(ENABLE_GOOGLE_TEST ON) @@ -82,8 +82,8 @@ set(HAS_EMBEDDED_RESOURCES ON) set(USE_BOOST_ICONV ON) - include(${ORTHANC_ROOT}/Resources/CMake/OrthancFrameworkConfiguration.cmake) - include_directories(${ORTHANC_ROOT}/Core) + include(${ORTHANC_FRAMEWORK_ROOT}/Resources/CMake/OrthancFrameworkConfiguration.cmake) + include_directories(${ORTHANC_FRAMEWORK_ROOT}/Sources) endif() @@ -98,7 +98,7 @@ if (ORTHANC_SDK_VERSION STREQUAL "1.7.0") include_directories(${CMAKE_SOURCE_DIR}/Resources/Orthanc/Sdk-1.7.0) elseif (ORTHANC_SDK_VERSION STREQUAL "framework") - include_directories(${ORTHANC_ROOT}/Plugins/Include) + include_directories(${ORTHANC_FRAMEWORK_ROOT}/Plugins/Include) else() message(FATAL_ERROR "Unsupported version of the Orthanc plugin SDK: ${ORTHANC_SDK_VERSION}") endif() @@ -119,7 +119,7 @@ execute_process( COMMAND - ${PYTHON_EXECUTABLE} ${ORTHANC_ROOT}/Resources/WindowsResources.py + ${PYTHON_EXECUTABLE} ${ORTHANC_FRAMEWORK_ROOT}/Resources/WindowsResources.py ${ORTHANC_DICOM_WEB_VERSION} "DICOMweb plugin" OrthancDicomWeb.dll "Plugin to extend Orthanc with the DICOMweb API" ERROR_VARIABLE Failure
--- a/Resources/Orthanc/CMake/Compiler.cmake Tue Jun 30 09:33:50 2020 +0200 +++ b/Resources/Orthanc/CMake/Compiler.cmake Wed Jul 01 16:18:33 2020 +0200 @@ -1,5 +1,11 @@ # This file sets all the compiler-related flags + +# Save the current compiler flags to the cache every time cmake configures the project +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "compiler flags" FORCE) +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" CACHE STRING "compiler flags" FORCE) + + include(CheckLibraryExists) if ((CMAKE_CROSSCOMPILING AND NOT @@ -75,7 +81,7 @@ # compatibility header. # http://stackoverflow.com/a/70630/881731 # https://en.wikibooks.org/wiki/C_Programming/C_Reference/stdint.h#External_links - include_directories(${ORTHANC_ROOT}/Resources/ThirdParty/VisualStudio) + include_directories(${CMAKE_CURRENT_LIST_DIR}/../../Resources/ThirdParty/VisualStudio) endif() link_libraries(netapi32) @@ -109,7 +115,7 @@ if (NOT DEFINED ENABLE_PLUGINS_VERSION_SCRIPT OR ENABLE_PLUGINS_VERSION_SCRIPT) - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--version-script=${ORTHANC_ROOT}/Plugins/Samples/Common/VersionScript.map") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--version-script=${CMAKE_CURRENT_LIST_DIR}/../VersionScriptPlugins.map") endif() # Remove the "-rdynamic" option @@ -197,7 +203,7 @@ endif() elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") - SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -exported_symbols_list ${ORTHANC_ROOT}/Plugins/Samples/Common/ExportedSymbols.list") + SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -exported_symbols_list ${CMAKE_CURRENT_LIST_DIR}/../ExportedSymbolsPlugins.list") add_definitions( -D_XOPEN_SOURCE=1 @@ -206,19 +212,7 @@ elseif (CMAKE_SYSTEM_NAME STREQUAL "Emscripten") message("Building using Emscripten (for WebAssembly or asm.js targets)") - - # The BINARYEN_TRAP_MODE specifies what to do when divisions per - # zero (and similar conditions like integer overflows) are - # encountered: The "clamp" mode avoids throwing errors, as they - # cannot be properly catched by "try {} catch (...)" constructions. - # Setting this option to "ON" fixes error: "shared:ERROR: - # BINARYEN_TRAP_MODE is not supported by the LLVM wasm backend" if - # using the "upstream" backend of Emscripten. - if (NOT EMSCRIPTEN_SET_LLVM_WASM_BACKEND) - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s BINARYEN_TRAP_MODE='\"clamp\"'") - endif() - - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s EXTRA_EXPORTED_RUNTIME_METHODS='[\"ccall\", \"cwrap\"]'") + include(${CMAKE_CURRENT_LIST_DIR}/EmscriptenParameters.cmake) elseif (CMAKE_SYSTEM_NAME STREQUAL "Android") @@ -254,10 +248,3 @@ # preceding batches. https://cmake.org/Bug/view.php?id=14874 set(CMAKE_CXX_ARCHIVE_APPEND "<CMAKE_AR> <LINK_FLAGS> q <TARGET> <OBJECTS>") endif() - - -if (STATIC_BUILD) - add_definitions(-DORTHANC_STATIC=1) -else() - add_definitions(-DORTHANC_STATIC=0) -endif()
--- a/Resources/Orthanc/CMake/DownloadOrthancFramework.cmake Tue Jun 30 09:33:50 2020 +0200 +++ b/Resources/Orthanc/CMake/DownloadOrthancFramework.cmake Wed Jul 01 16:18:33 2020 +0200 @@ -195,10 +195,8 @@ endif() if (NOT EXISTS ${ORTHANC_FRAMEWORK_ROOT}/Resources/CMake/OrthancFrameworkParameters.cmake) - message(FATAL_ERROR "Directory not containing the source code of Orthanc: ${ORTHANC_FRAMEWORK_ROOT}") + message(FATAL_ERROR "Directory not containing the source code of the Orthanc framework: ${ORTHANC_FRAMEWORK_ROOT}") endif() - - set(ORTHANC_ROOT ${ORTHANC_FRAMEWORK_ROOT}) endif() @@ -245,6 +243,16 @@ 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() @@ -372,6 +380,16 @@ message(FATAL_ERROR "The Orthanc framework was not uncompressed at the proper location. Check the CMake instructions.") endif() 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() @@ -399,8 +417,10 @@ 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) + if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows" OR + ORTHANC_FRAMEWORK_STATIC) + include_directories(${ORTHANC_FRAMEWORK_ROOT}/..) + else() # Look for mandatory dependency JsonCpp (cf. JsonCppConfiguration.cmake) find_path(JSONCPP_INCLUDE_DIR json/reader.h /usr/include/jsoncpp @@ -447,6 +467,22 @@ endif() link_libraries(sqlite3) endif() + + # Optional component - Pugixml + if (ENABLE_PUGIXML) + CHECK_INCLUDE_FILE_CXX(pugixml.hpp HAVE_PUGIXML_H) + if (NOT HAVE_PUGIXML_H) + message(FATAL_ERROR "Please install the libpugixml-dev package") + endif() + link_libraries(pugixml) + endif() + + # Optional component - DCMTK + if (ENABLE_DCMTK) + include(FindDCMTK) + include_directories(${DCMTK_INCLUDE_DIRS}) + link_libraries(${DCMTK_LIBRARIES}) + endif() endif() # Optional component - Google Test @@ -462,7 +498,6 @@ 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 @@ -470,28 +505,36 @@ ${ORTHANC_FRAMEWORK_ROOT} ) endif() + + if (${ORTHANC_FRAMEWORK_INCLUDE_DIR} STREQUAL "ORTHANC_FRAMEWORK_INCLUDE_DIR-NOTFOUND") + message(FATAL_ERROR "Cannot locate the OrthancFramework.h header") + 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 ("${ORTHANC_FRAMEWORK_LIBDIR}" STREQUAL "") + set(ORTHANC_FRAMEWORK_LIBRARIES OrthancFramework) + else() + if (MSVC) + set(Suffix ".lib") + set(Prefix "") + else() + list(GET CMAKE_FIND_LIBRARY_PREFIXES 0 Prefix) + list(GET CMAKE_FIND_LIBRARY_SUFFIXES 0 Suffix) + endif() + set(ORTHANC_FRAMEWORK_LIBRARIES ${ORTHANC_FRAMEWORK_LIBDIR}/${Prefix}OrthancFramework${Suffix}) + endif() - if (NOT "${ORTHANC_FRAMEWORK_LIBDIR}" STREQUAL "") - set(CMAKE_REQUIRED_LIBRARIES "-L${ORTHANC_FRAMEWORK_LIBDIR} -lOrthancFramework") - else() - set(CMAKE_REQUIRED_LIBRARIES "OrthancFramework") - endif() + set(CMAKE_REQUIRED_INCLUDES "${ORTHANC_FRAMEWORK_INCLUDE_DIR}") + set(CMAKE_REQUIRED_LIBRARIES "${ORTHANC_FRAMEWORK_LIBRARIES}") check_cxx_symbol_exists("Orthanc::InitializeFramework" "OrthancFramework.h" HAVE_ORTHANC_FRAMEWORK) - if(NOT 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/Plugins/VersionScript.map Tue Jun 30 09:33:50 2020 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ -# This is a version-script for Orthanc plugins - -{ -global: - OrthancPluginInitialize; - OrthancPluginFinalize; - OrthancPluginGetName; - OrthancPluginGetVersion; - -local: - *; -};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Resources/Orthanc/Plugins/VersionScriptPlugins.map Wed Jul 01 16:18:33 2020 +0200 @@ -0,0 +1,12 @@ +# This is a version-script for Orthanc plugins + +{ +global: + OrthancPluginInitialize; + OrthancPluginFinalize; + OrthancPluginGetName; + OrthancPluginGetVersion; + +local: + *; +};
--- a/Resources/SyncOrthancFolder.py Tue Jun 30 09:33:50 2020 +0200 +++ b/Resources/SyncOrthancFolder.py Wed Jul 01 16:18:33 2020 +0200 @@ -15,23 +15,23 @@ REPOSITORY = 'https://hg.orthanc-server.com/orthanc/raw-file' FILES = [ - ('Plugins/Samples/Common/OrthancPluginCppWrapper.cpp', 'Plugins'), - ('Plugins/Samples/Common/OrthancPluginCppWrapper.h', 'Plugins'), - ('Plugins/Samples/Common/OrthancPluginException.h', 'Plugins'), - ('Plugins/Samples/Common/VersionScript.map', 'Plugins'), - ('Resources/CMake/AutoGeneratedCode.cmake', 'CMake'), - ('Resources/CMake/Compiler.cmake', 'CMake'), - ('Resources/CMake/DownloadOrthancFramework.cmake', 'CMake'), - ('Resources/CMake/DownloadPackage.cmake', 'CMake'), - ('Resources/CMake/GoogleTestConfiguration.cmake', 'CMake'), - ('Resources/EmbedResources.py', 'CMake'), - ('Resources/LinuxStandardBaseToolchain.cmake', 'Toolchains'), - ('Resources/MinGW-W64-Toolchain32.cmake', 'Toolchains'), - ('Resources/MinGW-W64-Toolchain64.cmake', 'Toolchains'), - ('Resources/MinGWToolchain.cmake', 'Toolchains'), + ('OrthancFramework/Resources/CMake/AutoGeneratedCode.cmake', 'CMake'), + ('OrthancFramework/Resources/CMake/Compiler.cmake', 'CMake'), + ('OrthancFramework/Resources/CMake/DownloadOrthancFramework.cmake', 'CMake'), + ('OrthancFramework/Resources/CMake/DownloadPackage.cmake', 'CMake'), + ('OrthancFramework/Resources/CMake/GoogleTestConfiguration.cmake', 'CMake'), + ('OrthancFramework/Resources/EmbedResources.py', 'CMake'), + ('OrthancFramework/Resources/Toolchains/LinuxStandardBaseToolchain.cmake', 'Toolchains'), + ('OrthancFramework/Resources/Toolchains/MinGW-W64-Toolchain32.cmake', 'Toolchains'), + ('OrthancFramework/Resources/Toolchains/MinGW-W64-Toolchain64.cmake', 'Toolchains'), + ('OrthancFramework/Resources/Toolchains/MinGWToolchain.cmake', 'Toolchains'), + ('OrthancFramework/Resources/VersionScriptPlugins.map', 'Plugins'), + ('OrthancServer/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp', 'Plugins'), + ('OrthancServer/Plugins/Samples/Common/OrthancPluginCppWrapper.h', 'Plugins'), + ('OrthancServer/Plugins/Samples/Common/OrthancPluginException.h', 'Plugins'), # Specific to DICOMweb plugin - ('Resources/OrthancLogo.png', '.'), + ('OrthancServer/Resources/OrthancLogo.png', '.'), ] SDK = [ @@ -53,7 +53,11 @@ url = '%s/%s/%s' % (REPOSITORY, branch, source) with open(target, 'w') as f: - f.write(urllib2.urlopen(url).read()) + try: + f.write(urllib2.urlopen(url).read()) + except: + print('ERROR %s' % url) + raise commands = []