changeset 5962:cb76465d0245

DCMTK now uses its own "oficonv" library for character set conversion
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 16 Jan 2025 17:58:50 +0100
parents 92a5f2f655b6
children 49d5b3382ff9
files NEWS OrthancFramework/Resources/CMake/DcmtkConfigurationStatic-3.6.9.cmake OrthancFramework/Resources/CMake/OrthancFrameworkConfiguration.cmake OrthancFramework/Resources/CMake/OrthancFrameworkParameters.cmake
diffstat 4 files changed, 18 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS	Thu Jan 16 17:11:27 2025 +0100
+++ b/NEWS	Thu Jan 16 17:58:50 2025 +0100
@@ -32,6 +32,8 @@
   in the series.
 * optimized /archive to use the "ExtendedFind" extension and reduce the number of
   SQL queries.
+* By default, DCMTK now uses its own "oficonv" library for character set conversion.
+  This can be tuned using the new CMake option "-DDCMTK_LOCALE_BACKEND=oficonv"
 * Upgraded dependencies for static builds:
   - dcmtk 3.6.9
 
--- a/OrthancFramework/Resources/CMake/DcmtkConfigurationStatic-3.6.9.cmake	Thu Jan 16 17:11:27 2025 +0100
+++ b/OrthancFramework/Resources/CMake/DcmtkConfigurationStatic-3.6.9.cmake	Thu Jan 16 17:58:50 2025 +0100
@@ -190,15 +190,17 @@
 
 
 # "DCMTK_ENABLE_CHARSET_CONVERSION" is defined by "osconfig.h.in"
-if (NOT DEFINED BOOST_LOCALE_BACKEND OR   # This is the case if locale support is disabled (e.g. in Stone)
-    BOOST_LOCALE_BACKEND STREQUAL "gcc")
+if (NOT DEFINED DCMTK_LOCALE_BACKEND OR   # This is the case if locale support is disabled (e.g. in Stone)
+    DCMTK_LOCALE_BACKEND STREQUAL "gcc")
   set(DCMTK_ENABLE_CHARSET_CONVERSION "DCMTK_CHARSET_CONVERSION_STDLIBC_ICONV" CACHE STRING "" FORCE)
-elseif (BOOST_LOCALE_BACKEND STREQUAL "libiconv")
+elseif (DCMTK_LOCALE_BACKEND STREQUAL "libiconv")
   set(DCMTK_ENABLE_CHARSET_CONVERSION "DCMTK_CHARSET_CONVERSION_ICONV" CACHE STRING "" FORCE)
-elseif (BOOST_LOCALE_BACKEND STREQUAL "icu")
-  set(DCMTK_ENABLE_CHARSET_CONVERSION "DCMTK_CHARSET_CONVERSION_ICU" CACHE STRING "" FORCE)
+elseif (DCMTK_LOCALE_BACKEND STREQUAL "icu")
+  message(FATAL_ERROR "Support for ICU has been removed since DCMTK 3.6.9")
+elseif (DCMTK_LOCALE_BACKEND STREQUAL "oficonv")
+  set(DCMTK_ENABLE_CHARSET_CONVERSION "DCMTK_CHARSET_CONVERSION_OFICONV" CACHE STRING "" FORCE)
 else()
-  message(FATAL_ERROR "Invalid value for BOOST_LOCALE_BACKEND: ${BOOST_LOCALE_BACKEND}")
+  message(FATAL_ERROR "Invalid value for DCMTK_LOCALE_BACKEND: ${DCMTK_LOCALE_BACKEND}")
 endif()
 
 CONFIGURE_FILE(
@@ -284,3 +286,8 @@
       )
   endif()
 endif()
+
+
+if (DCMTK_LOCALE_BACKEND STREQUAL "oficonv")
+  AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/oficonv/libsrc DCMTK_SOURCES)
+endif()
--- a/OrthancFramework/Resources/CMake/OrthancFrameworkConfiguration.cmake	Thu Jan 16 17:11:27 2025 +0100
+++ b/OrthancFramework/Resources/CMake/OrthancFrameworkConfiguration.cmake	Thu Jan 16 17:58:50 2025 +0100
@@ -456,7 +456,8 @@
     # is shipped with the stdlib
     unset(BOOST_LOCALE_BACKEND CACHE)
   else()
-    if (BOOST_LOCALE_BACKEND STREQUAL "gcc")
+    if (BOOST_LOCALE_BACKEND STREQUAL "gcc" OR
+        BOOST_LOCALE_BACKEND STREQUAL "oficonv")
     elseif (BOOST_LOCALE_BACKEND STREQUAL "libiconv")
       include(${CMAKE_CURRENT_LIST_DIR}/LibIconvConfiguration.cmake)
     elseif (BOOST_LOCALE_BACKEND STREQUAL "icu")
--- a/OrthancFramework/Resources/CMake/OrthancFrameworkParameters.cmake	Thu Jan 16 17:11:27 2025 +0100
+++ b/OrthancFramework/Resources/CMake/OrthancFrameworkParameters.cmake	Thu Jan 16 17:58:50 2025 +0100
@@ -90,6 +90,7 @@
 set(USE_GOOGLE_TEST_DEBIAN_PACKAGE OFF CACHE BOOL "Use the sources of Google Test shipped with libgtest-dev (Debian only)")
 set(SYSTEM_MONGOOSE_USE_CALLBACKS ON CACHE BOOL "The system version of Mongoose uses callbacks (version >= 3.7)")
 set(BOOST_LOCALE_BACKEND "libiconv" CACHE STRING "Back-end for locales that is used by Boost (can be \"gcc\", \"libiconv\", \"icu\", or \"wconv\" on Windows)")
+set(DCMTK_LOCALE_BACKEND "oficonv" CACHE STRING "Back-end for locales that is used by DCMTK (can be \"gcc\", \"libiconv\", \"icu\" (only up to DCMTK 3.6.8), \"oficonv\")")
 set(USE_PUGIXML ON CACHE BOOL "Use the Pugixml parser (turn off only for debug)")
 set(USE_LEGACY_JSONCPP OFF CACHE BOOL "Use the old branch 0.x.y of JsonCpp, that does not require a C++11 compiler (for LSB and old versions of Visual Studio)")
 set(USE_LEGACY_LIBICU OFF CACHE BOOL "Use icu icu4c-58_2, latest version not requiring a C++11 compiler (for LSB and old versions of Visual Studio)")