Skip to content

Commit

Permalink
(#15883) dcmtk: add 3.6.7 + update deps + small improvements
Browse files Browse the repository at this point in the history
* dcmtk: add 3.6.7 + update deps + small improvements

* dcmtk: remove pkgconfig files

* dcmtk: add patch_descriptions
  • Loading branch information
Croydon authored Mar 21, 2023
1 parent 25f80f8 commit 5a5ef5c
Show file tree
Hide file tree
Showing 4 changed files with 248 additions and 18 deletions.
12 changes: 12 additions & 0 deletions recipes/dcmtk/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
sources:
"3.6.7":
url: "https://dicom.offis.de/download/dcmtk/dcmtk367/dcmtk-3.6.7.tar.gz"
sha256: "7c58298e3e8d60232ee6fc8408cfadd14463cc11a3c4ca4c59af5988c7e9710a"
"3.6.6":
url: "https://dicom.offis.de/download/dcmtk/dcmtk366/dcmtk-3.6.6.tar.gz"
sha256: "6859c62b290ee55677093cccfd6029c04186d91cf99c7642ae43627387f3458e"
"3.6.5":
url: "https://dicom.offis.de/download/dcmtk/dcmtk365/dcmtk-3.6.5.tar.gz"
sha256: "a05178665f21896dbb0974106dba1ad144975414abd760b4cf8f5cc979f9beb9"
patches:
"3.6.7":
- patch_file: "patches/cmake-patching-3-6-7.patch"
base_path: "source_subfolder"
patch_type: conan
patch_description: "Don't ignore dependencies that can't be found; patch some variable names"
"3.6.6":
- patch_file: "patches/0002-cmake-use-conan-packages.patch"
base_path: "source_subfolder"
patch_type: conan
patch_description: "Don't ignore dependencies that can't be found; patch some variable names"
"3.6.5":
- patch_file: "patches/0001-cmake-use-conan-packages.patch"
base_path: "source_subfolder"
patch_type: conan
patch_description: "Don't ignore dependencies that can't be found; patch some variable names"
36 changes: 18 additions & 18 deletions recipes/dcmtk/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from conan.errors import ConanInvalidConfiguration
from conan.tools.build import cross_building
from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, rmdir, save
from conan.tools.microsoft import msvc_runtime_flag
from conan.tools.microsoft import is_msvc, msvc_runtime_flag
from conan.tools.scm import Version
import functools
import os
Expand All @@ -18,7 +18,7 @@ class DCMTKConan(ConanFile):
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://dicom.offis.de/dcmtk"
license = "BSD-3-Clause"
topics = ("dcmtk", "dicom", "image")
topics = ("dicom", "image")

settings = "os", "arch", "compiler", "build_type"
options = {
Expand Down Expand Up @@ -68,42 +68,38 @@ def _source_subfolder(self):
def _build_subfolder(self):
return "build_subfolder"

@property
def _is_msvc(self):
return str(self.settings.compiler) in ["Visual Studio", "msvc"]

def export_sources(self):
self.copy("CMakeLists.txt")
export_conandata_patches(self)

def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC
del self.options.with_tcpwrappers
self.options.rm_safe("fPIC")
self.options.rm_safe("with_tcpwrappers")

def configure(self):
if self.options.shared:
del self.options.fPIC
self.options.rm_safe("fPIC")

def requirements(self):
if self.options.charset_conversion == "libiconv":
self.requires("libiconv/1.16")
self.requires("libiconv/1.17")
elif self.options.charset_conversion == "icu":
self.requires("icu/71.1")
self.requires("icu/72.1")
if self.options.with_libxml2:
self.requires("libxml2/2.9.13")
self.requires("libxml2/2.10.3")
if self.options.with_zlib:
self.requires("zlib/1.2.12")
self.requires("zlib/1.2.13")
if self.options.with_openssl:
if self.settings.os == "Windows":
# FIXME: CMake configuration fails to detect Openssl 1.1 on Windows.
self.requires("openssl/1.0.2u")
else:
self.requires("openssl/1.1.1n")
self.requires("openssl/1.1.1t")
if self.options.with_libpng:
self.requires("libpng/1.6.37")
self.requires("libpng/1.6.39")
if self.options.with_libtiff:
self.requires("libtiff/4.3.0")
self.requires("libtiff/4.4.0")
if self.options.get_safe("with_tcpwrappers"):
self.requires("tcp-wrappers/7.6")

Expand Down Expand Up @@ -162,7 +158,10 @@ def _configure_cmake(self):

cmake.definitions["DCMTK_ENABLE_PRIVATE_TAGS"] = self.options.builtin_private_tags
if self.options.external_dictionary is not None:
cmake.definitions["DCMTK_ENABLE_EXTERNAL_DICTIONARY"] = self.options.external_dictionary
if Version(self.version) < "3.6.7":
cmake.definitions["DCMTK_ENABLE_EXTERNAL_DICTIONARY"] = self.options.external_dictionary
else:
cmake.definitions["DCMTK_DEFAULT_DICT"] = self.options.external_dictionary
if self.options.builtin_dictionary is not None:
cmake.definitions["DCMTK_ENABLE_BUILTIN_DICTIONARY"] = self.options.builtin_dictionary
cmake.definitions["DCMTK_WIDE_CHAR_FILE_IO_FUNCTIONS"] = self.options.wide_io
Expand All @@ -171,7 +170,7 @@ def _configure_cmake(self):
if self.settings.os == "Windows":
cmake.definitions["DCMTK_OVERWRITE_WIN32_COMPILER_FLAGS"] = False

if self._is_msvc:
if is_msvc(self):
cmake.definitions["DCMTK_ICONV_FLAGS_ANALYZED"] = True
cmake.definitions["DCMTK_COMPILE_WIN32_MULTITHREADED_DLL"] = "MD" in msvc_runtime_flag(self)

Expand All @@ -191,6 +190,7 @@ def package(self):

rmdir(self, os.path.join(self.package_folder, "cmake"))
rmdir(self, os.path.join(self.package_folder, "lib", "cmake"))
rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig"))
rmdir(self, os.path.join(self.package_folder, "etc"))
rmdir(self, os.path.join(self.package_folder, "share"))

Expand Down
216 changes: 216 additions & 0 deletions recipes/dcmtk/all/patches/cmake-patching-3-6-7.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,216 @@
--- CMake/3rdparty.cmake
+++ CMake/3rdparty.cmake
@@ -21,7 +21,7 @@ mark_as_advanced(DCMTK_USE_FIND_PACKAGE)
if(DCMTK_USE_FIND_PACKAGE)
# Find TIFF
if(DCMTK_WITH_TIFF)
- find_package(TIFF QUIET)
+ find_package(TIFF REQUIRED)
# turn off library if it could not be found
if(NOT TIFF_FOUND)
message(STATUS "Warning: TIFF support will be disabled because libtiff was not found.")
@@ -30,21 +30,21 @@ if(DCMTK_USE_FIND_PACKAGE)
else()
set(WITH_LIBTIFF 1)
# libtiff can be compiled with libjpeg support; if available, add libjpeg to library and include path
- find_package(JPEG QUIET)
+ find_package(JPEG REQUIRED)
if(NOT JPEG_FOUND)
message(STATUS "Info: DCMTK TIFF support will be enabled (but without JPEG)")
- include_directories(${TIFF_INCLUDE_DIR})
+ include_directories(${TIFF_INCLUDE_DIRS})
else()
message(STATUS "Info: DCMTK TIFF support will be enabled")
- include_directories(${TIFF_INCLUDE_DIR} ${JPEG_INCLUDE_DIR})
+ include_directories(${TIFF_INCLUDE_DIRS} ${JPEG_INCLUDE_DIRS})
endif()
- set(LIBTIFF_LIBS ${TIFF_LIBRARY} ${TIFF_EXTRA_LIBS_STATIC} ${JPEG_LIBRARY})
+ set(LIBTIFF_LIBS ${TIFF_LIBRARIES} ${JPEG_LIBRARIES})
endif()
endif()

# Find PNG
if(DCMTK_WITH_PNG)
- find_package(PNG QUIET)
+ find_package(PNG REQUIRED)
if(NOT PNG_FOUND)
set(DCMTK_WITH_PNG OFF CACHE BOOL "" FORCE)
message(STATUS "Warning: PNG support will be disabled because libpng was not found.")
@@ -53,13 +53,13 @@ if(DCMTK_USE_FIND_PACKAGE)
message(STATUS "Info: DCMTK PNG support will be enabled")
set(WITH_LIBPNG 1)
include_directories(${PNG_INCLUDE_DIR})
- set(LIBPNG_LIBS ${PNG_LIBRARY})
+ set(LIBPNG_LIBS ${PNG_LIBRARIES})
endif()
endif()

# Find OpenSSL
if(DCMTK_WITH_OPENSSL)
- find_package(OpenSSL QUIET)
+ find_package(OpenSSL REQUIRED)
if(NOT OPENSSL_FOUND)
message(STATUS "Warning: OPENSSL support will be disabled because openssl was not found.")
set(WITH_OPENSSL "")
@@ -90,7 +90,7 @@ if(DCMTK_USE_FIND_PACKAGE)

# Find libXML2
if(DCMTK_WITH_XML)
- find_package(LibXml2 QUIET)
+ find_package(LibXml2 REQUIRED)
if(NOT LIBXML2_FOUND)
message(STATUS "Warning: XML support will be disabled because libxml2 was not found.")
set(WITH_LIBXML "")
@@ -105,7 +105,7 @@ if(DCMTK_USE_FIND_PACKAGE)

# Find zlib
if(DCMTK_WITH_ZLIB)
- find_package(ZLIB QUIET)
+ find_package(ZLIB REQUIRED)
if(NOT ZLIB_FOUND)
message(STATUS "Warning: ZLIB support will be disabled because zlib was not found.")
set(WITH_ZLIB "")
@@ -120,7 +120,7 @@ if(DCMTK_USE_FIND_PACKAGE)

# Find libsndfile
if(DCMTK_WITH_SNDFILE)
- find_package(SNDFILE QUIET)
+ find_package(SNDFILE REQUIRED)
if(NOT SNDFILE_LIBS)
message(STATUS "Warning: SNDFILE support will be disabled because libsndfile was not found.")
set(WITH_SNDFILE "")
@@ -135,9 +135,9 @@ if(DCMTK_USE_FIND_PACKAGE)

# Find libiconv
if(DCMTK_WITH_ICONV)
- find_package(Iconv QUIET)
- find_package(LIBCHARSET QUIET)
- if(ICONV_FOUND)
+ find_package(Iconv REQUIRED)
+ find_package(LIBCHARSET REQUIRED)
+ if(Iconv_FOUND)
if(NOT Iconv_IS_BUILT_IN)
set(LIBICONV_FOUND ${ICONV_FOUND})
else()
@@ -158,7 +158,7 @@ if(DCMTK_USE_FIND_PACKAGE)
set(WITH_LIBICONV 1)
set(LIBICONV_INCDIR ${LIBICONV_INCLUDE_DIRS} ${Iconv_INCLUDE_DIRS} ${ICONV_INCLUDE_DIR} ${LIBCHARSET_INCLUDE_DIRS})
set(LIBICONV_LIBDIR ${LIBICONV_LIBDIR})
- set(LIBICONV_LIBS ${LIBICONV_LIBRARIES} ${Iconv_LIBRARIES} ${ICONV_LIBRARIES} ${LIBCHARSET_LIBRARY})
+ set(LIBICONV_LIBS Iconv::Iconv)
include_directories(${LIBICONV_INCDIR})
endif()
endif()
@@ -241,13 +241,15 @@ else()
# libxml support: configure compiler
if(DCMTK_WITH_XML)
if(WITH_LIBXMLINC)
- set(LIBXML_INCDIR "${WITH_LIBXMLINC}/include")
- set(LIBXML_LIBDIR "${WITH_LIBXMLINC}/lib")
- set(LIBXML_LIBS debug "${LIBXML_LIBDIR}/libxml2_d.lib" optimized "${LIBXML_LIBDIR}/libxml2_o.lib" debug "${LIBXML_LIBDIR}/iconv_d.lib" optimized "${LIBXML_LIBDIR}/iconv_o.lib")
+ set(LIBXML_INCDIR ${CONAN_INCLUDE_DIRS_LIBXML2} ${CONAN_INCLUDE_DIRS_ICONV})
+ link_directories(${WITH_LIBXMLINC}/lib)
+ set(LIBXML_LIBS ${CONAN_LIBS_LIBXML2})
message(STATUS "Info: DCMTK XML support will be enabled")
set(WITH_LIBXML 1)
+ if(NOT WITH_LIBXML_SHARED)
# this hides some warnings that are emitted when linking against libxmlXXX.lib instead of linking the DLL directly
add_definitions("-DLIBXML_STATIC")
+ endif()
else() # turn off library if library path not set
message(STATUS "Warning: XML support will be disabled because libxml2 directory is not specified. Correct path and re-enable DCMTK_WITH_XML.")
set(DCMTK_WITH_XML OFF CACHE BOOL "" FORCE)
@@ -259,8 +261,8 @@ else()
if(DCMTK_WITH_PNG)
if(WITH_LIBPNGINC)
set(LIBPNG_INCDIR "${WITH_LIBPNGINC}/include")
- set(LIBPNG_LIBDIR "${WITH_LIBPNGINC}/lib")
- set(LIBPNG_LIBS debug "${LIBPNG_LIBDIR}/libpng_d.lib" optimized "${LIBPNG_LIBDIR}/libpng_o.lib")
+ link_directories(${WITH_LIBPNGINC}/lib)
+ set(LIBPNG_LIBS CONAN_PKG::libpng)
message(STATUS "Info: DCMTK PNG support will be enabled")
set(WITH_LIBPNG 1)
else() # turn off library if library path not set
@@ -274,8 +276,8 @@ else()
if(DCMTK_WITH_TIFF)
if(WITH_LIBTIFFINC)
set(LIBTIFF_INCDIR "${WITH_LIBTIFFINC}/include")
- set(LIBTIFF_LIBDIR "${WITH_LIBTIFFINC}/lib")
- set(LIBTIFF_LIBS debug "${LIBTIFF_LIBDIR}/libtiff_d.lib" optimized "${LIBTIFF_LIBDIR}/libtiff_o.lib")
+ link_directories(${WITH_LIBTIFFINC}/lib)
+ set(LIBTIFF_LIBS CONAN_PKG::libtiff)
message(STATUS "Info: DCMTK TIFF support will be enabled")
set(WITH_LIBTIFF 1)
else() # turn off library if library path not set
@@ -291,9 +293,9 @@ else()
include(CheckCXXSourceCompiles)
set(OPENSSL_BINDIR "${WITH_OPENSSLINC}/bin")
set(OPENSSL_INCDIR "${WITH_OPENSSLINC}/include")
- set(OPENSSL_LIBDIR "${WITH_OPENSSLINC}/lib")
+ link_directories(${WITH_OPENSSLINC}/lib)
# starting with OpenSSL 1.1.0, the Windows crypt32 library is needed for a static link of OpenSSL.
- set(OPENSSL_LIBS "crypt32" debug "${OPENSSL_LIBDIR}/dcmtkssl_d.lib" optimized "${OPENSSL_LIBDIR}/dcmtkssl_o.lib" debug "${OPENSSL_LIBDIR}/dcmtkcrypto_d.lib" optimized "${OPENSSL_LIBDIR}/dcmtkcrypto_o.lib")
+ set(OPENSSL_LIBS ${CONAN_LIBS_OPENSSL})
set(TEMP_INCLUDES "${CMAKE_REQUIRED_INCLUDES}")
list(APPEND CMAKE_REQUIRED_INCLUDES "${OPENSSL_INCDIR}")
CHECK_CXX_SOURCE_COMPILES("extern \"C\" {\n#include <openssl/ssl.h>\n}\nint main(){\n#if OPENSSL_VERSION_NUMBER < 0x10001000L\n#error OpenSSL too old\n#endif\n}\n" OPENSSL_VERSION_CHECK)
@@ -317,8 +319,8 @@ else()
if(DCMTK_WITH_ZLIB)
if(WITH_ZLIBINC)
set(ZLIB_INCDIR "${WITH_ZLIBINC}/include")
- set(ZLIB_LIBDIR "${WITH_ZLIBINC}/lib")
- set(ZLIB_LIBS debug "${ZLIB_LIBDIR}/zlib_d.lib" optimized "${ZLIB_LIBDIR}/zlib_o.lib")
+ link_directories(${WITH_ZLIBINC}/lib)
+ set(ZLIB_LIBS CONAN_PKG::zlib)
message(STATUS "Info: DCMTK ZLIB support will be enabled")
set(WITH_ZLIB 1)
else() # turn off library if library path not set
@@ -332,8 +334,8 @@ else()
if(DCMTK_WITH_SNDFILE)
if(WITH_SNDFILEINC)
set(SNDFILE_INCDIR "${WITH_SNDFILEINC}/include")
- set(SNDFILE_LIBDIR "${WITH_SNDFILEINC}/lib")
- set(SNDFILE_LIBS debug "${SNDFILE_LIBDIR}/libsndfile_d.lib" optimized "${SNDFILE_LIBDIR}/libsndfile_o.lib")
+ link_directories(${WITH_SNDFILEINC}/lib)
+ set(SNDFILE_LIBS CONAN_PKG::libsndfile)
message(STATUS "Info: DCMTK SNDFILE support will be enabled")
set(WITH_SNDFILE 1)
else() # turn off library if library path not set
@@ -347,8 +349,8 @@ else()
if(DCMTK_WITH_ICONV)
if(WITH_LIBICONVINC)
set(LIBICONV_INCDIR "${WITH_LIBICONVINC}/include")
- set(LIBICONV_LIBDIR "${WITH_LIBICONVINC}/lib")
- set(LIBICONV_LIBS debug "${LIBICONV_LIBDIR}/libiconv_d.lib" optimized "${LIBICONV_LIBDIR}/libiconv_o.lib")
+ link_directories(${WITH_LIBICONVINC}/lib)
+ set(LIBICONV_LIBS CONAN_PKG::libiconv)
message(STATUS "Info: DCMTK ICONV support will be enabled")
set(WITH_LIBICONV 1)
else() # turn off library if library path not set
@@ -371,7 +373,7 @@ else()
else()
set(OPENJPEG_INCDIR "${WITH_OPENJPEGINC1}")
set(OPENJPEG_LIBDIR "${WITH_OPENJPEGINC}/lib")
- set(OPENJPEG_LIBS debug "${OPENJPEG_LIBDIR}/openjp2_d.lib" optimized "${OPENJPEG_LIBDIR}/openjp2_o.lib")
+ set(OPENJPEG_LIBS CONAN_PKG::openjpeg)
message(STATUS "Info: DCMTK OpenJPEG support will be enabled")
set(WITH_OPENJPEG 1)
endif()
@@ -395,7 +397,7 @@ if(NOT DEFINED DCMTK_WITH_STDLIBC_ICONV)
endif()

if(DCMTK_WITH_ICU)
- find_package(ICU COMPONENTS uc data QUIET)
+ find_package(ICU COMPONENTS uc data REQUIRED)
if(NOT ICU_FOUND)
message(STATUS "Warning: ICU support will be disabled because the ICU were not found.")
set(DCMTK_WITH_ICU OFF CACHE BOOL "" FORCE)
@@ -411,7 +413,7 @@ endif()

# Find doxygen
if(DCMTK_WITH_DOXYGEN)
- find_package(Doxygen QUIET) # will set variable DOXYGEN_EXECUTABLE
+ find_package(Doxygen REQUIRED) # will set variable DOXYGEN_EXECUTABLE
if(NOT DOXYGEN_FOUND)
message(STATUS "Warning: DOXYGEN support will be disabled because doxygen was not found.")
set(DCMTK_WITH_DOXYGEN OFF CACHE BOOL "" FORCE)
2 changes: 2 additions & 0 deletions recipes/dcmtk/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
versions:
"3.6.7":
folder: "all"
"3.6.6":
folder: "all"
"3.6.5":
Expand Down

0 comments on commit 5a5ef5c

Please sign in to comment.