From aae77b65a51ebd094eab1f8745855982af5817dc Mon Sep 17 00:00:00 2001 From: Kumataro Date: Mon, 25 Mar 2024 14:58:30 +0900 Subject: [PATCH] Merge pull request #25257 from Kumataro:fix25256 3rdparty: libtiff: fix for small version expression problems for built-in tiff460 #25257 Close #25256 1. fix to show build-int libtiff version 2. fix to set value of LIBTIFF_VERSION define. (RELEASE-DATE file coms from original libtiff 4.6.0) ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch - [x] There is a reference to the original bug report and related work - [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [ ] The feature is well documented and sample code can be built with the project CMake --- 3rdparty/libtiff/CMakeLists.txt | 3 ++- 3rdparty/libtiff/RELEASE-DATE | 1 + cmake/OpenCVFindLibsGrfmt.cmake | 14 +++++++------- 3 files changed, 10 insertions(+), 8 deletions(-) create mode 100644 3rdparty/libtiff/RELEASE-DATE diff --git a/3rdparty/libtiff/CMakeLists.txt b/3rdparty/libtiff/CMakeLists.txt index 30a052861f..9173e207f7 100644 --- a/3rdparty/libtiff/CMakeLists.txt +++ b/3rdparty/libtiff/CMakeLists.txt @@ -361,6 +361,7 @@ set(LIBTIFF_MAJOR_VERSION "4") set(LIBTIFF_MINOR_VERSION "6") set(LIBTIFF_MICRO_VERSION "0") set(LIBTIFF_VERSION "${LIBTIFF_MAJOR_VERSION}.${LIBTIFF_MINOR_VERSION}.${LIBTIFF_MICRO_VERSION}") +file(READ "RELEASE-DATE" LIBTIFF_RELEASE_DATE content) set(TIFF_MAX_DIR_COUNT "1048576") @@ -427,7 +428,7 @@ set(lib_srcs tiff.h tiffio.h tiffiop.h - tiffvers.h + "${CMAKE_CURRENT_BINARY_DIR}/tiffvers.h" uvcode.h tiffio.hxx "${CMAKE_CURRENT_BINARY_DIR}/tif_config.h" diff --git a/3rdparty/libtiff/RELEASE-DATE b/3rdparty/libtiff/RELEASE-DATE new file mode 100644 index 0000000000..68d943433e --- /dev/null +++ b/3rdparty/libtiff/RELEASE-DATE @@ -0,0 +1 @@ +20230908 diff --git a/cmake/OpenCVFindLibsGrfmt.cmake b/cmake/OpenCVFindLibsGrfmt.cmake index a76a9ed44a..f1478e96f4 100644 --- a/cmake/OpenCVFindLibsGrfmt.cmake +++ b/cmake/OpenCVFindLibsGrfmt.cmake @@ -124,13 +124,13 @@ if(WITH_TIFF) endif() if(NOT TIFF_VERSION_STRING AND TIFF_INCLUDE_DIR) - list(GET TIFF_INCLUDE_DIR 0 _TIFF_INCLUDE_DIR) - if(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() - unset(_TIFF_INCLUDE_DIR) + foreach(_TIFF_INCLUDE_DIR IN LISTS TIFF_INCLUDE_DIR) + if(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() + endforeach() endif() set(HAVE_TIFF YES)