2020.12.26 19:47 "[Tiff] Wrong information about request and avalability of external codecs", by Miguel Medalha

2020.12.26 19:47 "[Tiff] Wrong information about request and avalability of external codecs", by Miguel Medalha

I found that the logic behind the display of information on request and availability of external codecs is almost completely botched.

Let's use the following pertinent configuration options:

cmake -DZLIB_LIBRARY:PATH=C:\build\lib\zlibstatic.lib
-DZLIB_INCLUDE_DIR:PATH=C:\build\include
-DDEFLATE_LIBRARY:PATH=C:\build\lib\libdeflatestatic.lib
-DDEFLATE_INCLUDE_DIR:PATH=C:\build\include
-DJPEG_LIBRARY:PATH=C:\build\lib\turbojpeg-static.lib
-DJPEG_INCLUDE_DIR:PATH=C:\build\include
-DJBIG_LIBRARY:PATH=C:\build\lib\libjbig.lib
-DJBIG_INCLUDE_DIR:PATH=C:\build\include
-DLIBLZMA_LIBRARY:PATH=C:\build\lib\liblzma.lib
-DLIBLZMA_INCLUDE_DIR:PATH=C:\build\include
-DZSTD_LIBRARY:PATH=C:\build\lib\zstd_static.lib
-DZSTD_INCLUDE_DIR:PATH=C:\build\include
-DWEBP_LIBRARY:PATH=C:\build\lib\webp.lib
-DWEBP_INCLUDE_DIR:PATH=C:\build\include -Dzlib:BOOL=OFF
-Dlibdeflate:BOOL=OFF -Dpixarlog:BOOL=OFF -Djpeg:BOOL=OFF
-Dold-jpeg:BOOL=OFF -Djpeg12:BOOL=OFF -Djbig:BOOL=OFF -Dlzma:BOOL=OFF
-Dzstd:BOOL=OFF -Dwebp:BOOL=OFF
-DCMAKE_SHARED_LINKER_FLAGS=/NODEFAULTLIB:"LIBCMT"
-DCMAKE_EXE_LINKER_FLAGS=/NODEFAULTLIB:"LIBCMT" -S . -B C:\build\bin\libtiff

The output is the following:

--  Support for external codecs:
--   ZLIB support:                       OFF (requested)  (availability)
--   libdeflate support:                 OFF (requested) FALSE (availability)
--   Pixar log-format algorithm:         OFF (requested) FALSE (availability)
--   JPEG support:                       OFF (requested)  (availability)
--   Old JPEG support:                   OFF (requested)  (availability)
--   JPEG 8/12 bit dual mode:            OFF (requested) FALSE (availability)
--   ISO JBIG support:                   OFF (requested) FALSE (availability)
--   LZMA2 support:                      OFF (requested)  (availability)
--   ZSTD support:                       OFF (requested)  (availability)
--   WEBP support:                       OFF (requested) TRUE (availability)

The only one behaving correctly is WEBP. I understand the particular case of DEFLATE, which depends on the availability of ZLIB, but then, if we turn ZLIB ON:

--   ZLIB support:                       ON (requested) TRUE (availability)
--   libdeflate support:                 OFF (requested) FALSE (availability)

Either the information on availability is wrong or it is simply absent, although the 'CMakeLists.txt' calls for it:

message(STATUS "  ZLIB support:                       ${zlib} (requested) ${ZLIB_FOUND} (availability)")
message(STATUS "  libdeflate support:                 ${libdeflate} (requested) ${LIBDEFLATE_SUPPORT} (availability)")
message(STATUS "  Pixar log-format algorithm:         ${pixarlog} (requested) ${PIXARLOG_SUPPORT} (availability)")
message(STATUS "  JPEG support:                       ${jpeg} (requested) ${JPEG_FOUND} (availability)")
message(STATUS "  Old JPEG support:                   ${old-jpeg} (requested) ${JPEG_FOUND} (availability)")
message(STATUS "  JPEG 8/12 bit dual mode:            ${jpeg12} (requested) ${JPEG12_FOUND} (availability)")
message(STATUS "  ISO JBIG support:                   ${jbig} (requested) ${JBIG_FOUND} (availability)")
message(STATUS "  LZMA2 support:                      ${lzma} (requested) ${LIBLZMA_FOUND} (availability)")
message(STATUS "  ZSTD support:                       ${zstd} (requested) ${ZSTD_FOUND} (availability)")
message(STATUS "  WEBP support:                       ${webp} (requested) ${WEBP_FOUND} (availability)")

If we turn on all codecs by switching all the ':BOOL' options to 'ON' (please note that 'JPEG 8/12 bit' is actually not available on my system):

--   ZLIB support:                       ON (requested) TRUE (availability)
--   libdeflate support:                 ON (requested) TRUE (availability)
--   Pixar log-format algorithm:         ON (requested) TRUE (availability)
--   JPEG support:                       ON (requested) TRUE (availability)
--   Old JPEG support:                   ON (requested) TRUE (availability)
--   JPEG 8/12 bit dual mode:            ON (requested) FALSE (availability)
--   ISO JBIG support:                   ON (requested) TRUE (availability)
--   LZMA2 support:                      ON (requested) TRUE (availability)
--   ZSTD support:                       ON (requested) TRUE (availability)
--   WEBP support:                       ON (requested) TRUE (availability)

How come availability is dependent upon request? Why bother presenting the information if it's not to be accurate?

Also, LZMA demands the location of libraries and include files to be specified in the format '-DLIBLZMA_LIBRARY:PATH' and 'DLIBLZMA_INCLUDE_DIR:PATH' instead of '-DLZMA_LIBRARY:PATH' and 'DLZMA_INCLUDE_DIR:PATH' like the other codecs. Shouldn't this be consistent instead of casuistic, for the sake of conservation of mental energy?

There's a problem in that my knowledge is too limited to solve this. Anyone here interested?