From 03b07e411c5f0b78d232e1e1fcfe54669d89c3dc Mon Sep 17 00:00:00 2001 From: Reinhold Gschweicher Date: Mon, 15 Sep 2025 11:27:26 +0200 Subject: [PATCH 1/3] TIFF: update to v4.7.0-p0 Unpinn OpenCV 4.10 because TIFF 4.7.0 fixes build issues on Linux. Fixes: https://github.com/cpp-pm/hunter/issues/765 Remove old `FindTIFF.cmake` module. Not needed anymore (and probably wasn't needed for a long time). Update to use https://github.com/cpp-pm/libtiff/releases/tag/v4.7.0-p0 hunterized dependencies: - `zlib`: default ON, only dependency available in previous 4.0.2 hunterized version) - `libdeflate`: default: ON, available in Hunter starting with `v0.26.3` https://github.com/cpp-pm/hunter/issues/804 - `jpeg`: default OFF, newly hunterized - `lzma`: default OFF, newly hunterized Not hunterized dependencies: - `jbig=OFF` - `lerc=OFF` - `webp=OFF` Fixes: https://github.com/cpp-pm/hunter/issues/789 --- cmake/configs/default.cmake | 12 ++----- cmake/find/FindTIFF.cmake | 62 -------------------------------- cmake/projects/TIFF/hunter.cmake | 31 ++++++++++++++++ examples/TIFF/CMakeLists.txt | 23 ++++-------- examples/TIFF/main.c | 6 +--- 5 files changed, 41 insertions(+), 93 deletions(-) delete mode 100644 cmake/find/FindTIFF.cmake diff --git a/cmake/configs/default.cmake b/cmake/configs/default.cmake index 82502a2ef1..58e6f50bf0 100644 --- a/cmake/configs/default.cmake +++ b/cmake/configs/default.cmake @@ -103,14 +103,8 @@ hunter_default_version(OpenBLAS VERSION 0.3.27) hunter_default_version(OpenCL VERSION 2022.01.04-p1) hunter_default_version(OpenCL-Headers VERSION 2022.01.04) hunter_default_version(OpenCL-cpp VERSION 2.0.16-61a5c9a-p0) -if(MSVC) - hunter_default_version(OpenCV VERSION 4.10.0-p0) - hunter_default_version(OpenCV-Extra VERSION 4.10.0) -else() - # 4.10.0 has a build problem with TIFF header defines - hunter_default_version(OpenCV VERSION 4.8.1-p0) - hunter_default_version(OpenCV-Extra VERSION 4.8.1) -endif() +hunter_default_version(OpenCV VERSION 4.10.0-p0) +hunter_default_version(OpenCV-Extra VERSION 4.10.0) hunter_default_version(OpenEXR VERSION 3.1.5-p0) hunter_default_version(OpenGL-Registry VERSION 0.0.0-d15191e-p0) hunter_default_version(OpenNMTTokenizer VERSION 1.11.0-p1) @@ -157,7 +151,7 @@ hunter_default_version(Sober VERSION 0.1.3) hunter_default_version(Sqlpp11 VERSION 0.57-p0) hunter_default_version(SuiteSparse VERSION 7.5.1-1) hunter_default_version(TCLAP VERSION 1.2.2-p1) -hunter_default_version(TIFF VERSION 4.0.2-p5) +hunter_default_version(TIFF VERSION 4.7.0-p0) hunter_default_version(Tesseract VERSION 3.05.01-hunter-3) hunter_default_version(Urho3D VERSION 1.7-p15) hunter_default_version(Vulkan-Headers VERSION 1.2.182-p0) diff --git a/cmake/find/FindTIFF.cmake b/cmake/find/FindTIFF.cmake deleted file mode 100644 index 5ba2bccf34..0000000000 --- a/cmake/find/FindTIFF.cmake +++ /dev/null @@ -1,62 +0,0 @@ -#.rst: -# FindTIFF -# -------- -# -# Find TIFF library -# -# Find the native TIFF includes and library This module defines -# -# :: -# -# TIFF_INCLUDE_DIR, where to find tiff.h, etc. -# TIFF_LIBRARIES, libraries to link against to use TIFF. -# TIFF_FOUND, If false, do not try to use TIFF. -# -# also defined, but not for general use are -# -# :: -# -# TIFF_LIBRARY, where to find the TIFF library. - -#============================================================================= -# Copyright 2002-2009 Kitware, Inc. -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= -# (To distribute this file outside of CMake, substitute the full -# License text for the above reference.) - -if(HUNTER_STATUS_DEBUG) - message("[hunter] Custom FindTIFF module") -endif() - -find_package(TIFF CONFIG REQUIRED) -set(TIFF_LIBRARY TIFF::libtiff) -set(TIFF_INCLUDE_DIR "${TIFF_ROOT}/include") - -if(TIFF_INCLUDE_DIR AND EXISTS "${TIFF_INCLUDE_DIR}/tiffvers.h") - file(STRINGS "${TIFF_INCLUDE_DIR}/tiffvers.h" tiff_version_str - REGEX "^#define[\t ]+TIFFLIB_VERSION_STR[\t ]+\"LIBTIFF, Version .*") - - string(REGEX REPLACE "^#define[\t ]+TIFFLIB_VERSION_STR[\t ]+\"LIBTIFF, Version +([^ \\n]*).*" - "\\1" TIFF_VERSION_STRING "${tiff_version_str}") - unset(tiff_version_str) -endif() - -# handle the QUIETLY and REQUIRED arguments and set TIFF_FOUND to TRUE if -# all listed variables are TRUE -include(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(TIFF - REQUIRED_VARS TIFF_LIBRARY TIFF_INCLUDE_DIR - VERSION_VAR TIFF_VERSION_STRING) - -if(TIFF_FOUND) - set( TIFF_LIBRARIES ${TIFF_LIBRARY} ) -endif() - -mark_as_advanced(TIFF_INCLUDE_DIR TIFF_LIBRARY) diff --git a/cmake/projects/TIFF/hunter.cmake b/cmake/projects/TIFF/hunter.cmake index 4d85dfc4f0..39419012ea 100644 --- a/cmake/projects/TIFF/hunter.cmake +++ b/cmake/projects/TIFF/hunter.cmake @@ -5,6 +5,7 @@ include(hunter_add_version) include(hunter_cacheable) +include(hunter_cmake_args) include(hunter_download) include(hunter_pick_scheme) @@ -74,6 +75,36 @@ hunter_add_version( 7bee2843b47c5f9865973b7235e58aa3fb26e1b0 ) +hunter_add_version( + PACKAGE_NAME + TIFF + VERSION + "4.7.0-p0" + URL + "https://github.com/cpp-pm/libtiff/archive/v4.7.0-p0.tar.gz" + SHA1 + a9289150caba29de303070275b57ea087a146c80 +) + +hunter_cmake_args( + TIFF + CMAKE_ARGS + tiff-tools=OFF + tiff-tests=OFF + tiff-docs=OFF + tiff-openGL=OFF + zlib=ON + libdeflate=ON # since 4.7.0-p0 + #pixarlog=ON # don't set, available only with ZLIB=ON, no additional dependency + jpeg=OFF # available since 4.7.0-p0 + #old-jpeg=ON # determined based on jpeg + #jpeg12=OFF # determined based on jpeg + jbig=OFF # not implemented in 4.7.0-p0 + lerc=OFF # not implemented in 4.7.0-p0 + lzma=OFF # available since 4.7.0-p0 + webp=OFF # not implemented in 4.7.0-p0 +) + hunter_pick_scheme(DEFAULT url_sha1_cmake) hunter_cacheable(TIFF) hunter_download(PACKAGE_NAME TIFF) diff --git a/examples/TIFF/CMakeLists.txt b/examples/TIFF/CMakeLists.txt index 01ea4bf448..74bc68c502 100644 --- a/examples/TIFF/CMakeLists.txt +++ b/examples/TIFF/CMakeLists.txt @@ -1,4 +1,5 @@ # Copyright (c) 2014, Ruslan Baratov +# Copyright (c) 2025, NeroBurner # All rights reserved. cmake_minimum_required(VERSION 3.10) @@ -9,27 +10,15 @@ include("../common.cmake") project(download-tiff) -# download gtest +# download TIFF hunter_add_package(TIFF) -# now gtest can be used +# now TIFF can be used find_package(TIFF CONFIG REQUIRED) add_executable(foo main.c) -target_link_libraries(foo TIFF::libtiff) +target_link_libraries(foo PRIVATE TIFF::libtiff) # Compatibility mode -find_package(TIFF REQUIRED) - -string(COMPARE EQUAL "${TIFF_INCLUDE_DIR}" "" is_empty) -if(is_empty) - message(FATAL_ERROR "Expected non-empty") -endif() - -string(COMPARE EQUAL "${TIFF_LIBRARIES}" "TIFF::libtiff" is_good) -if(NOT is_good) - message(FATAL_ERROR "Expected TIFF::libtiff but got: ${TIFF_LIBRARIES}") -endif() - -include_directories(${TIFF_INCLUDE_DIR}) -target_link_libraries(foo ${TIFF_LIBRARIES}) +# try to find another time to check if package is well behaved +find_package(TIFF CONFIG REQUIRED) diff --git a/examples/TIFF/main.c b/examples/TIFF/main.c index 6736ebd813..3793b6d63e 100644 --- a/examples/TIFF/main.c +++ b/examples/TIFF/main.c @@ -29,14 +29,10 @@ * Module to test ASCII tags read/write functions. */ -#include "tif_config.h" - #include #include -#ifdef HAVE_UNISTD_H -# include -#endif +#include #include "tiffio.h" From 1bb5303d17548baa8a03bfd919cf297c23056043 Mon Sep 17 00:00:00 2001 From: Reinhold Gschweicher Date: Tue, 16 Sep 2025 09:05:11 +0200 Subject: [PATCH 2/3] TIFF: disable zstd per default, can be enabled by user --- cmake/projects/TIFF/hunter.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/projects/TIFF/hunter.cmake b/cmake/projects/TIFF/hunter.cmake index 39419012ea..c13e7070c1 100644 --- a/cmake/projects/TIFF/hunter.cmake +++ b/cmake/projects/TIFF/hunter.cmake @@ -102,6 +102,7 @@ hunter_cmake_args( jbig=OFF # not implemented in 4.7.0-p0 lerc=OFF # not implemented in 4.7.0-p0 lzma=OFF # available since 4.7.0-p0 + zstd=OFF # not implemented in 4.7.0-p0 webp=OFF # not implemented in 4.7.0-p0 ) From 9671a339a84f6683f365ec61658e21ec88cd9609 Mon Sep 17 00:00:00 2001 From: Reinhold Gschweicher Date: Tue, 16 Sep 2025 09:14:18 +0200 Subject: [PATCH 3/3] TIFF: example: use stdio.h remove() instead of unlink --- examples/TIFF/main.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/examples/TIFF/main.c b/examples/TIFF/main.c index 3793b6d63e..ab10322522 100644 --- a/examples/TIFF/main.c +++ b/examples/TIFF/main.c @@ -32,8 +32,6 @@ #include #include -#include - #include "tiffio.h" static const char filename[] = "ascii_test.tiff"; @@ -158,7 +156,7 @@ main() TIFFClose(tif); /* All tests passed; delete file and exit with success status. */ - unlink(filename); + remove(filename); return 0; failure: