Mercurial > hg > orthanc
changeset 2508:91ee08d986f9
possibility to disable zlib support in the Orthanc framework
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 28 Mar 2018 11:24:17 +0200 |
parents | 99116ed6f38c |
children | 9d9f2d088dce |
files | CMakeLists.txt Core/Compression/DeflateBaseCompressor.h Core/Compression/ZipWriter.h Resources/CMake/DcmtkConfiguration.cmake Resources/CMake/OrthancFrameworkConfiguration.cmake Resources/CMake/OrthancFrameworkParameters.cmake |
diffstat | 6 files changed, 57 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/CMakeLists.txt Mon Mar 26 18:31:40 2018 +0200 +++ b/CMakeLists.txt Wed Mar 28 11:24:17 2018 +0200 @@ -22,6 +22,7 @@ set(ENABLE_SQLITE ON) set(ENABLE_WEB_CLIENT ON) set(ENABLE_WEB_SERVER ON) +set(ENABLE_ZLIB ON) set(HAS_EMBEDDED_RESOURCES ON)
--- a/Core/Compression/DeflateBaseCompressor.h Mon Mar 26 18:31:40 2018 +0200 +++ b/Core/Compression/DeflateBaseCompressor.h Wed Mar 28 11:24:17 2018 +0200 @@ -35,6 +35,15 @@ #include "IBufferCompressor.h" +#if !defined(ORTHANC_ENABLE_ZLIB) +# error The macro ORTHANC_ENABLE_ZLIB must be defined +#endif + +#if ORTHANC_ENABLE_ZLIB != 1 +# error ZLIB support must be enabled to include this file +#endif + + #include <stdint.h> namespace Orthanc
--- a/Core/Compression/ZipWriter.h Mon Mar 26 18:31:40 2018 +0200 +++ b/Core/Compression/ZipWriter.h Wed Mar 28 11:24:17 2018 +0200 @@ -33,6 +33,15 @@ #pragma once +#if !defined(ORTHANC_ENABLE_ZLIB) +# error The macro ORTHANC_ENABLE_ZLIB must be defined +#endif + +#if ORTHANC_ENABLE_ZLIB != 1 +# error ZLIB support must be enabled to include this file +#endif + + #include <stdint.h> #include <string> #include <boost/shared_ptr.hpp>
--- a/Resources/CMake/DcmtkConfiguration.cmake Mon Mar 26 18:31:40 2018 +0200 +++ b/Resources/CMake/DcmtkConfiguration.cmake Wed Mar 28 11:24:17 2018 +0200 @@ -102,8 +102,13 @@ IF (CMAKE_CROSSCOMPILING) if (CMAKE_COMPILER_IS_GNUCXX AND - ${CMAKE_SYSTEM_NAME} STREQUAL "Windows") # MinGW + 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 + SET(C_CHAR_UNSIGNED 0 CACHE INTERNAL "Whether char is unsigned.") + SET(SIZEOF_VOID_P 4 CACHE INTERNAL "") + else() message(FATAL_ERROR "Support your platform here") endif()
--- a/Resources/CMake/OrthancFrameworkConfiguration.cmake Mon Mar 26 18:31:40 2018 +0200 +++ b/Resources/CMake/OrthancFrameworkConfiguration.cmake Wed Mar 28 11:24:17 2018 +0200 @@ -71,6 +71,11 @@ add_definitions(-DORTHANC_ENABLE_JPEG=0) endif() +if (NOT ENABLE_ZLIB) + unset(USE_SYSTEM_ZLIB CACHE) + add_definitions(-DORTHANC_ENABLE_ZLIB=0) +endif() + if (NOT ENABLE_PNG) unset(USE_SYSTEM_LIBPNG CACHE) add_definitions(-DORTHANC_ENABLE_PNG=0) @@ -117,11 +122,6 @@ set(ORTHANC_CORE_SOURCES_INTERNAL ${ORTHANC_ROOT}/Core/Cache/MemoryCache.cpp ${ORTHANC_ROOT}/Core/ChunkedBuffer.cpp - ${ORTHANC_ROOT}/Core/Compression/DeflateBaseCompressor.cpp - ${ORTHANC_ROOT}/Core/Compression/GzipCompressor.cpp - ${ORTHANC_ROOT}/Core/Compression/HierarchicalZipWriter.cpp - ${ORTHANC_ROOT}/Core/Compression/ZipWriter.cpp - ${ORTHANC_ROOT}/Core/Compression/ZlibCompressor.cpp ${ORTHANC_ROOT}/Core/DicomFormat/DicomArray.cpp ${ORTHANC_ROOT}/Core/DicomFormat/DicomImageInformation.cpp ${ORTHANC_ROOT}/Core/DicomFormat/DicomInstanceHasher.cpp @@ -269,10 +269,36 @@ ## +## zlib support +## + +if (ENABLE_ZLIB) + include(${CMAKE_CURRENT_LIST_DIR}/ZlibConfiguration.cmake) + add_definitions(-DORTHANC_ENABLE_ZLIB=1) + + list(APPEND ORTHANC_CORE_SOURCES_INTERNAL + ${ORTHANC_ROOT}/Core/Compression/DeflateBaseCompressor.cpp + ${ORTHANC_ROOT}/Core/Compression/HierarchicalZipWriter.cpp + ${ORTHANC_ROOT}/Core/Compression/GzipCompressor.cpp + ${ORTHANC_ROOT}/Core/Compression/ZipWriter.cpp + ${ORTHANC_ROOT}/Core/Compression/ZlibCompressor.cpp + + # This is the minizip distribution to create ZIP files using zlib + ${ORTHANC_ROOT}/Resources/ThirdParty/minizip/ioapi.c + ${ORTHANC_ROOT}/Resources/ThirdParty/minizip/zip.c + ) +endif() + + +## ## PNG support: libpng (in conjunction with zlib) ## if (ENABLE_PNG) + if (NOT ENABLE_ZLIB) + message(FATAL_ERROR "Support for zlib must be enabled if enabling libpng support") + endif() + include(${CMAKE_CURRENT_LIST_DIR}/LibPngConfiguration.cmake) add_definitions(-DORTHANC_ENABLE_PNG=1) @@ -333,7 +359,6 @@ ##################################################################### include(${CMAKE_CURRENT_LIST_DIR}/JsonCppConfiguration.cmake) -include(${CMAKE_CURRENT_LIST_DIR}/ZlibConfiguration.cmake) if (NOT ORTHANC_SANDBOXED) include(${CMAKE_CURRENT_LIST_DIR}/UuidConfiguration.cmake) @@ -509,10 +534,6 @@ ${ORTHANC_ROOT}/Resources/ThirdParty/md5/md5.c ${ORTHANC_ROOT}/Resources/ThirdParty/base64/base64.cpp - - # This is the minizip distribution to create ZIP files using zlib - ${ORTHANC_ROOT}/Resources/ThirdParty/minizip/ioapi.c - ${ORTHANC_ROOT}/Resources/ThirdParty/minizip/zip.c ) set(ORTHANC_CORE_SOURCES
--- a/Resources/CMake/OrthancFrameworkParameters.cmake Mon Mar 26 18:31:40 2018 +0200 +++ b/Resources/CMake/OrthancFrameworkParameters.cmake Wed Mar 28 11:24:17 2018 +0200 @@ -93,6 +93,7 @@ set(ENABLE_PNG OFF CACHE INTERNAL "Enable support of PNG") set(ENABLE_PUGIXML OFF CACHE INTERNAL "Enable support of XML through Pugixml") set(ENABLE_SQLITE OFF CACHE INTERNAL "Enable support of SQLite databases") +set(ENABLE_ZLIB OFF CACHE INTERNAL "Enable support of zlib") set(ENABLE_WEB_CLIENT OFF CACHE INTERNAL "Enable Web client") set(ENABLE_WEB_SERVER OFF CACHE INTERNAL "Enable embedded Web server") set(ENABLE_DCMTK OFF CACHE INTERNAL "Enable DCMTK")