Mercurial > hg > orthanc
changeset 3274:95b0536be2c3
preparing for dcmtk 3.6.4
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 20 Feb 2019 17:19:27 +0100 |
parents | 45786a7c3735 |
children | 5cd4c672d63c |
files | Resources/CMake/DcmtkConfiguration.cmake Resources/CMake/DcmtkConfigurationStatic-3.6.0.cmake Resources/CMake/DcmtkConfigurationStatic-3.6.2.cmake Resources/CMake/OrthancFrameworkConfiguration.cmake Resources/CMake/OrthancFrameworkParameters.cmake |
diffstat | 5 files changed, 497 insertions(+), 314 deletions(-) [+] |
line wrap: on
line diff
--- a/Resources/CMake/DcmtkConfiguration.cmake Wed Feb 20 16:41:05 2019 +0100 +++ b/Resources/CMake/DcmtkConfiguration.cmake Wed Feb 20 17:19:27 2019 +0100 @@ -1,322 +1,25 @@ if (NOT DEFINED ENABLE_DCMTK_NETWORKING) - set(ENABLE_DCMTK_NETWORKING ON) + set(ENABLE_DCMTK_NETWORKING ON) endif() if (STATIC_BUILD OR NOT USE_SYSTEM_DCMTK) - if (USE_DCMTK_360) - SET(DCMTK_VERSION_NUMBER 360) - SET(DCMTK_PACKAGE_VERSION "3.6.0") - SET(DCMTK_SOURCES_DIR ${CMAKE_BINARY_DIR}/dcmtk-3.6.0) - SET(DCMTK_URL "http://orthanc.osimis.io/ThirdPartyDownloads/dcmtk-3.6.0.zip") - SET(DCMTK_MD5 "219ad631b82031806147e4abbfba4fa4") - else() - SET(DCMTK_VERSION_NUMBER 362) - SET(DCMTK_PACKAGE_VERSION "3.6.2") - SET(DCMTK_SOURCES_DIR ${CMAKE_BINARY_DIR}/dcmtk-3.6.2) - SET(DCMTK_URL "http://orthanc.osimis.io/ThirdPartyDownloads/dcmtk-3.6.2.tar.gz") - SET(DCMTK_MD5 "d219a4152772985191c9b89d75302d12") - - macro(DCMTK_UNSET) - endmacro() - - macro(DCMTK_UNSET_CACHE) - endmacro() - - set(DCMTK_BINARY_DIR ${DCMTK_SOURCES_DIR}/) - set(DCMTK_CMAKE_INCLUDE ${DCMTK_SOURCES_DIR}/) - set(DCMTK_WITH_THREADS ON) + if (DCMTK_STATIC_VERSION STREQUAL "3.6.0") + include(${CMAKE_CURRENT_LIST_DIR}/DcmtkConfigurationStatic-3.6.0.cmake) - add_definitions(-DDCMTK_INSIDE_LOG4CPLUS=1) - endif() - - if (IS_DIRECTORY "${DCMTK_SOURCES_DIR}") - set(FirstRun OFF) - else() - set(FirstRun ON) - endif() - - DownloadPackage(${DCMTK_MD5} ${DCMTK_URL} "${DCMTK_SOURCES_DIR}") + elseif (DCMTK_STATIC_VERSION STREQUAL "3.6.2") + include(${CMAKE_CURRENT_LIST_DIR}/DcmtkConfigurationStatic-3.6.2.cmake) + + #elseif (DCMTK_STATIC_VERSION STREQUAL "3.6.4") - - if (FirstRun) - if (USE_DCMTK_360) - # If using DCMTK 3.6.0, backport the "private.dic" file from DCMTK - # 3.6.2. This adds support for more private tags, and fixes some - # import problems with Philips MRI Achieva. - if (USE_DCMTK_362_PRIVATE_DIC) - message("Using the dictionary of private tags from DCMTK 3.6.2") - configure_file( - ${ORTHANC_ROOT}/Resources/Patches/dcmtk-3.6.2-private.dic - ${DCMTK_SOURCES_DIR}/dcmdata/data/private.dic - COPYONLY) - else() - message("Using the dictionary of private tags from DCMTK 3.6.0") - endif() - - # Patches specific to DCMTK 3.6.0 - message("Applying patch to solve vulnerability in DCMTK 3.6.0") - execute_process( - COMMAND ${PATCH_EXECUTABLE} -p0 -N -i - ${ORTHANC_ROOT}/Resources/Patches/dcmtk-3.6.0-dulparse-vulnerability.patch - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} - RESULT_VARIABLE Failure - ) - - if (Failure) - message(FATAL_ERROR "Error while patching a file") - endif() - - # This patch is not needed anymore thanks to the following commit - # (information sent by Jorg Riesmeier on Twitter on 2017-07-19): - # http://git.dcmtk.org/?p=dcmtk.git;a=commit;h=8df1f5e517b8629ae09088d0935c2a8dd333c76f - message("Applying patch for speed in DCMTK 3.6.0") - execute_process( - COMMAND ${PATCH_EXECUTABLE} -p0 -N -i - ${ORTHANC_ROOT}/Resources/Patches/dcmtk-3.6.0-speed.patch - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} - RESULT_VARIABLE Failure - ) - - if (Failure) - message(FATAL_ERROR "Error while patching a file") - endif() - - else() - # "3.6.2 CXX11 fails on Linux; patch suggestions included" - # https://forum.dcmtk.org/viewtopic.php?f=3&t=4637 - message("Applying patch to detect mathematic primitives in DCMTK 3.6.2 with C++11") - execute_process( - COMMAND ${PATCH_EXECUTABLE} -p0 -N -i - ${ORTHANC_ROOT}/Resources/Patches/dcmtk-3.6.2-cmath.patch - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} - RESULT_VARIABLE Failure - ) - - if (Failure) - message(FATAL_ERROR "Error while patching a file") - endif() - endif() else() - message("The patches for DCMTK have already been applied") + message(FATAL_ERROR "Unsupported version of DCMTK: ${DCMTK_STATIC_VERSION}") endif() - # C_CHAR_UNSIGNED *must* be set before calling "GenerateDCMTKConfigure.cmake" - IF (CMAKE_CROSSCOMPILING) - if (CMAKE_COMPILER_IS_GNUCXX AND - CMAKE_SYSTEM_NAME STREQUAL "Windows") # MinGW - SET(C_CHAR_UNSIGNED 1 CACHE INTERNAL "Whether char is unsigned.") - - elseif(CMAKE_SYSTEM_NAME STREQUAL "Emscripten") # WebAssembly or asm.js - - # Check out "../WebAssembly/ArithmeticTests/" to regenerate the - # "arith.h" file - configure_file( - ${ORTHANC_ROOT}/Resources/WebAssembly/arith.h - ${DCMTK_SOURCES_DIR}/config/include/dcmtk/config/arith.h - COPYONLY) - - UNSET(C_CHAR_UNSIGNED CACHE) - SET(C_CHAR_UNSIGNED 0 CACHE INTERNAL "") - - else() - message(FATAL_ERROR "Support your platform here") - endif() - ENDIF() - + ## + ## Commands shared by all versions of DCMTK + ## - if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase") - SET(DCMTK_ENABLE_CHARSET_CONVERSION "iconv" CACHE STRING "") - SET(HAVE_SYS_GETTID 0 CACHE INTERNAL "") - - execute_process( - COMMAND ${PATCH_EXECUTABLE} -p0 -N -i - ${ORTHANC_ROOT}/Resources/Patches/dcmtk-3.6.2-linux-standard-base.patch - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} - RESULT_VARIABLE Failure - ) - - if (FirstRun AND Failure) - message(FATAL_ERROR "Error while patching a file") - endif() - endif() - - SET(DCMTK_SOURCE_DIR ${DCMTK_SOURCES_DIR}) - include(${DCMTK_SOURCES_DIR}/CMake/CheckFunctionWithHeaderExists.cmake) - include(${DCMTK_SOURCES_DIR}/CMake/GenerateDCMTKConfigure.cmake) - - - if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten") # WebAssembly or - # asm.js The macros below are not properly discovered by DCMTK - # when using WebAssembly. Check out "../WebAssembly/arith.h" for - # how we produced these values. This step MUST be after - # "GenerateDCMTKConfigure" and before the generation of - # "osconfig.h". - UNSET(SIZEOF_VOID_P CACHE) - UNSET(SIZEOF_CHAR CACHE) - UNSET(SIZEOF_DOUBLE CACHE) - UNSET(SIZEOF_FLOAT CACHE) - UNSET(SIZEOF_INT CACHE) - UNSET(SIZEOF_LONG CACHE) - UNSET(SIZEOF_SHORT CACHE) - UNSET(SIZEOF_VOID_P CACHE) - - SET(SIZEOF_VOID_P 4 CACHE INTERNAL "") - SET(SIZEOF_CHAR 1 CACHE INTERNAL "") - SET(SIZEOF_DOUBLE 8 CACHE INTERNAL "") - SET(SIZEOF_FLOAT 4 CACHE INTERNAL "") - SET(SIZEOF_INT 4 CACHE INTERNAL "") - SET(SIZEOF_LONG 4 CACHE INTERNAL "") - SET(SIZEOF_SHORT 2 CACHE INTERNAL "") - SET(SIZEOF_VOID_P 4 CACHE INTERNAL "") - endif() - - - set(DCMTK_PACKAGE_VERSION_SUFFIX "") - set(DCMTK_PACKAGE_VERSION_NUMBER ${DCMTK_VERSION_NUMBER}) - - CONFIGURE_FILE( - ${DCMTK_SOURCES_DIR}/CMake/osconfig.h.in - ${DCMTK_SOURCES_DIR}/config/include/dcmtk/config/osconfig.h) - - if (NOT USE_DCMTK_360) - if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") - link_libraries(netapi32) # For NetWkstaUserGetInfo@12 - link_libraries(iphlpapi) # For GetAdaptersInfo@8 - - # Configure Wine if cross-compiling for Windows - if (CMAKE_COMPILER_IS_GNUCXX) - include(${DCMTK_SOURCES_DIR}/CMake/dcmtkUseWine.cmake) - FIND_PROGRAM(WINE_WINE_PROGRAM wine) - FIND_PROGRAM(WINE_WINEPATH_PROGRAM winepath) - list(APPEND DCMTK_TRY_COMPILE_REQUIRED_CMAKE_FLAGS "-DCMAKE_EXE_LINKER_FLAGS=-static") - endif() - endif() - - # This step must be after the generation of "osconfig.h" - if (NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten") - INSPECT_FUNDAMENTAL_ARITHMETIC_TYPES() - endif() - endif() - - AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmdata/libsrc DCMTK_SOURCES) - AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/ofstd/libsrc DCMTK_SOURCES) - - if (ENABLE_DCMTK_NETWORKING) - AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmnet/libsrc DCMTK_SOURCES) - include_directories( - ${DCMTK_SOURCES_DIR}/dcmnet/include - ) - endif() - - if (ENABLE_DCMTK_JPEG) - AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmjpeg/libsrc DCMTK_SOURCES) - AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmjpeg/libijg8 DCMTK_SOURCES) - AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmjpeg/libijg12 DCMTK_SOURCES) - AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmjpeg/libijg16 DCMTK_SOURCES) - include_directories( - ${DCMTK_SOURCES_DIR}/dcmjpeg/include - ${DCMTK_SOURCES_DIR}/dcmjpeg/libijg8 - ${DCMTK_SOURCES_DIR}/dcmjpeg/libijg12 - ${DCMTK_SOURCES_DIR}/dcmjpeg/libijg16 - ${DCMTK_SOURCES_DIR}/dcmimgle/include - ) - list(REMOVE_ITEM DCMTK_SOURCES - ${DCMTK_SOURCES_DIR}/dcmjpeg/libsrc/ddpiimpl.cc - - # Disable support for encoding JPEG (modification in Orthanc 1.0.1) - ${DCMTK_SOURCES_DIR}/dcmjpeg/libsrc/djcodece.cc - ${DCMTK_SOURCES_DIR}/dcmjpeg/libsrc/djencsv1.cc - ${DCMTK_SOURCES_DIR}/dcmjpeg/libsrc/djencbas.cc - ${DCMTK_SOURCES_DIR}/dcmjpeg/libsrc/djencpro.cc - ${DCMTK_SOURCES_DIR}/dcmjpeg/libsrc/djenclol.cc - ${DCMTK_SOURCES_DIR}/dcmjpeg/libsrc/djencode.cc - ${DCMTK_SOURCES_DIR}/dcmjpeg/libsrc/djencext.cc - ${DCMTK_SOURCES_DIR}/dcmjpeg/libsrc/djencsps.cc - ) - endif() - - - if (ENABLE_DCMTK_JPEG_LOSSLESS) - AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmjpls/libsrc DCMTK_SOURCES) - AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmjpls/libcharls DCMTK_SOURCES) - include_directories( - ${DCMTK_SOURCES_DIR}/dcmjpeg/include - ${DCMTK_SOURCES_DIR}/dcmjpls/include - ${DCMTK_SOURCES_DIR}/dcmjpls/libcharls - ) - list(REMOVE_ITEM DCMTK_SOURCES - ${DCMTK_SOURCES_DIR}/dcmjpls/libsrc/djcodece.cc - - # Disable support for encoding JPEG-LS (modification in Orthanc 1.0.1) - ${DCMTK_SOURCES_DIR}/dcmjpls/libsrc/djencode.cc - ) - list(APPEND DCMTK_SOURCES - ${DCMTK_SOURCES_DIR}/dcmjpeg/libsrc/djrplol.cc - ) - endif() - - - # Source for the logging facility of DCMTK - AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/oflog/libsrc DCMTK_SOURCES) - if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR - ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" OR - ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" OR - ${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD" OR - ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD" OR - ${CMAKE_SYSTEM_NAME} STREQUAL "Emscripten") - list(REMOVE_ITEM DCMTK_SOURCES - ${DCMTK_SOURCES_DIR}/oflog/libsrc/clfsap.cc - ${DCMTK_SOURCES_DIR}/oflog/libsrc/windebap.cc - ${DCMTK_SOURCES_DIR}/oflog/libsrc/winsock.cc - ) - - elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") - list(REMOVE_ITEM DCMTK_SOURCES - ${DCMTK_SOURCES_DIR}/oflog/libsrc/unixsock.cc - ${DCMTK_SOURCES_DIR}/oflog/libsrc/clfsap.cc - ) - - if (CMAKE_COMPILER_IS_GNUCXX AND - USE_DCMTK_360) - # This is a patch for MinGW64 - execute_process( - COMMAND ${PATCH_EXECUTABLE} -p0 -N -i - ${ORTHANC_ROOT}/Resources/Patches/dcmtk-3.6.0-mingw64.patch - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} - RESULT_VARIABLE Failure - ) - - if (Failure AND FirstRun) - message(FATAL_ERROR "Error while patching a file") - endif() - endif() - endif() - - - if (NOT USE_DCMTK_360 AND - ORTHANC_SANDBOXED) - configure_file( - ${ORTHANC_ROOT}/Resources/WebAssembly/dcdict.h - ${DCMTK_SOURCES_DIR}/dcmdata/include/dcmtk/dcmdata/dcdict.h - COPYONLY) - - configure_file( - ${ORTHANC_ROOT}/Resources/WebAssembly/dcdict.cc - ${DCMTK_SOURCES_DIR}/dcmdata/libsrc/dcdict.cc - COPYONLY) - endif() - - - list(REMOVE_ITEM DCMTK_SOURCES - ${DCMTK_SOURCES_DIR}/dcmdata/libsrc/mkdictbi.cc - ${DCMTK_SOURCES_DIR}/dcmdata/libsrc/mkdeftag.cc - ) - - #set_source_files_properties(${DCMTK_SOURCES} - # PROPERTIES COMPILE_DEFINITIONS - # "PACKAGE_VERSION=\"${DCMTK_PACKAGE_VERSION}\";PACKAGE_VERSION_NUMBER=\"${DCMTK_VERSION_NUMBER}\"") - # This fixes crashes related to the destruction of the DCMTK OFLogger # http://support.dcmtk.org/docs-snapshot/file_macros.html add_definitions( @@ -346,12 +49,10 @@ source_group(ThirdParty\\Dcmtk REGULAR_EXPRESSION ${DCMTK_SOURCES_DIR}/.*) - set(DCMTK_BUNDLES_LOG4CPLUS 1) - if (STANDALONE_BUILD) set(DCMTK_USE_EMBEDDED_DICTIONARIES 1) set(DCMTK_DICTIONARIES - DICTIONARY_DICOM ${DCMTK_SOURCES_DIR}/dcmdata/data/dicom.dic + DICTIONARY_DICOM ${DCMTK_SOURCES_DIR}/dcmdata/data/dicom.dic DICTIONARY_PRIVATE ${DCMTK_SOURCES_DIR}/dcmdata/data/private.dic DICTIONARY_DICONDE ${DCMTK_SOURCES_DIR}/dcmdata/data/diconde.dic ) @@ -359,6 +60,7 @@ set(DCMTK_USE_EMBEDDED_DICTIONARIES 0) endif() + else() # The following line allows to manually add libraries at the # command-line, which is necessary for Ubuntu/Debian packages
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Resources/CMake/DcmtkConfigurationStatic-3.6.0.cmake Wed Feb 20 17:19:27 2019 +0100 @@ -0,0 +1,237 @@ +SET(DCMTK_VERSION_NUMBER 360) +SET(DCMTK_PACKAGE_VERSION "3.6.0") +SET(DCMTK_SOURCES_DIR ${CMAKE_BINARY_DIR}/dcmtk-3.6.0) +SET(DCMTK_URL "http://orthanc.osimis.io/ThirdPartyDownloads/dcmtk-3.6.0.zip") +SET(DCMTK_MD5 "219ad631b82031806147e4abbfba4fa4") + +if (IS_DIRECTORY "${DCMTK_SOURCES_DIR}") + set(FirstRun OFF) +else() + set(FirstRun ON) +endif() + +DownloadPackage(${DCMTK_MD5} ${DCMTK_URL} "${DCMTK_SOURCES_DIR}") + + +if (FirstRun) + # If using DCMTK 3.6.0, backport the "private.dic" file from DCMTK + # 3.6.2. This adds support for more private tags, and fixes some + # import problems with Philips MRI Achieva. + if (USE_DCMTK_362_PRIVATE_DIC) + message("Using the dictionary of private tags from DCMTK 3.6.2") + configure_file( + ${ORTHANC_ROOT}/Resources/Patches/dcmtk-3.6.2-private.dic + ${DCMTK_SOURCES_DIR}/dcmdata/data/private.dic + COPYONLY) + else() + message("Using the dictionary of private tags from DCMTK 3.6.0") + endif() + + # Patches specific to DCMTK 3.6.0 + message("Applying patch to solve vulnerability in DCMTK 3.6.0") + execute_process( + COMMAND ${PATCH_EXECUTABLE} -p0 -N -i + ${ORTHANC_ROOT}/Resources/Patches/dcmtk-3.6.0-dulparse-vulnerability.patch + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + RESULT_VARIABLE Failure + ) + + if (Failure) + message(FATAL_ERROR "Error while patching a file") + endif() + + # This patch is not needed anymore thanks to the following commit + # (information sent by Jorg Riesmeier on Twitter on 2017-07-19): + # http://git.dcmtk.org/?p=dcmtk.git;a=commit;h=8df1f5e517b8629ae09088d0935c2a8dd333c76f + message("Applying patch for speed in DCMTK 3.6.0") + execute_process( + COMMAND ${PATCH_EXECUTABLE} -p0 -N -i + ${ORTHANC_ROOT}/Resources/Patches/dcmtk-3.6.0-speed.patch + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + RESULT_VARIABLE Failure + ) + + if (Failure) + message(FATAL_ERROR "Error while patching a file") + endif() +else() + message("The patches for DCMTK have already been applied") +endif() + + +# C_CHAR_UNSIGNED *must* be set before calling "GenerateDCMTKConfigure.cmake" +IF (CMAKE_CROSSCOMPILING) + if (CMAKE_COMPILER_IS_GNUCXX AND + CMAKE_SYSTEM_NAME STREQUAL "Windows") # MinGW + SET(C_CHAR_UNSIGNED 1 CACHE INTERNAL "Whether char is unsigned.") + + elseif(CMAKE_SYSTEM_NAME STREQUAL "Emscripten") # WebAssembly or asm.js + + # Check out "../WebAssembly/ArithmeticTests/" to regenerate the + # "arith.h" file + configure_file( + ${ORTHANC_ROOT}/Resources/WebAssembly/arith.h + ${DCMTK_SOURCES_DIR}/config/include/dcmtk/config/arith.h + COPYONLY) + + UNSET(C_CHAR_UNSIGNED CACHE) + SET(C_CHAR_UNSIGNED 0 CACHE INTERNAL "") + + else() + message(FATAL_ERROR "Support your platform here") + endif() +ENDIF() + + +if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase") + SET(DCMTK_ENABLE_CHARSET_CONVERSION "iconv" CACHE STRING "") + SET(HAVE_SYS_GETTID 0 CACHE INTERNAL "") + + execute_process( + COMMAND ${PATCH_EXECUTABLE} -p0 -N -i + ${ORTHANC_ROOT}/Resources/Patches/dcmtk-3.6.2-linux-standard-base.patch + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + RESULT_VARIABLE Failure + ) + + if (FirstRun AND Failure) + message(FATAL_ERROR "Error while patching a file") + endif() +endif() + +SET(DCMTK_SOURCE_DIR ${DCMTK_SOURCES_DIR}) +include(${DCMTK_SOURCES_DIR}/CMake/CheckFunctionWithHeaderExists.cmake) +include(${DCMTK_SOURCES_DIR}/CMake/GenerateDCMTKConfigure.cmake) + + +if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten") # WebAssembly or + # asm.js The macros below are not properly discovered by DCMTK + # when using WebAssembly. Check out "../WebAssembly/arith.h" for + # how we produced these values. This step MUST be after + # "GenerateDCMTKConfigure" and before the generation of + # "osconfig.h". + UNSET(SIZEOF_VOID_P CACHE) + UNSET(SIZEOF_CHAR CACHE) + UNSET(SIZEOF_DOUBLE CACHE) + UNSET(SIZEOF_FLOAT CACHE) + UNSET(SIZEOF_INT CACHE) + UNSET(SIZEOF_LONG CACHE) + UNSET(SIZEOF_SHORT CACHE) + UNSET(SIZEOF_VOID_P CACHE) + + SET(SIZEOF_VOID_P 4 CACHE INTERNAL "") + SET(SIZEOF_CHAR 1 CACHE INTERNAL "") + SET(SIZEOF_DOUBLE 8 CACHE INTERNAL "") + SET(SIZEOF_FLOAT 4 CACHE INTERNAL "") + SET(SIZEOF_INT 4 CACHE INTERNAL "") + SET(SIZEOF_LONG 4 CACHE INTERNAL "") + SET(SIZEOF_SHORT 2 CACHE INTERNAL "") + SET(SIZEOF_VOID_P 4 CACHE INTERNAL "") +endif() + + +set(DCMTK_PACKAGE_VERSION_SUFFIX "") +set(DCMTK_PACKAGE_VERSION_NUMBER ${DCMTK_VERSION_NUMBER}) + +CONFIGURE_FILE( + ${DCMTK_SOURCES_DIR}/CMake/osconfig.h.in + ${DCMTK_SOURCES_DIR}/config/include/dcmtk/config/osconfig.h) + +AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmdata/libsrc DCMTK_SOURCES) +AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/ofstd/libsrc DCMTK_SOURCES) + +if (ENABLE_DCMTK_NETWORKING) + AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmnet/libsrc DCMTK_SOURCES) + include_directories( + ${DCMTK_SOURCES_DIR}/dcmnet/include + ) +endif() + +if (ENABLE_DCMTK_JPEG) + AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmjpeg/libsrc DCMTK_SOURCES) + AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmjpeg/libijg8 DCMTK_SOURCES) + AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmjpeg/libijg12 DCMTK_SOURCES) + AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmjpeg/libijg16 DCMTK_SOURCES) + include_directories( + ${DCMTK_SOURCES_DIR}/dcmjpeg/include + ${DCMTK_SOURCES_DIR}/dcmjpeg/libijg8 + ${DCMTK_SOURCES_DIR}/dcmjpeg/libijg12 + ${DCMTK_SOURCES_DIR}/dcmjpeg/libijg16 + ${DCMTK_SOURCES_DIR}/dcmimgle/include + ) + list(REMOVE_ITEM DCMTK_SOURCES + ${DCMTK_SOURCES_DIR}/dcmjpeg/libsrc/ddpiimpl.cc + + # Disable support for encoding JPEG (modification in Orthanc 1.0.1) + ${DCMTK_SOURCES_DIR}/dcmjpeg/libsrc/djcodece.cc + ${DCMTK_SOURCES_DIR}/dcmjpeg/libsrc/djencsv1.cc + ${DCMTK_SOURCES_DIR}/dcmjpeg/libsrc/djencbas.cc + ${DCMTK_SOURCES_DIR}/dcmjpeg/libsrc/djencpro.cc + ${DCMTK_SOURCES_DIR}/dcmjpeg/libsrc/djenclol.cc + ${DCMTK_SOURCES_DIR}/dcmjpeg/libsrc/djencode.cc + ${DCMTK_SOURCES_DIR}/dcmjpeg/libsrc/djencext.cc + ${DCMTK_SOURCES_DIR}/dcmjpeg/libsrc/djencsps.cc + ) +endif() + + +if (ENABLE_DCMTK_JPEG_LOSSLESS) + AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmjpls/libsrc DCMTK_SOURCES) + AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmjpls/libcharls DCMTK_SOURCES) + include_directories( + ${DCMTK_SOURCES_DIR}/dcmjpeg/include + ${DCMTK_SOURCES_DIR}/dcmjpls/include + ${DCMTK_SOURCES_DIR}/dcmjpls/libcharls + ) + list(REMOVE_ITEM DCMTK_SOURCES + ${DCMTK_SOURCES_DIR}/dcmjpls/libsrc/djcodece.cc + + # Disable support for encoding JPEG-LS (modification in Orthanc 1.0.1) + ${DCMTK_SOURCES_DIR}/dcmjpls/libsrc/djencode.cc + ) + list(APPEND DCMTK_SOURCES + ${DCMTK_SOURCES_DIR}/dcmjpeg/libsrc/djrplol.cc + ) +endif() + + +# Source for the logging facility of DCMTK +AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/oflog/libsrc DCMTK_SOURCES) +if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR + ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" OR + ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" OR + ${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD" OR + ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD" OR + ${CMAKE_SYSTEM_NAME} STREQUAL "Emscripten") + list(REMOVE_ITEM DCMTK_SOURCES + ${DCMTK_SOURCES_DIR}/oflog/libsrc/clfsap.cc + ${DCMTK_SOURCES_DIR}/oflog/libsrc/windebap.cc + ${DCMTK_SOURCES_DIR}/oflog/libsrc/winsock.cc + ) + +elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") + list(REMOVE_ITEM DCMTK_SOURCES + ${DCMTK_SOURCES_DIR}/oflog/libsrc/unixsock.cc + ${DCMTK_SOURCES_DIR}/oflog/libsrc/clfsap.cc + ) + + if (CMAKE_COMPILER_IS_GNUCXX) + # This is a patch for DCMTK 3.6.0 and MinGW64 + execute_process( + COMMAND ${PATCH_EXECUTABLE} -p0 -N -i + ${ORTHANC_ROOT}/Resources/Patches/dcmtk-3.6.0-mingw64.patch + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + RESULT_VARIABLE Failure + ) + + if (Failure AND FirstRun) + message(FATAL_ERROR "Error while patching a file") + endif() + endif() +endif() + + +list(REMOVE_ITEM DCMTK_SOURCES + ${DCMTK_SOURCES_DIR}/dcmdata/libsrc/mkdictbi.cc + ${DCMTK_SOURCES_DIR}/dcmdata/libsrc/mkdeftag.cc + )
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Resources/CMake/DcmtkConfigurationStatic-3.6.2.cmake Wed Feb 20 17:19:27 2019 +0100 @@ -0,0 +1,244 @@ +SET(DCMTK_VERSION_NUMBER 362) +SET(DCMTK_PACKAGE_VERSION "3.6.2") +SET(DCMTK_SOURCES_DIR ${CMAKE_BINARY_DIR}/dcmtk-3.6.2) +SET(DCMTK_URL "http://orthanc.osimis.io/ThirdPartyDownloads/dcmtk-3.6.2.tar.gz") +SET(DCMTK_MD5 "d219a4152772985191c9b89d75302d12") + +macro(DCMTK_UNSET) +endmacro() + +macro(DCMTK_UNSET_CACHE) +endmacro() + +set(DCMTK_BINARY_DIR ${DCMTK_SOURCES_DIR}/) +set(DCMTK_CMAKE_INCLUDE ${DCMTK_SOURCES_DIR}/) +set(DCMTK_WITH_THREADS ON) + +add_definitions(-DDCMTK_INSIDE_LOG4CPLUS=1) + +if (IS_DIRECTORY "${DCMTK_SOURCES_DIR}") + set(FirstRun OFF) +else() + set(FirstRun ON) +endif() + +DownloadPackage(${DCMTK_MD5} ${DCMTK_URL} "${DCMTK_SOURCES_DIR}") + + +if (FirstRun) + # "3.6.2 CXX11 fails on Linux; patch suggestions included" + # https://forum.dcmtk.org/viewtopic.php?f=3&t=4637 + message("Applying patch to detect mathematic primitives in DCMTK 3.6.2 with C++11") + execute_process( + COMMAND ${PATCH_EXECUTABLE} -p0 -N -i + ${ORTHANC_ROOT}/Resources/Patches/dcmtk-3.6.2-cmath.patch + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + RESULT_VARIABLE Failure + ) + + if (Failure) + message(FATAL_ERROR "Error while patching a file") + endif() +else() + message("The patches for DCMTK have already been applied") +endif() + + +# C_CHAR_UNSIGNED *must* be set before calling "GenerateDCMTKConfigure.cmake" +IF (CMAKE_CROSSCOMPILING) + if (CMAKE_COMPILER_IS_GNUCXX AND + CMAKE_SYSTEM_NAME STREQUAL "Windows") # MinGW + SET(C_CHAR_UNSIGNED 1 CACHE INTERNAL "Whether char is unsigned.") + + elseif(CMAKE_SYSTEM_NAME STREQUAL "Emscripten") # WebAssembly or asm.js + + # Check out "../WebAssembly/ArithmeticTests/" to regenerate the + # "arith.h" file + configure_file( + ${ORTHANC_ROOT}/Resources/WebAssembly/arith.h + ${DCMTK_SOURCES_DIR}/config/include/dcmtk/config/arith.h + COPYONLY) + + UNSET(C_CHAR_UNSIGNED CACHE) + SET(C_CHAR_UNSIGNED 0 CACHE INTERNAL "") + + else() + message(FATAL_ERROR "Support your platform here") + endif() +ENDIF() + + +if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase") + SET(DCMTK_ENABLE_CHARSET_CONVERSION "iconv" CACHE STRING "") + SET(HAVE_SYS_GETTID 0 CACHE INTERNAL "") + + execute_process( + COMMAND ${PATCH_EXECUTABLE} -p0 -N -i + ${ORTHANC_ROOT}/Resources/Patches/dcmtk-3.6.2-linux-standard-base.patch + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + RESULT_VARIABLE Failure + ) + + if (FirstRun AND Failure) + message(FATAL_ERROR "Error while patching a file") + endif() +endif() + +SET(DCMTK_SOURCE_DIR ${DCMTK_SOURCES_DIR}) +include(${DCMTK_SOURCES_DIR}/CMake/CheckFunctionWithHeaderExists.cmake) +include(${DCMTK_SOURCES_DIR}/CMake/GenerateDCMTKConfigure.cmake) + + +if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten") # WebAssembly or + # asm.js The macros below are not properly discovered by DCMTK + # when using WebAssembly. Check out "../WebAssembly/arith.h" for + # how we produced these values. This step MUST be after + # "GenerateDCMTKConfigure" and before the generation of + # "osconfig.h". + UNSET(SIZEOF_VOID_P CACHE) + UNSET(SIZEOF_CHAR CACHE) + UNSET(SIZEOF_DOUBLE CACHE) + UNSET(SIZEOF_FLOAT CACHE) + UNSET(SIZEOF_INT CACHE) + UNSET(SIZEOF_LONG CACHE) + UNSET(SIZEOF_SHORT CACHE) + UNSET(SIZEOF_VOID_P CACHE) + + SET(SIZEOF_VOID_P 4 CACHE INTERNAL "") + SET(SIZEOF_CHAR 1 CACHE INTERNAL "") + SET(SIZEOF_DOUBLE 8 CACHE INTERNAL "") + SET(SIZEOF_FLOAT 4 CACHE INTERNAL "") + SET(SIZEOF_INT 4 CACHE INTERNAL "") + SET(SIZEOF_LONG 4 CACHE INTERNAL "") + SET(SIZEOF_SHORT 2 CACHE INTERNAL "") + SET(SIZEOF_VOID_P 4 CACHE INTERNAL "") +endif() + + +set(DCMTK_PACKAGE_VERSION_SUFFIX "") +set(DCMTK_PACKAGE_VERSION_NUMBER ${DCMTK_VERSION_NUMBER}) + +CONFIGURE_FILE( + ${DCMTK_SOURCES_DIR}/CMake/osconfig.h.in + ${DCMTK_SOURCES_DIR}/config/include/dcmtk/config/osconfig.h) + +if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") + link_libraries(netapi32) # For NetWkstaUserGetInfo@12 + link_libraries(iphlpapi) # For GetAdaptersInfo@8 + + # Configure Wine if cross-compiling for Windows + if (CMAKE_COMPILER_IS_GNUCXX) + include(${DCMTK_SOURCES_DIR}/CMake/dcmtkUseWine.cmake) + FIND_PROGRAM(WINE_WINE_PROGRAM wine) + FIND_PROGRAM(WINE_WINEPATH_PROGRAM winepath) + list(APPEND DCMTK_TRY_COMPILE_REQUIRED_CMAKE_FLAGS "-DCMAKE_EXE_LINKER_FLAGS=-static") + endif() +endif() + +# This step must be after the generation of "osconfig.h" +if (NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten") + INSPECT_FUNDAMENTAL_ARITHMETIC_TYPES() +endif() + +AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmdata/libsrc DCMTK_SOURCES) +AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/ofstd/libsrc DCMTK_SOURCES) + +if (ENABLE_DCMTK_NETWORKING) + AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmnet/libsrc DCMTK_SOURCES) + include_directories( + ${DCMTK_SOURCES_DIR}/dcmnet/include + ) +endif() + +if (ENABLE_DCMTK_JPEG) + AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmjpeg/libsrc DCMTK_SOURCES) + AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmjpeg/libijg8 DCMTK_SOURCES) + AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmjpeg/libijg12 DCMTK_SOURCES) + AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmjpeg/libijg16 DCMTK_SOURCES) + include_directories( + ${DCMTK_SOURCES_DIR}/dcmjpeg/include + ${DCMTK_SOURCES_DIR}/dcmjpeg/libijg8 + ${DCMTK_SOURCES_DIR}/dcmjpeg/libijg12 + ${DCMTK_SOURCES_DIR}/dcmjpeg/libijg16 + ${DCMTK_SOURCES_DIR}/dcmimgle/include + ) + list(REMOVE_ITEM DCMTK_SOURCES + ${DCMTK_SOURCES_DIR}/dcmjpeg/libsrc/ddpiimpl.cc + + # Disable support for encoding JPEG (modification in Orthanc 1.0.1) + ${DCMTK_SOURCES_DIR}/dcmjpeg/libsrc/djcodece.cc + ${DCMTK_SOURCES_DIR}/dcmjpeg/libsrc/djencsv1.cc + ${DCMTK_SOURCES_DIR}/dcmjpeg/libsrc/djencbas.cc + ${DCMTK_SOURCES_DIR}/dcmjpeg/libsrc/djencpro.cc + ${DCMTK_SOURCES_DIR}/dcmjpeg/libsrc/djenclol.cc + ${DCMTK_SOURCES_DIR}/dcmjpeg/libsrc/djencode.cc + ${DCMTK_SOURCES_DIR}/dcmjpeg/libsrc/djencext.cc + ${DCMTK_SOURCES_DIR}/dcmjpeg/libsrc/djencsps.cc + ) +endif() + + +if (ENABLE_DCMTK_JPEG_LOSSLESS) + AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmjpls/libsrc DCMTK_SOURCES) + AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmjpls/libcharls DCMTK_SOURCES) + include_directories( + ${DCMTK_SOURCES_DIR}/dcmjpeg/include + ${DCMTK_SOURCES_DIR}/dcmjpls/include + ${DCMTK_SOURCES_DIR}/dcmjpls/libcharls + ) + list(REMOVE_ITEM DCMTK_SOURCES + ${DCMTK_SOURCES_DIR}/dcmjpls/libsrc/djcodece.cc + + # Disable support for encoding JPEG-LS (modification in Orthanc 1.0.1) + ${DCMTK_SOURCES_DIR}/dcmjpls/libsrc/djencode.cc + ) + list(APPEND DCMTK_SOURCES + ${DCMTK_SOURCES_DIR}/dcmjpeg/libsrc/djrplol.cc + ) +endif() + + +# Source for the logging facility of DCMTK +AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/oflog/libsrc DCMTK_SOURCES) +if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR + ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" OR + ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" OR + ${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD" OR + ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD" OR + ${CMAKE_SYSTEM_NAME} STREQUAL "Emscripten") + list(REMOVE_ITEM DCMTK_SOURCES + ${DCMTK_SOURCES_DIR}/oflog/libsrc/clfsap.cc + ${DCMTK_SOURCES_DIR}/oflog/libsrc/windebap.cc + ${DCMTK_SOURCES_DIR}/oflog/libsrc/winsock.cc + ) + +elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") + list(REMOVE_ITEM DCMTK_SOURCES + ${DCMTK_SOURCES_DIR}/oflog/libsrc/unixsock.cc + ${DCMTK_SOURCES_DIR}/oflog/libsrc/clfsap.cc + ) +endif() + + +if (ORTHANC_SANDBOXED) + configure_file( + ${ORTHANC_ROOT}/Resources/WebAssembly/dcdict.h + ${DCMTK_SOURCES_DIR}/dcmdata/include/dcmtk/dcmdata/dcdict.h + COPYONLY) + + configure_file( + ${ORTHANC_ROOT}/Resources/WebAssembly/dcdict.cc + ${DCMTK_SOURCES_DIR}/dcmdata/libsrc/dcdict.cc + COPYONLY) +endif() + + +list(REMOVE_ITEM DCMTK_SOURCES + ${DCMTK_SOURCES_DIR}/dcmdata/libsrc/mkdictbi.cc + ${DCMTK_SOURCES_DIR}/dcmdata/libsrc/mkdeftag.cc + ) + + +#set_source_files_properties(${DCMTK_SOURCES} +# PROPERTIES COMPILE_DEFINITIONS +# "PACKAGE_VERSION=\"${DCMTK_PACKAGE_VERSION}\";PACKAGE_VERSION_NUMBER=\"${DCMTK_VERSION_NUMBER}\"")
--- a/Resources/CMake/OrthancFrameworkConfiguration.cmake Wed Feb 20 16:41:05 2019 +0100 +++ b/Resources/CMake/OrthancFrameworkConfiguration.cmake Wed Feb 20 17:19:27 2019 +0100 @@ -109,7 +109,7 @@ -DORTHANC_ENABLE_DCMTK_NETWORKING=0 ) unset(DCMTK_DICTIONARY_DIR CACHE) - unset(USE_DCMTK_360 CACHE) + unset(DCMTK_VERSION CACHE) unset(USE_DCMTK_362_PRIVATE_DIC CACHE) unset(USE_SYSTEM_DCMTK CACHE) unset(ENABLE_DCMTK_JPEG CACHE)
--- a/Resources/CMake/OrthancFrameworkParameters.cmake Wed Feb 20 16:41:05 2019 +0100 +++ b/Resources/CMake/OrthancFrameworkParameters.cmake Wed Feb 20 17:19:27 2019 +0100 @@ -56,8 +56,8 @@ set(USE_SYSTEM_ZLIB ON CACHE BOOL "Use the system version of ZLib") # Parameters specific to DCMTK -set(DCMTK_DICTIONARY_DIR "" CACHE PATH "Directory containing the DCMTK dictionaries \"dicom.dic\" and \"private.dic\" (only when using system version of DCMTK)") -set(USE_DCMTK_360 OFF CACHE BOOL "Use older DCMTK version 3.6.0 in static builds (instead of default 3.6.2)") +set(DCMTK_DICTIONARY_DIR "" CACHE PATH "Directory containing the DCMTK dictionaries \"dicom.dic\" and \"private.dic\" (only when using system version of DCMTK)") +set(DCMTK_STATIC_VERSION "3.6.2" CACHE STRING "Version of DCMTK to be used in static builds (can be \"3.6.0\", \"3.6.2\", or \"3.6.4\")") set(USE_DCMTK_362_PRIVATE_DIC ON CACHE BOOL "Use the dictionary of private tags from DCMTK 3.6.2 if using DCMTK 3.6.0") set(USE_SYSTEM_DCMTK ON CACHE BOOL "Use the system version of DCMTK") set(ENABLE_DCMTK_LOG ON CACHE BOOL "Enable logging internal to DCMTK")