Mercurial > hg > orthanc-dicomweb
changeset 203:59dc84e00a4c
sync, support for linux standard base, upgrade to gdcm 2.8.4
line wrap: on
line diff
--- a/CMakeLists.txt Tue Jan 02 09:48:00 2018 +0100 +++ b/CMakeLists.txt Thu Jan 04 09:48:02 2018 +0100 @@ -34,22 +34,28 @@ set(USE_SYSTEM_GOOGLE_TEST ON CACHE BOOL "Use the system version of Google Test") set(USE_SYSTEM_JSONCPP ON CACHE BOOL "Use the system version of JsonCpp") set(USE_SYSTEM_LIBICONV ON CACHE BOOL "Use the system version of libiconv") -set(USE_SYSTEM_ZLIB ON CACHE BOOL "Use the system version of zlib") +set(USE_SYSTEM_ORTHANC_SDK ON CACHE BOOL "Use the system version of the Orthanc plugin SDK") set(USE_SYSTEM_PUGIXML ON CACHE BOOL "Use the system version of Pugixml") -set(USE_SYSTEM_ORTHANC_SDK ON CACHE BOOL "Use the system version of the Orthanc plugin SDK") +set(USE_SYSTEM_UUID ON CACHE BOOL "Use the system version of the uuid library from e2fsprogs") +set(USE_SYSTEM_ZLIB ON CACHE BOOL "Use the system version of zlib") # Distribution-specific settings -set(USE_GTEST_DEBIAN_SOURCE_PACKAGE OFF CACHE BOOL "Use the sources of Google Test shipped with libgtest-dev (Debian only)") -mark_as_advanced(USE_GTEST_DEBIAN_SOURCE_PACKAGE) +set(USE_GOOGLE_TEST_DEBIAN_PACKAGE OFF CACHE BOOL "Use the sources of Google Test shipped with libgtest-dev (Debian only)") +mark_as_advanced(USE_GOOGLE_TEST_DEBIAN_PACKAGE) -set(USE_PUGIXML ON) set(ORTHANC_ROOT ${CMAKE_SOURCE_DIR}/Orthanc) -set(ORTHANC_DISABLE_PATCH ON) # No need for the "patch" command-line tool set(ENABLE_LOCALE ON) # Enable support for locales (notably in Boost) set(USE_BOOST_ICONV ON) + +if (NOT "${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase") + # The "patch" command-line tool is only needed for Boost and LSB + set(ORTHANC_DISABLE_PATCH ON) +endif() + include(CheckFunctionExists) +include(CheckIncludeFile) +include(CheckIncludeFileCXX) include(CheckIncludeFiles) -include(CheckIncludeFileCXX) include(CheckLibraryExists) include(FindPythonInterp) include(${ORTHANC_ROOT}/Resources/CMake/Compiler.cmake) @@ -61,6 +67,7 @@ include(${ORTHANC_ROOT}/Resources/CMake/LibIconvConfiguration.cmake) include(${ORTHANC_ROOT}/Resources/CMake/ZlibConfiguration.cmake) include(${ORTHANC_ROOT}/Resources/CMake/PugixmlConfiguration.cmake) +include(${ORTHANC_ROOT}/Resources/CMake/UuidConfiguration.cmake) include(${CMAKE_SOURCE_DIR}/Resources/CMake/GdcmConfiguration.cmake) @@ -106,12 +113,14 @@ add_definitions( - -DORTHANC_ENABLE_LOCALE=1 - -DORTHANC_ENABLE_MD5=0 + -DHAS_ORTHANC_EXCEPTION=1 + -DORTHANC_DEFAULT_DICOM_ENCODING=Encoding_Latin1 -DORTHANC_ENABLE_BASE64=0 + -DORTHANC_ENABLE_LOCALE=1 -DORTHANC_ENABLE_LOGGING=0 + -DORTHANC_ENABLE_MD5=0 + -DORTHANC_ENABLE_PUGIXML=1 -DORTHANC_SANDBOXED=0 - -DHAS_ORTHANC_EXCEPTION=1 ) include_directories(${ORTHANC_ROOT}/Core) # To access "OrthancException.h" @@ -120,8 +129,9 @@ ${BOOST_SOURCES} ${JSONCPP_SOURCES} ${LIBICONV_SOURCES} + ${PUGIXML_SOURCES} + ${UUID_SOURCES} ${ZLIB_SOURCES} - ${PUGIXML_SOURCES} ${ORTHANC_ROOT}/Core/ChunkedBuffer.cpp ${ORTHANC_ROOT}/Core/Enumerations.cpp @@ -166,7 +176,7 @@ add_executable(UnitTests ${CORE_SOURCES} - ${GTEST_SOURCES} + ${GOOGLE_TEST_SOURCES} ${CMAKE_SOURCE_DIR}/Plugin/DicomWebServers.cpp UnitTestsSources/UnitTestsMain.cpp )
--- a/NEWS Tue Jan 02 09:48:00 2018 +0100 +++ b/NEWS Thu Jan 04 09:48:02 2018 +0100 @@ -4,6 +4,8 @@ * Added "?expand" argument to "/servers" route * Fix generation of numeric tags part of sequences for ".../metadata" routes * Support for OpenBSD +* Support for Linux Standard Base +* Upgrade to GDCM 2.8.4 for static builds Version 0.4 (2017-07-19)
--- a/Orthanc/Core/ChunkedBuffer.cpp Tue Jan 02 09:48:00 2018 +0100 +++ b/Orthanc/Core/ChunkedBuffer.cpp Thu Jan 04 09:48:02 2018 +0100 @@ -2,7 +2,7 @@ * Orthanc - A Lightweight, RESTful DICOM Store * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics * Department, University Hospital of Liege, Belgium - * Copyright (C) 2017 Osimis, Belgium + * Copyright (C) 2017-2018 Osimis S.A., Belgium * * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as
--- a/Orthanc/Core/ChunkedBuffer.h Tue Jan 02 09:48:00 2018 +0100 +++ b/Orthanc/Core/ChunkedBuffer.h Thu Jan 04 09:48:02 2018 +0100 @@ -2,7 +2,7 @@ * Orthanc - A Lightweight, RESTful DICOM Store * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics * Department, University Hospital of Liege, Belgium - * Copyright (C) 2017 Osimis, Belgium + * Copyright (C) 2017-2018 Osimis S.A., Belgium * * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as
--- a/Orthanc/Core/Enumerations.cpp Tue Jan 02 09:48:00 2018 +0100 +++ b/Orthanc/Core/Enumerations.cpp Thu Jan 04 09:48:02 2018 +0100 @@ -2,7 +2,7 @@ * Orthanc - A Lightweight, RESTful DICOM Store * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics * Department, University Hospital of Liege, Belgium - * Copyright (C) 2017 Osimis, Belgium + * Copyright (C) 2017-2018 Osimis S.A., Belgium * * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -38,6 +38,7 @@ #include "Toolbox.h" #include "Logging.h" +#include <boost/thread/mutex.hpp> #include <string.h> #include <cassert> @@ -752,12 +753,128 @@ case PixelFormat_Float32: return "Grayscale (float 32bpp)"; + case PixelFormat_Grayscale32: + return "Grayscale (unsigned 32bpp)"; + + case PixelFormat_RGB48: + return "RGB48"; + default: throw OrthancException(ErrorCode_ParameterOutOfRange); } } + const char* EnumerationToString(ModalityManufacturer manufacturer) + { + switch (manufacturer) + { + case ModalityManufacturer_Generic: + return "Generic"; + + case ModalityManufacturer_GenericNoWildcardInDates: + return "GenericNoWildcardInDates"; + + case ModalityManufacturer_GenericNoUniversalWildcard: + return "GenericNoUniversalWildcard"; + + case ModalityManufacturer_StoreScp: + return "StoreScp"; + + case ModalityManufacturer_ClearCanvas: + return "ClearCanvas"; + + case ModalityManufacturer_Dcm4Chee: + return "Dcm4Chee"; + + case ModalityManufacturer_Vitrea: + return "Vitrea"; + + default: + throw OrthancException(ErrorCode_ParameterOutOfRange); + } + } + + + const char* EnumerationToString(DicomRequestType type) + { + switch (type) + { + case DicomRequestType_Echo: + return "Echo"; + break; + + case DicomRequestType_Find: + return "Find"; + break; + + case DicomRequestType_Get: + return "Get"; + break; + + case DicomRequestType_Move: + return "Move"; + break; + + case DicomRequestType_Store: + return "Store"; + break; + + default: + throw OrthancException(ErrorCode_ParameterOutOfRange); + } + } + + + const char* EnumerationToString(TransferSyntax syntax) + { + switch (syntax) + { + case TransferSyntax_Deflated: + return "Deflated"; + + case TransferSyntax_Jpeg: + return "JPEG"; + + case TransferSyntax_Jpeg2000: + return "JPEG2000"; + + case TransferSyntax_JpegLossless: + return "JPEG Lossless"; + + case TransferSyntax_Jpip: + return "JPIP"; + + case TransferSyntax_Mpeg2: + return "MPEG2"; + + case TransferSyntax_Rle: + return "RLE"; + + default: + throw OrthancException(ErrorCode_ParameterOutOfRange); + } + } + + + const char* EnumerationToString(DicomVersion version) + { + switch (version) + { + case DicomVersion_2008: + return "2008"; + break; + + case DicomVersion_2017c: + return "2017c"; + break; + + default: + throw OrthancException(ErrorCode_ParameterOutOfRange); + } + } + + Encoding StringToEncoding(const char* encoding) { std::string s(encoding); @@ -1127,6 +1244,86 @@ } + ModalityManufacturer StringToModalityManufacturer(const std::string& manufacturer) + { + ModalityManufacturer result; + bool obsolete = false; + + if (manufacturer == "Generic") + { + return ModalityManufacturer_Generic; + } + else if (manufacturer == "GenericNoWildcardInDates") + { + return ModalityManufacturer_GenericNoWildcardInDates; + } + else if (manufacturer == "GenericNoUniversalWildcard") + { + return ModalityManufacturer_GenericNoUniversalWildcard; + } + else if (manufacturer == "ClearCanvas") + { + return ModalityManufacturer_ClearCanvas; + } + else if (manufacturer == "StoreScp") + { + return ModalityManufacturer_StoreScp; + } + else if (manufacturer == "Dcm4Chee") + { + return ModalityManufacturer_Dcm4Chee; + } + else if (manufacturer == "Vitrea") + { + return ModalityManufacturer_Vitrea; + } + else if (manufacturer == "AgfaImpax" || + manufacturer == "SyngoVia") + { + result = ModalityManufacturer_GenericNoWildcardInDates; + obsolete = true; + } + else if (manufacturer == "EFilm2" || + manufacturer == "MedInria") + { + result = ModalityManufacturer_Generic; + obsolete = true; + } + else + { + throw OrthancException(ErrorCode_ParameterOutOfRange); + } + + if (obsolete) + { + LOG(WARNING) << "The \"" << manufacturer << "\" manufacturer is obsolete since " + << "Orthanc 1.3.0. To guarantee compatibility with future Orthanc " + << "releases, you should replace it by \"" + << EnumerationToString(result) + << "\" in your configuration file."; + } + + return result; + } + + + DicomVersion StringToDicomVersion(const std::string& version) + { + if (version == "2008") + { + return DicomVersion_2008; + } + else if (version == "2017c") + { + return DicomVersion_2017c; + } + else + { + throw OrthancException(ErrorCode_ParameterOutOfRange); + } + } + + unsigned int GetBytesPerPixel(PixelFormat format) { switch (format) @@ -1143,12 +1340,16 @@ case PixelFormat_RGBA32: case PixelFormat_BGRA32: + case PixelFormat_Grayscale32: return 4; case PixelFormat_Float32: assert(sizeof(float) == 4); return 4; + case PixelFormat_RGB48: + return 6; + default: throw OrthancException(ErrorCode_ParameterOutOfRange); } @@ -1225,8 +1426,15 @@ { encoding = Encoding_Japanese; } - else if (s == "GB18030") + else if (s == "GB18030" || s == "GBK") { + /** + * According to tumashu@163.com, "In China, many dicom file's + * 0008,0005 tag is set as "GBK", instead of "GB18030", GBK is a + * subset of GB18030, and which is used frequently in China, + * suggest support it." + * https://groups.google.com/d/msg/orthanc-users/WMM8LMbjpUc/02-1f_yFCgAJ + **/ encoding = Encoding_Chinese; } /* @@ -1475,5 +1683,28 @@ default: throw OrthancException(ErrorCode_ParameterOutOfRange); } + } + + + static boost::mutex defaultEncodingMutex_; // Should not be necessary + static Encoding defaultEncoding_ = ORTHANC_DEFAULT_DICOM_ENCODING; + + Encoding GetDefaultDicomEncoding() + { + boost::mutex::scoped_lock lock(defaultEncodingMutex_); + return defaultEncoding_; } + + void SetDefaultDicomEncoding(Encoding encoding) + { + std::string name = EnumerationToString(encoding); + + { + boost::mutex::scoped_lock lock(defaultEncodingMutex_); + defaultEncoding_ = encoding; + } + + LOG(INFO) << "Default encoding for DICOM was changed to: " << name; + } + }
--- a/Orthanc/Core/Enumerations.h Tue Jan 02 09:48:00 2018 +0100 +++ b/Orthanc/Core/Enumerations.h Thu Jan 04 09:48:02 2018 +0100 @@ -2,7 +2,7 @@ * Orthanc - A Lightweight, RESTful DICOM Store * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics * Department, University Hospital of Liege, Belgium - * Copyright (C) 2017 Osimis, Belgium + * Copyright (C) 2017-2018 Osimis S.A., Belgium * * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -199,8 +199,21 @@ **/ PixelFormat_Float32 = 6, - // This is the memory layout for Cairo - PixelFormat_BGRA32 = 7 + // This is the memory layout for Cairo (for internal use in Stone of Orthanc) + PixelFormat_BGRA32 = 7, + + /** + * {summary}{Graylevel, unsigned 32bpp image.} + * {description}{The image is graylevel. Each pixel is unsigned and stored in 4 bytes.} + **/ + PixelFormat_Grayscale32 = 8, + + /** + * {summary}{Color image in RGB48 format.} + * {description}{This format describes a color image. The pixels are stored in 6 + * consecutive bytes. The memory layout is RGB.} + **/ + PixelFormat_RGB48 = 9 }; @@ -443,6 +456,81 @@ ValueRepresentation_NotSupported // Not supported by Orthanc, or tag not in dictionary }; + enum DicomReplaceMode + { + DicomReplaceMode_InsertIfAbsent, + DicomReplaceMode_ThrowIfAbsent, + DicomReplaceMode_IgnoreIfAbsent + }; + + enum DicomToJsonFormat + { + DicomToJsonFormat_Full, + DicomToJsonFormat_Short, + DicomToJsonFormat_Human + }; + + enum DicomToJsonFlags + { + DicomToJsonFlags_IncludeBinary = (1 << 0), + DicomToJsonFlags_IncludePrivateTags = (1 << 1), + DicomToJsonFlags_IncludeUnknownTags = (1 << 2), + DicomToJsonFlags_IncludePixelData = (1 << 3), + DicomToJsonFlags_ConvertBinaryToAscii = (1 << 4), + DicomToJsonFlags_ConvertBinaryToNull = (1 << 5), + + // Some predefined combinations + DicomToJsonFlags_None = 0, + DicomToJsonFlags_Default = (DicomToJsonFlags_IncludeBinary | + DicomToJsonFlags_IncludePixelData | + DicomToJsonFlags_IncludePrivateTags | + DicomToJsonFlags_IncludeUnknownTags | + DicomToJsonFlags_ConvertBinaryToNull) + }; + + enum DicomFromJsonFlags + { + DicomFromJsonFlags_DecodeDataUriScheme = (1 << 0), + DicomFromJsonFlags_GenerateIdentifiers = (1 << 1) + }; + + enum DicomVersion + { + DicomVersion_2008, + DicomVersion_2017c + }; + + enum ModalityManufacturer + { + ModalityManufacturer_Generic, + ModalityManufacturer_GenericNoWildcardInDates, + ModalityManufacturer_GenericNoUniversalWildcard, + ModalityManufacturer_StoreScp, + ModalityManufacturer_ClearCanvas, + ModalityManufacturer_Dcm4Chee, + ModalityManufacturer_Vitrea + }; + + enum DicomRequestType + { + DicomRequestType_Echo, + DicomRequestType_Find, + DicomRequestType_Get, + DicomRequestType_Move, + DicomRequestType_Store + }; + + enum TransferSyntax + { + TransferSyntax_Deflated, + TransferSyntax_Jpeg, + TransferSyntax_Jpeg2000, + TransferSyntax_JpegLossless, + TransferSyntax_Jpip, + TransferSyntax_Mpeg2, + TransferSyntax_Rle + }; + /** * WARNING: Do not change the explicit values in the enumerations @@ -513,6 +601,14 @@ const char* EnumerationToString(PixelFormat format); + const char* EnumerationToString(ModalityManufacturer manufacturer); + + const char* EnumerationToString(DicomRequestType type); + + const char* EnumerationToString(TransferSyntax syntax); + + const char* EnumerationToString(DicomVersion version); + Encoding StringToEncoding(const char* encoding); ResourceType StringToResourceType(const char* type); @@ -525,6 +621,10 @@ bool throwIfUnsupported); PhotometricInterpretation StringToPhotometricInterpretation(const char* value); + + ModalityManufacturer StringToModalityManufacturer(const std::string& manufacturer); + + DicomVersion StringToDicomVersion(const std::string& version); unsigned int GetBytesPerPixel(PixelFormat format); @@ -544,4 +644,8 @@ bool IsUserContentType(FileContentType type); bool IsBinaryValueRepresentation(ValueRepresentation vr); + + Encoding GetDefaultDicomEncoding(); + + void SetDefaultDicomEncoding(Encoding encoding); }
--- a/Orthanc/Core/Logging.h Tue Jan 02 09:48:00 2018 +0100 +++ b/Orthanc/Core/Logging.h Thu Jan 04 09:48:02 2018 +0100 @@ -2,7 +2,7 @@ * Orthanc - A Lightweight, RESTful DICOM Store * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics * Department, University Hospital of Liege, Belgium - * Copyright (C) 2017 Osimis, Belgium + * Copyright (C) 2017-2018 Osimis S.A., Belgium * * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as
--- a/Orthanc/Core/OrthancException.h Tue Jan 02 09:48:00 2018 +0100 +++ b/Orthanc/Core/OrthancException.h Thu Jan 04 09:48:02 2018 +0100 @@ -2,7 +2,7 @@ * Orthanc - A Lightweight, RESTful DICOM Store * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics * Department, University Hospital of Liege, Belgium - * Copyright (C) 2017 Osimis, Belgium + * Copyright (C) 2017-2018 Osimis S.A., Belgium * * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as
--- a/Orthanc/Core/PrecompiledHeaders.h Tue Jan 02 09:48:00 2018 +0100 +++ b/Orthanc/Core/PrecompiledHeaders.h Thu Jan 04 09:48:02 2018 +0100 @@ -2,7 +2,7 @@ * Orthanc - A Lightweight, RESTful DICOM Store * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics * Department, University Hospital of Liege, Belgium - * Copyright (C) 2017 Osimis, Belgium + * Copyright (C) 2017-2018 Osimis S.A., Belgium * * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -50,7 +50,7 @@ #include <json/value.h> #if ORTHANC_ENABLE_PUGIXML == 1 -#include <pugixml.hpp> +# include <pugixml.hpp> #endif #include "Enumerations.h" @@ -58,4 +58,21 @@ #include "OrthancException.h" #include "Toolbox.h" +#if ORTHANC_ENABLE_DCMTK == 1 +# include "DicomParsing/ParsedDicomFile.h" + +// Headers from DCMTK used in Orthanc headers +# include <dcmtk/dcmdata/dcdatset.h> +# include <dcmtk/dcmdata/dcfilefo.h> +# include <dcmtk/dcmdata/dcmetinf.h> +# include <dcmtk/dcmdata/dcpixseq.h> #endif + +#if ORTHANC_ENABLE_DCMTK_NETWORKING == 1 +# include "DicomNetworking/DicomServer.h" + +// Headers from DCMTK used in Orthanc headers +# include <dcmtk/dcmnet/dimse.h> +#endif + +#endif
--- a/Orthanc/Core/SystemToolbox.cpp Tue Jan 02 09:48:00 2018 +0100 +++ b/Orthanc/Core/SystemToolbox.cpp Thu Jan 04 09:48:02 2018 +0100 @@ -2,7 +2,7 @@ * Orthanc - A Lightweight, RESTful DICOM Store * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics * Department, University Hospital of Liege, Belgium - * Copyright (C) 2017 Osimis, Belgium + * Copyright (C) 2017-2018 Osimis S.A., Belgium * * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as
--- a/Orthanc/Core/SystemToolbox.h Tue Jan 02 09:48:00 2018 +0100 +++ b/Orthanc/Core/SystemToolbox.h Thu Jan 04 09:48:02 2018 +0100 @@ -2,7 +2,7 @@ * Orthanc - A Lightweight, RESTful DICOM Store * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics * Department, University Hospital of Liege, Belgium - * Copyright (C) 2017 Osimis, Belgium + * Copyright (C) 2017-2018 Osimis S.A., Belgium * * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as
--- a/Orthanc/Core/Toolbox.cpp Tue Jan 02 09:48:00 2018 +0100 +++ b/Orthanc/Core/Toolbox.cpp Thu Jan 04 09:48:02 2018 +0100 @@ -2,7 +2,7 @@ * Orthanc - A Lightweight, RESTful DICOM Store * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics * Department, University Hospital of Liege, Belgium - * Copyright (C) 2017 Osimis, Belgium + * Copyright (C) 2017-2018 Osimis S.A., Belgium * * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -397,6 +397,7 @@ #endif +#if ORTHANC_ENABLE_LOCALE == 1 static const char* GetBoostLocaleEncoding(const Encoding sourceEncoding) { switch (sourceEncoding) @@ -463,6 +464,7 @@ throw OrthancException(ErrorCode_NotImplemented); } } +#endif #if ORTHANC_ENABLE_LOCALE == 1 @@ -532,7 +534,7 @@ for (size_t i = 0; i < size; i++, p++) { - if (*p > 127 || (*p != 0 && iscntrl(*p))) + if (*p > 127 || *p == 0 || iscntrl(*p)) { return false; } @@ -542,6 +544,12 @@ } + bool Toolbox::IsAsciiString(const std::string& s) + { + return IsAsciiString(s.c_str(), s.size()); + } + + std::string Toolbox::ConvertToAscii(const std::string& source) { std::string result;
--- a/Orthanc/Core/Toolbox.h Tue Jan 02 09:48:00 2018 +0100 +++ b/Orthanc/Core/Toolbox.h Thu Jan 04 09:48:02 2018 +0100 @@ -2,7 +2,7 @@ * Orthanc - A Lightweight, RESTful DICOM Store * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics * Department, University Hospital of Liege, Belgium - * Copyright (C) 2017 Osimis, Belgium + * Copyright (C) 2017-2018 Osimis S.A., Belgium * * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -152,6 +152,8 @@ bool IsAsciiString(const void* data, size_t size); + bool IsAsciiString(const std::string& s); + std::string ConvertToAscii(const std::string& source); std::string StripSpaces(const std::string& source);
--- a/Orthanc/Core/WebServiceParameters.cpp Tue Jan 02 09:48:00 2018 +0100 +++ b/Orthanc/Core/WebServiceParameters.cpp Thu Jan 04 09:48:02 2018 +0100 @@ -2,7 +2,7 @@ * Orthanc - A Lightweight, RESTful DICOM Store * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics * Department, University Hospital of Liege, Belgium - * Copyright (C) 2017 Osimis, Belgium + * Copyright (C) 2017-2018 Osimis S.A., Belgium * * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as
--- a/Orthanc/Core/WebServiceParameters.h Tue Jan 02 09:48:00 2018 +0100 +++ b/Orthanc/Core/WebServiceParameters.h Thu Jan 04 09:48:02 2018 +0100 @@ -2,7 +2,7 @@ * Orthanc - A Lightweight, RESTful DICOM Store * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics * Department, University Hospital of Liege, Belgium - * Copyright (C) 2017 Osimis, Belgium + * Copyright (C) 2017-2018 Osimis S.A., Belgium * * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as
--- a/Orthanc/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp Tue Jan 02 09:48:00 2018 +0100 +++ b/Orthanc/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp Thu Jan 04 09:48:02 2018 +0100 @@ -2,7 +2,7 @@ * Orthanc - A Lightweight, RESTful DICOM Store * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics * Department, University Hospital of Liege, Belgium - * Copyright (C) 2017 Osimis, Belgium + * Copyright (C) 2017-2018 Osimis S.A., Belgium * * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as
--- a/Orthanc/Plugins/Samples/Common/OrthancPluginCppWrapper.h Tue Jan 02 09:48:00 2018 +0100 +++ b/Orthanc/Plugins/Samples/Common/OrthancPluginCppWrapper.h Thu Jan 04 09:48:02 2018 +0100 @@ -2,7 +2,7 @@ * Orthanc - A Lightweight, RESTful DICOM Store * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics * Department, University Hospital of Liege, Belgium - * Copyright (C) 2017 Osimis, Belgium + * Copyright (C) 2017-2018 Osimis S.A., Belgium * * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -44,13 +44,15 @@ +#if !defined(ORTHANC_PLUGINS_VERSION_IS_ABOVE) #define ORTHANC_PLUGINS_VERSION_IS_ABOVE(major, minor, revision) \ (ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER > major || \ (ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER == major && \ (ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER > minor || \ (ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER == minor && \ ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER >= revision)))) - +#endif + #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 2, 0) // The "OrthancPluginFindMatcher()" primitive was introduced in Orthanc 1.2.0
--- a/Orthanc/Plugins/Samples/Common/OrthancPluginException.h Tue Jan 02 09:48:00 2018 +0100 +++ b/Orthanc/Plugins/Samples/Common/OrthancPluginException.h Thu Jan 04 09:48:02 2018 +0100 @@ -2,7 +2,7 @@ * Orthanc - A Lightweight, RESTful DICOM Store * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics * Department, University Hospital of Liege, Belgium - * Copyright (C) 2017 Osimis, Belgium + * Copyright (C) 2017-2018 Osimis S.A., Belgium * * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as
--- a/Orthanc/Resources/CMake/BoostConfiguration.cmake Tue Jan 02 09:48:00 2018 +0100 +++ b/Orthanc/Resources/CMake/BoostConfiguration.cmake Thu Jan 04 09:48:02 2018 +0100 @@ -41,12 +41,18 @@ ## Parameters for static compilation of Boost ## - set(BOOST_NAME boost_1_64_0) - set(BOOST_BCP_SUFFIX bcpdigest-1.3.0) - set(BOOST_MD5 "ecb266cf46adcc7f695ad12685871174") + set(BOOST_NAME boost_1_65_1) + set(BOOST_BCP_SUFFIX bcpdigest-1.3.1) + set(BOOST_MD5 "92c9c603e56bbd7a450a305f08747d90") set(BOOST_URL "http://www.orthanc-server.com/downloads/third-party/${BOOST_NAME}_${BOOST_BCP_SUFFIX}.tar.gz") set(BOOST_SOURCES_DIR ${CMAKE_BINARY_DIR}/${BOOST_NAME}) + if (IS_DIRECTORY "${BOOST_SOURCES_DIR}") + set(FirstRun OFF) + else() + set(FirstRun ON) + endif() + DownloadPackage(${BOOST_MD5} ${BOOST_URL} "${BOOST_SOURCES_DIR}") @@ -78,7 +84,22 @@ ${BOOST_SOURCES_DIR}/libs/system/src/error_code.cpp ) + if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase") + add_definitions(-DBOOST_SYSTEM_USE_STRERROR=1) + + execute_process( + COMMAND ${PATCH_EXECUTABLE} -p0 -N -i + ${ORTHANC_ROOT}/Resources/Patches/boost-1.65.1-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() + + ## ## Configuration of boost::thread ## @@ -199,13 +220,29 @@ ${BOOST_SOURCES_DIR}/libs/locale/src/util/locale_data.cpp ) - 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 "PNaCl" OR - CMAKE_SYSTEM_NAME STREQUAL "NaCl32" OR - CMAKE_SYSTEM_NAME STREQUAL "NaCl64") + if (CMAKE_SYSTEM_NAME STREQUAL "OpenBSD" OR + CMAKE_SYSTEM_VERSION STREQUAL "LinuxStandardBase") + list(APPEND BOOST_SOURCES + ${BOOST_SOURCES_DIR}/libs/locale/src/std/codecvt.cpp + ${BOOST_SOURCES_DIR}/libs/locale/src/std/collate.cpp + ${BOOST_SOURCES_DIR}/libs/locale/src/std/converter.cpp + ${BOOST_SOURCES_DIR}/libs/locale/src/std/numeric.cpp + ${BOOST_SOURCES_DIR}/libs/locale/src/std/std_backend.cpp + ) + + add_definitions( + -DBOOST_LOCALE_WITH_ICONV=1 + -DBOOST_LOCALE_NO_WINAPI_BACKEND=1 + -DBOOST_LOCALE_NO_POSIX_BACKEND=1 + ) + + elseif (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 "PNaCl" OR + CMAKE_SYSTEM_NAME STREQUAL "NaCl32" OR + CMAKE_SYSTEM_NAME STREQUAL "NaCl64") list(APPEND BOOST_SOURCES ${BOOST_SOURCES_DIR}/libs/locale/src/posix/codecvt.cpp ${BOOST_SOURCES_DIR}/libs/locale/src/posix/collate.cpp @@ -220,21 +257,6 @@ -DBOOST_LOCALE_NO_STD_BACKEND=1 ) - elseif (CMAKE_SYSTEM_NAME STREQUAL "OpenBSD") - list(APPEND BOOST_SOURCES - ${BOOST_SOURCES_DIR}/libs/locale/src/std/codecvt.cpp - ${BOOST_SOURCES_DIR}/libs/locale/src/std/collate.cpp - ${BOOST_SOURCES_DIR}/libs/locale/src/std/converter.cpp - ${BOOST_SOURCES_DIR}/libs/locale/src/std/numeric.cpp - ${BOOST_SOURCES_DIR}/libs/locale/src/std/std_backend.cpp - ) - - add_definitions( - -DBOOST_LOCALE_WITH_ICONV=1 - -DBOOST_LOCALE_NO_WINAPI_BACKEND=1 - -DBOOST_LOCALE_NO_POSIX_BACKEND=1 - ) - elseif (CMAKE_SYSTEM_NAME STREQUAL "Windows") list(APPEND BOOST_SOURCES ${BOOST_SOURCES_DIR}/libs/locale/src/win32/collate.cpp
--- a/Orthanc/Resources/CMake/Compiler.cmake Tue Jan 02 09:48:00 2018 +0100 +++ b/Orthanc/Resources/CMake/Compiler.cmake Thu Jan 04 09:48:02 2018 +0100 @@ -1,6 +1,7 @@ # This file sets all the compiler-related flags -if (CMAKE_CROSSCOMPILING) +if (CMAKE_CROSSCOMPILING OR + "${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase") # Cross-compilation necessarily implies standalone and static build SET(STATIC_BUILD ON) SET(STANDALONE_BUILD ON) @@ -87,7 +88,7 @@ # Remove the "-rdynamic" option # http://www.mail-archive.com/cmake@cmake.org/msg08837.html set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "") - link_libraries(uuid pthread) + link_libraries(pthread) if (NOT ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD") link_libraries(rt) @@ -117,11 +118,6 @@ ) endif() - CHECK_INCLUDE_FILES(uuid/uuid.h HAVE_UUID_H) - if (NOT HAVE_UUID_H) - message(FATAL_ERROR "Please install the uuid-dev package (or e2fsprogs if OpenBSD)") - endif() - elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") if (MSVC) message("MSVC compiler version = " ${MSVC_VERSION} "\n") @@ -174,23 +170,14 @@ ) link_libraries(iconv) - CHECK_INCLUDE_FILES(uuid/uuid.h HAVE_UUID_H) - if (NOT HAVE_UUID_H) - message(FATAL_ERROR "Please install the uuid-dev package") - endif() +elseif (CMAKE_SYSTEM_NAME STREQUAL "Emscripten") + message("Building using Emscripten (for WebAssembly or asm.js targets)") else() message(FATAL_ERROR "Support your platform here") endif() -if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase") - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --lsb-target-version=${LSB_TARGET_VERSION} -I${LSB_PATH}/include") - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --lsb-target-version=${LSB_TARGET_VERSION} -nostdinc++ -I${LSB_PATH}/include -I${LSB_PATH}/include/c++ -I${LSB_PATH}/include/c++/backward -fpermissive") - SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --lsb-target-version=${LSB_TARGET_VERSION} -L${LSB_LIBPATH}") -endif() - - if (DEFINED ENABLE_PROFILING AND ENABLE_PROFILING) if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug") message(WARNING "Enabling profiling on a non-debug build will not produce full information") @@ -208,6 +195,21 @@ endif() +if (CMAKE_COMPILER_IS_GNUCXX) + # "When creating a static library using binutils (ar) and there + # exist a duplicate object name (e.g. a/Foo.cpp.o, b/Foo.cpp.o), the + # resulting static library can end up having only one of the + # duplicate objects. [...] This bug only happens if there are many + # objects." The trick consists in replacing the "r" argument + # ("replace") provided to "ar" (as used in CMake < 3.1) by the "q" + # argument ("quick append"). This is because of the fact that CMake + # will invoke "ar" several times with several batches of ".o" + # objects, and using "r" would overwrite symbols defined in + # 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()
--- a/Orthanc/Resources/CMake/GoogleTestConfiguration.cmake Tue Jan 02 09:48:00 2018 +0100 +++ b/Orthanc/Resources/CMake/GoogleTestConfiguration.cmake Thu Jan 04 09:48:02 2018 +0100 @@ -1,5 +1,5 @@ -if (USE_GTEST_DEBIAN_SOURCE_PACKAGE) - find_path(GTEST_DEBIAN_SOURCES_DIR +if (USE_GOOGLE_TEST_DEBIAN_PACKAGE) + find_path(GOOGLE_TEST_DEBIAN_SOURCES_DIR NAMES src/gtest-all.cc PATHS /usr/src/gtest @@ -7,52 +7,61 @@ PATH_SUFFIXES src ) - find_path(GTEST_DEBIAN_INCLUDE_DIR + find_path(GOOGLE_TEST_DEBIAN_INCLUDE_DIR NAMES gtest.h PATHS /usr/include/gtest ) - message("Path to the Debian Google Test sources: ${GTEST_DEBIAN_SOURCES_DIR}") - message("Path to the Debian Google Test includes: ${GTEST_DEBIAN_INCLUDE_DIR}") + message("Path to the Debian Google Test sources: ${GOOGLE_TEST_DEBIAN_SOURCES_DIR}") + message("Path to the Debian Google Test includes: ${GOOGLE_TEST_DEBIAN_INCLUDE_DIR}") - set(GTEST_SOURCES ${GTEST_DEBIAN_SOURCES_DIR}/src/gtest-all.cc) - include_directories(${GTEST_DEBIAN_SOURCES_DIR}) + set(GOOGLE_TEST_SOURCES + ${GOOGLE_TEST_DEBIAN_SOURCES_DIR}/src/gtest-all.cc + ) - if (NOT EXISTS ${GTEST_SOURCES} OR - NOT EXISTS ${GTEST_DEBIAN_INCLUDE_DIR}/gtest.h) + include_directories(${GOOGLE_TEST_DEBIAN_SOURCES_DIR}) + + if (NOT EXISTS ${GOOGLE_TEST_SOURCES} OR + NOT EXISTS ${GOOGLE_TEST_DEBIAN_INCLUDE_DIR}/gtest.h) message(FATAL_ERROR "Please install the libgtest-dev package") endif() elseif (STATIC_BUILD OR NOT USE_SYSTEM_GOOGLE_TEST) - set(GTEST_SOURCES_DIR ${CMAKE_BINARY_DIR}/gtest-1.7.0) - set(GTEST_URL "http://www.orthanc-server.com/downloads/third-party/gtest-1.7.0.zip") - set(GTEST_MD5 "2d6ec8ccdf5c46b05ba54a9fd1d130d7") + set(GOOGLE_TEST_SOURCES_DIR ${CMAKE_BINARY_DIR}/gtest-1.7.0) + set(GOOGLE_TEST_URL "http://www.orthanc-server.com/downloads/third-party/gtest-1.7.0.zip") + set(GOOGLE_TEST_MD5 "2d6ec8ccdf5c46b05ba54a9fd1d130d7") - DownloadPackage(${GTEST_MD5} ${GTEST_URL} "${GTEST_SOURCES_DIR}") + DownloadPackage(${GOOGLE_TEST_MD5} ${GOOGLE_TEST_URL} "${GOOGLE_TEST_SOURCES_DIR}") include_directories( - ${GTEST_SOURCES_DIR}/include - ${GTEST_SOURCES_DIR} + ${GOOGLE_TEST_SOURCES_DIR}/include + ${GOOGLE_TEST_SOURCES_DIR} ) - set(GTEST_SOURCES - ${GTEST_SOURCES_DIR}/src/gtest-all.cc + set(GOOGLE_TEST_SOURCES + ${GOOGLE_TEST_SOURCES_DIR}/src/gtest-all.cc ) # https://code.google.com/p/googletest/issues/detail?id=412 if (MSVC) # VS2012 does not support tuples correctly yet add_definitions(/D _VARIADIC_MAX=10) endif() - - source_group(ThirdParty\\GoogleTest REGULAR_EXPRESSION ${GTEST_SOURCES_DIR}/.*) + + if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase") + add_definitions(-DGTEST_HAS_CLONE=0) + endif() + + source_group(ThirdParty\\GoogleTest REGULAR_EXPRESSION ${GOOGLE_TEST_SOURCES_DIR}/.*) else() include(FindGTest) - if (NOT GTEST_FOUND) + if (NOT GOOGLE_TEST_FOUND) message(FATAL_ERROR "Unable to find GoogleTest") endif() - include_directories(${GTEST_INCLUDE_DIRS}) - link_libraries(${GTEST_LIBRARIES}) + include_directories(${GOOGLE_TEST_INCLUDE_DIRS}) + + # The variable GOOGLE_TEST_LIBRARIES contains the shared library of + # Google Test endif()
--- a/Orthanc/Resources/CMake/JsonCppConfiguration.cmake Tue Jan 02 09:48:00 2018 +0100 +++ b/Orthanc/Resources/CMake/JsonCppConfiguration.cmake Thu Jan 04 09:48:02 2018 +0100 @@ -48,9 +48,10 @@ JSONCPP_VERSION_MAJOR ${JSONCPP_VERSION_MAJOR1}) message("JsonCpp major version: ${JSONCPP_VERSION_MAJOR}") - if (CMAKE_COMPILER_IS_GNUCXX AND + if ((CMAKE_COMPILER_IS_GNUCXX OR + "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") AND JSONCPP_VERSION_MAJOR GREATER 0) - message("Switching to C++11 standard, as version of JsonCpp is >= 1.0.0") + message("Switching to C++11 standard in gcc/clang, as version of JsonCpp is >= 1.0.0") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wno-deprecated-declarations") endif() else()
--- a/Orthanc/Resources/CMake/PugixmlConfiguration.cmake Tue Jan 02 09:48:00 2018 +0100 +++ b/Orthanc/Resources/CMake/PugixmlConfiguration.cmake Thu Jan 04 09:48:02 2018 +0100 @@ -1,33 +1,26 @@ -if (USE_PUGIXML) - add_definitions(-DORTHANC_ENABLE_PUGIXML=1) +if (STATIC_BUILD OR NOT USE_SYSTEM_PUGIXML) + set(PUGIXML_SOURCES_DIR ${CMAKE_BINARY_DIR}/pugixml-1.4) + set(PUGIXML_MD5 "7c56c91cfe3ecdee248a8e4892ef5781") + set(PUGIXML_URL "http://www.orthanc-server.com/downloads/third-party/pugixml-1.4.tar.gz") - if (STATIC_BUILD OR NOT USE_SYSTEM_PUGIXML) - set(PUGIXML_SOURCES_DIR ${CMAKE_BINARY_DIR}/pugixml-1.4) - set(PUGIXML_MD5 "7c56c91cfe3ecdee248a8e4892ef5781") - set(PUGIXML_URL "http://www.orthanc-server.com/downloads/third-party/pugixml-1.4.tar.gz") - - DownloadPackage(${PUGIXML_MD5} ${PUGIXML_URL} "${PUGIXML_SOURCES_DIR}") - - include_directories( - ${PUGIXML_SOURCES_DIR}/src - ) + DownloadPackage(${PUGIXML_MD5} ${PUGIXML_URL} "${PUGIXML_SOURCES_DIR}") - set(PUGIXML_SOURCES - #${PUGIXML_SOURCES_DIR}/src/vlog_is_on.cc - ${PUGIXML_SOURCES_DIR}/src/pugixml.cpp - ) + include_directories( + ${PUGIXML_SOURCES_DIR}/src + ) - else() - 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() + set(PUGIXML_SOURCES + #${PUGIXML_SOURCES_DIR}/src/vlog_is_on.cc + ${PUGIXML_SOURCES_DIR}/src/pugixml.cpp + ) source_group(ThirdParty\\pugixml REGULAR_EXPRESSION ${PUGIXML_SOURCES_DIR}/.*) else() - add_definitions(-DORTHANC_ENABLE_PUGIXML=0) + 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()
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Orthanc/Resources/CMake/UuidConfiguration.cmake Thu Jan 04 09:48:02 2018 +0100 @@ -0,0 +1,94 @@ +if (NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows") + + if (STATIC_BUILD OR NOT USE_SYSTEM_UUID) + SET(E2FSPROGS_SOURCES_DIR ${CMAKE_BINARY_DIR}/e2fsprogs-1.43.8) + SET(E2FSPROGS_URL "http://www.orthanc-server.com/downloads/third-party/e2fsprogs-1.43.8.tar.gz") + SET(E2FSPROGS_MD5 "670b7a74a8ead5333acf21b9afc92b3c") + + DownloadPackage(${E2FSPROGS_MD5} ${E2FSPROGS_URL} "${E2FSPROGS_SOURCES_DIR}") + + include_directories( + ${E2FSPROGS_SOURCES_DIR}/lib + ) + + set(UUID_SOURCES + #${E2FSPROGS_SOURCES_DIR}/lib/uuid/tst_uuid.c + #${E2FSPROGS_SOURCES_DIR}/lib/uuid/uuid_time.c + ${E2FSPROGS_SOURCES_DIR}/lib/uuid/clear.c + ${E2FSPROGS_SOURCES_DIR}/lib/uuid/compare.c + ${E2FSPROGS_SOURCES_DIR}/lib/uuid/copy.c + ${E2FSPROGS_SOURCES_DIR}/lib/uuid/gen_uuid.c + ${E2FSPROGS_SOURCES_DIR}/lib/uuid/isnull.c + ${E2FSPROGS_SOURCES_DIR}/lib/uuid/pack.c + ${E2FSPROGS_SOURCES_DIR}/lib/uuid/parse.c + ${E2FSPROGS_SOURCES_DIR}/lib/uuid/unpack.c + ${E2FSPROGS_SOURCES_DIR}/lib/uuid/unparse.c + ) + + check_include_file("net/if.h" HAVE_NET_IF_H) + check_include_file("net/if_dl.h" HAVE_NET_IF_DL_H) + check_include_file("netinet/in.h" HAVE_NETINET_IN_H) + check_include_file("stdlib.h" HAVE_STDLIB_H) + check_include_file("sys/file.h" HAVE_SYS_FILE_H) + check_include_file("sys/ioctl.h" HAVE_SYS_IOCTL_H) + check_include_file("sys/resource.h" HAVE_SYS_RESOURCE_H) + check_include_file("sys/socket.h" HAVE_SYS_SOCKET_H) + check_include_file("sys/sockio.h" HAVE_SYS_SOCKIO_H) + check_include_file("sys/syscall.h" HAVE_SYS_SYSCALL_H) + check_include_file("sys/time.h" HAVE_SYS_TIME_H) + check_include_file("sys/un.h" HAVE_SYS_UN_H) + check_include_file("unistd.h" HAVE_UNISTD_H) + + file(WRITE ${E2FSPROGS_SOURCES_DIR}/lib/uuid/config.h.cmake " +#cmakedefine HAVE_NET_IF_H \@HAVE_NET_IF_H\@ +#cmakedefine HAVE_NET_IF_DL_H \@HAVE_NET_IF_DL_H\@ +#cmakedefine HAVE_NETINET_IN_H \@HAVE_NETINET_IN_H\@ +#cmakedefine HAVE_STDLIB_H \@HAVE_STDLIB_H \@ +#cmakedefine HAVE_SYS_FILE_H \@HAVE_SYS_FILE_H\@ +#cmakedefine HAVE_SYS_IOCTL_H \@HAVE_SYS_IOCTL_H\@ +#cmakedefine HAVE_SYS_RESOURCE_H \@HAVE_SYS_RESOURCE_H\@ +#cmakedefine HAVE_SYS_SOCKET_H \@HAVE_SYS_SOCKET_H\@ +#cmakedefine HAVE_SYS_SOCKIO_H \@HAVE_SYS_SOCKIO_H\@ +#cmakedefine HAVE_SYS_SYSCALL_H \@HAVE_SYS_SYSCALL_H\@ +#cmakedefine HAVE_SYS_TIME_H \@HAVE_SYS_TIME_H\@ +#cmakedefine HAVE_SYS_UN_H \@HAVE_SYS_UN_H\@ +#cmakedefine HAVE_UNISTD_H \@HAVE_UNISTD_H\@ +") + + configure_file( + ${E2FSPROGS_SOURCES_DIR}/lib/uuid/config.h.cmake + ${E2FSPROGS_SOURCES_DIR}/lib/uuid/config.h + ) + + + configure_file( + ${E2FSPROGS_SOURCES_DIR}/lib/uuid/uuid.h.in + ${E2FSPROGS_SOURCES_DIR}/lib/uuid/uuid.h + ) + + file(WRITE + ${E2FSPROGS_SOURCES_DIR}/lib/uuid/uuid_types.h + "#include <stdint.h>\n") + + #configure_file( + # ${E2FSPROGS_SOURCES_DIR}/lib/uuid/uuid_types.h.in + # ${E2FSPROGS_SOURCES_DIR}/lib/uuid/uuid_types.h + # ) + + source_group(ThirdParty\\uuid REGULAR_EXPRESSION ${E2FSPROGS_SOURCES_DIR}/.*) + + else() + CHECK_INCLUDE_FILE(uuid/uuid.h HAVE_UUID_H) + if (NOT HAVE_UUID_H) + message(FATAL_ERROR "Please install uuid-dev, e2fsprogs (OpenBSD) or e2fsprogs-libuuid (FreeBSD)") + endif() + + check_library_exists(uuid uuid_generate_random "" HAVE_UUID_LIB) + if (NOT HAVE_UUID_LIB) + message(FATAL_ERROR "Unable to find the uuid library") + endif() + + link_libraries(uuid) + endif() + +endif()
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Orthanc/Resources/LinuxStandardBaseToolchain.cmake Thu Jan 04 09:48:02 2018 +0100 @@ -0,0 +1,66 @@ +# LSB_CC=gcc-4.8 LSB_CXX=g++-4.8 cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=../Resources/LinuxStandardBaseToolchain.cmake + +INCLUDE(CMakeForceCompiler) + +SET(LSB_PATH $ENV{LSB_PATH}) +SET(LSB_CC $ENV{LSB_CC}) +SET(LSB_CXX $ENV{LSB_CXX}) +SET(LSB_TARGET_VERSION "4.0") + +IF ("${LSB_PATH}" STREQUAL "") + SET(LSB_PATH "/opt/lsb") +ENDIF() + +IF (EXISTS ${LSB_PATH}/lib64) + SET(LSB_TARGET_PROCESSOR "x86_64") + SET(LSB_LIBPATH ${LSB_PATH}/lib64-${LSB_TARGET_VERSION}) +ELSEIF (EXISTS ${LSB_PATH}/lib) + SET(LSB_TARGET_PROCESSOR "x86") + SET(LSB_LIBPATH ${LSB_PATH}/lib-${LSB_TARGET_VERSION}) +ELSE() + MESSAGE(FATAL_ERROR "Unable to detect the target processor architecture. Check the LSB_PATH environment variable.") +ENDIF() + +SET(LSB_CPPPATH ${LSB_PATH}/include) +SET(PKG_CONFIG_PATH ${LSB_LIBPATH}/pkgconfig/) + +# the name of the target operating system +SET(CMAKE_SYSTEM_NAME Linux) +SET(CMAKE_SYSTEM_VERSION LinuxStandardBase) +SET(CMAKE_SYSTEM_PROCESSOR ${LSB_TARGET_PROCESSOR}) + +# which compilers to use for C and C++ +SET(CMAKE_C_COMPILER ${LSB_PATH}/bin/lsbcc) +CMAKE_FORCE_CXX_COMPILER(${LSB_PATH}/bin/lsbc++ GNU) + +# here is the target environment located +SET(CMAKE_FIND_ROOT_PATH ${LSB_PATH}) + +# adjust the default behaviour of the FIND_XXX() commands: +# search headers and libraries in the target environment, search +# programs in the host environment +SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER) +SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE NEVER) + +SET(CMAKE_CROSSCOMPILING OFF) + + +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --lsb-target-version=${LSB_TARGET_VERSION} -I${LSB_PATH}/include" CACHE INTERNAL "" FORCE) +SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --lsb-target-version=${LSB_TARGET_VERSION} -nostdinc++ -I${LSB_PATH}/include -I${LSB_PATH}/include/c++ -I${LSB_PATH}/include/c++/backward" CACHE INTERNAL "" FORCE) +SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --lsb-target-version=${LSB_TARGET_VERSION} -L${LSB_LIBPATH} --lsb-besteffort" CACHE INTERNAL "" FORCE) +SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --lsb-target-version=${LSB_TARGET_VERSION} -L${LSB_LIBPATH} --lsb-besteffort" CACHE INTERNAL "" FORCE) + +if (NOT "${LSB_CXX}" STREQUAL "") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --lsb-cxx=${LSB_CXX}") + SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --lsb-cxx=${LSB_CXX}") + SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --lsb-cxx=${LSB_CXX}") +endif() + +if (NOT "${LSB_CC}" STREQUAL "") + SET(CMAKE_C_FLAGS "${CMAKE_CC_FLAGS} --lsb-cc=${LSB_CC}") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --lsb-cc=${LSB_CC}") + SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --lsb-cc=${LSB_CC}") + SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --lsb-cc=${LSB_CC}") +endif() +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Orthanc/Resources/Patches/boost-1.65.1-linux-standard-base.patch Thu Jan 04 09:48:02 2018 +0100 @@ -0,0 +1,12 @@ +diff -urEb boost_1_65_1.orig/boost/move/adl_move_swap.hpp boost_1_65_1/boost/move/adl_move_swap.hpp +--- boost_1_65_1.orig/boost/move/adl_move_swap.hpp 2017-11-08 17:43:20.000000000 +0100 ++++ boost_1_65_1/boost/move/adl_move_swap.hpp 2018-01-02 15:34:48.829052917 +0100 +@@ -28,6 +28,8 @@ + //Try to avoid including <algorithm>, as it's quite big + #if defined(_MSC_VER) && defined(BOOST_DINKUMWARE_STDLIB) + #include <utility> //Dinkum libraries define std::swap in utility which is lighter than algorithm ++#elif defined(__LSB_VERSION__) ++# include <utility> + #elif defined(BOOST_GNU_STDLIB) + //For non-GCC compilers, where GNUC version is not very reliable, or old GCC versions + //use the good old stl_algobase header, which is quite lightweight
--- a/Orthanc/Resources/WindowsResources.py Tue Jan 02 09:48:00 2018 +0100 +++ b/Orthanc/Resources/WindowsResources.py Thu Jan 04 09:48:02 2018 +0100 @@ -3,7 +3,7 @@ # Orthanc - A Lightweight, RESTful DICOM Store # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics # Department, University Hospital of Liege, Belgium -# Copyright (C) 2017 Osimis, Belgium +# Copyright (C) 2017-2018 Osimis S.A., Belgium # # This program is free software: you can redistribute it and/or # modify it under the terms of the GNU General Public License as
--- a/Resources/BuildInstructions.txt Tue Jan 02 09:48:00 2018 +0100 +++ b/Resources/BuildInstructions.txt Thu Jan 04 09:48:02 2018 +0100 @@ -3,7 +3,7 @@ # mkdir Build # cd Build -# cmake .. -DCMAKE_BUILD_TYPE=Debug -DALLOW_DOWNLOADS=ON -DSTATIC_BUILD=ON +# cmake .. -DCMAKE_BUILD_TYPE=Debug -DSTATIC_BUILD=ON # make @@ -12,7 +12,7 @@ # mkdir Build # cd Build -# cmake .. -DCMAKE_BUILD_TYPE=Debug -DUSE_GTEST_DEBIAN_SOURCE_PACKAGE=ON +# cmake .. -DCMAKE_BUILD_TYPE=Debug -DUSE_GOOGLE_TEST_DEBIAN_PACKAGE=ON -DUSE_SYSTEM_ORTHANC_SDK=OFF # make @@ -25,7 +25,7 @@ -DALLOW_DOWNLOADS=ON \ -DUSE_SYSTEM_JSONCPP=OFF \ -DUSE_SYSTEM_PUGIXML=OFF \ - -DUSE_GTEST_DEBIAN_SOURCE_PACKAGE=ON + -DUSE_GOOGLE_TEST_DEBIAN_SOURCE_PACKAGE=ON # make
--- a/Resources/CMake/GdcmConfiguration.cmake Tue Jan 02 09:48:00 2018 +0100 +++ b/Resources/CMake/GdcmConfiguration.cmake Thu Jan 04 09:48:02 2018 +0100 @@ -18,11 +18,11 @@ if (STATIC_BUILD OR NOT USE_SYSTEM_GDCM) - # If using gcc, build GDCM with the "-fPIC" argument to allow its - # embedding into the shared library containing the Orthanc plugin if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" OR ${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD") + # If using gcc, build GDCM with the "-fPIC" argument to allow its + # embedding into the shared library containing the Orthanc plugin set(AdditionalFlags "-fPIC") elseif (${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD") # This definition is necessary to compile @@ -47,13 +47,37 @@ list(APPEND Flags -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}) endif() + # Don't build manpages (since gdcm 2.8.4) + list(APPEND Flags -DGDCM_BUILD_DOCBOOK_MANPAGES=OFF) + + if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase") + # Trick to disable the compilation of socket++ by gdcm, which is + # incompatible with LSB, but fortunately only required for DICOM + # Networking + list(APPEND Flags -DGDCM_USE_SYSTEM_SOCKETXX=ON) + + # Detect the number of CPU cores to run "make" with as much + # parallelism as possible + include(ProcessorCount) + ProcessorCount(N) + if (NOT N EQUAL 0) + set(MAKE_PARALLEL -j${N}) + endif() + + # For Linux Standard Base, avoid building incompatible target gdcmMEXD (*) + set(BUILD_COMMAND BUILD_COMMAND + ${CMAKE_MAKE_PROGRAM} ${MAKE_PARALLEL} + gdcmMSFF gdcmcharls gdcmDICT gdcmDSED gdcmIOD gdcmjpeg8 + gdcmjpeg12 gdcmjpeg16 gdcmopenjp2 gdcmzlib gdcmCommon gdcmexpat) + endif() + include(ExternalProject) externalproject_add(GDCM - URL "http://www.orthanc-server.com/downloads/third-party/gdcm-2.6.0.tar.gz" - URL_MD5 "978afe57af448b1c97c9f116790aca9c" + URL "http://www.orthanc-server.com/downloads/third-party/gdcm-2.8.4.tar.gz" + URL_MD5 "ce957b0bc1be4e8019162a10ca15432f" TIMEOUT 60 CMAKE_ARGS -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} ${Flags} - #-DLIBRARY_OUTPUT_PATH=${CMAKE_CURRENT_BINARY_DIR} + ${BUILD_COMMAND} # Customize "make", only for Linux Standard Base (*) INSTALL_COMMAND "" # Skip the install step ) @@ -65,7 +89,8 @@ list(GET CMAKE_FIND_LIBRARY_PREFIXES 0 Prefix) endif() - set(GDCM_LIBRARIES + set(GDCM_LIBRARIES + # WARNING: The order of the libraries below *is* important! ${Prefix}gdcmMSFF${Suffix} ${Prefix}gdcmcharls${Suffix} ${Prefix}gdcmDICT${Suffix} @@ -74,26 +99,17 @@ ${Prefix}gdcmjpeg8${Suffix} ${Prefix}gdcmjpeg12${Suffix} ${Prefix}gdcmjpeg16${Suffix} - ${Prefix}gdcmMEXD${Suffix} - ${Prefix}gdcmopenjpeg${Suffix} + ${Prefix}gdcmopenjp2${Suffix} ${Prefix}gdcmzlib${Suffix} - ${Prefix}socketxx${Suffix} ${Prefix}gdcmCommon${Suffix} ${Prefix}gdcmexpat${Suffix} + ${Prefix}gdcmuuid${Suffix} + #${Prefix}socketxx${Suffix} + #${Prefix}gdcmMEXD${Suffix} # DICOM Networking, unneeded by Orthanc plugins #${Prefix}gdcmgetopt${Suffix} ) - if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") - list(APPEND GDCM_LIBRARIES - rpcrt4 # For UUID stuff - ) - else() - list(APPEND GDCM_LIBRARIES - ${Prefix}gdcmuuid${Suffix} - ) - endif() - ExternalProject_Get_Property(GDCM binary_dir) include_directories(${binary_dir}/Source/Common) link_directories(${binary_dir}/bin)
--- a/Resources/SyncOrthancFolder.py Tue Jan 02 09:48:00 2018 +0100 +++ b/Resources/SyncOrthancFolder.py Thu Jan 04 09:48:02 2018 +0100 @@ -41,10 +41,13 @@ 'Resources/CMake/JsonCppConfiguration.cmake', 'Resources/CMake/LibIconvConfiguration.cmake', 'Resources/CMake/PugixmlConfiguration.cmake', + 'Resources/CMake/UuidConfiguration.cmake', 'Resources/CMake/ZlibConfiguration.cmake', 'Resources/MinGW-W64-Toolchain32.cmake', 'Resources/MinGW-W64-Toolchain64.cmake', 'Resources/MinGWToolchain.cmake', + 'Resources/LinuxStandardBaseToolchain.cmake', + 'Resources/Patches/boost-1.65.1-linux-standard-base.patch', 'Resources/ThirdParty/VisualStudio/stdint.h', 'Resources/WindowsResources.py', 'Resources/WindowsResources.rc',