1 # CMake build for libtiff
2 # Run "cmake" to generate the build files for your platform
4 # Copyright © 2015 Open Microscopy Environment / University of Dundee
5 # Written by Roger Leigh <rleigh@codelibre.net>
7 # Permission to use, copy, modify, distribute, and sell this software and
8 # its documentation for any purpose is hereby granted without fee, provided
9 # that (i) the above copyright notices and this permission notice appear in
10 # all copies of the software and related documentation, and (ii) the names of
11 # Sam Leffler and Silicon Graphics may not be used in any advertising or
12 # publicity relating to the software without the specific, prior written
13 # permission of Sam Leffler and Silicon Graphics.
15 # THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
16 # EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
17 # WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
19 # IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
20 # ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
21 # OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
22 # WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
23 # LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
26 cmake_minimum_required(VERSION 2.8.11) # b/c of use of BUILD_INTERFACE generator expression
28 # Default policy is from 2.8.9
29 cmake_policy(VERSION 2.8.9)
30 # Set MacOSX @rpath usage globally.
32 cmake_policy(SET CMP0020 NEW)
35 cmake_policy(SET CMP0042 NEW)
37 # Use new variable expansion policy.
39 cmake_policy(SET CMP0053 NEW)
42 cmake_policy(SET CMP0054 NEW)
45 # Read version information from configure.ac.
46 FILE(READ "${CMAKE_CURRENT_SOURCE_DIR}/configure.ac" configure)
47 STRING(REGEX REPLACE ";" "\\\\;" configure "${configure}")
48 STRING(REGEX REPLACE "\n" ";" configure "${configure}")
49 foreach(line ${configure})
50 foreach(var LIBTIFF_MAJOR_VERSION LIBTIFF_MINOR_VERSION LIBTIFF_MICRO_VERSION LIBTIFF_ALPHA_VERSION
51 LIBTIFF_CURRENT LIBTIFF_REVISION LIBTIFF_AGE)
53 string(REGEX MATCH "^${var}=(.*)" ${var}_MATCH "${line}")
55 string(REGEX REPLACE "^${var}=(.*)" "\\1" ${var} "${line}")
61 math(EXPR SO_MAJOR "${LIBTIFF_CURRENT} - ${LIBTIFF_AGE}")
62 set(SO_MINOR "${LIBTIFF_AGE}")
63 set(SO_REVISION "${LIBTIFF_REVISION}")
65 message(STATUS "Building tiff version ${LIBTIFF_MAJOR_VERSION}.${LIBTIFF_MINOR_VERSION}.${LIBTIFF_MICRO_VERSION}${LIBTIFF_ALPHA_VERSION}")
66 message(STATUS "libtiff library version ${SO_MAJOR}.${SO_MINOR}.${SO_REVISION}")
68 set(BUILD_SHARED_LIBS ON CACHE BOOL "Build shared libraries")
72 set(VERSION "${LIBTIFF_MAJOR_VERSION}.${LIBTIFF_MINOR_VERSION}.${LIBTIFF_MICRO_VERSION}")
73 set(tiff_VERSION "${VERSION}")
74 set(tiff_VERSION_MAJOR "${LIBTIFF_MAJOR_VERSION}")
75 set(tiff_VERSION_MINOR "${LIBTIFF_MINOR_VERSION}")
76 set(tiff_VERSION_PATCH "${LIBTIFF_MICRO_VERSION}")
78 # the other tiff_VERSION_* variables are set automatically
79 set(tiff_VERSION_ALPHA "${LIBTIFF_ALPHA_VERSION}")
80 # Library version (unlike libtool's baroque scheme, WYSIWYG here)
81 set(SO_COMPATVERSION "${SO_MAJOR}")
82 set(SO_VERSION "${SO_MAJOR}.${SO_MINOR}.${SO_REVISION}")
84 # For autotools header compatibility
85 set(PACKAGE_NAME "LibTIFF Software")
86 set(PACKAGE_TARNAME "${PROJECT_NAME}")
87 set(PACKAGE_VERSION "${PROJECT_VERSION}${tiff_VERSION_ALPHA}")
88 set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
89 set(PACKAGE_BUGREPORT "tiff@lists.maptools.org")
91 include(GNUInstallDirs)
92 include(CheckCCompilerFlag)
93 include(CheckCSourceCompiles)
94 include(CheckIncludeFile)
95 include(CheckLibraryExists)
96 include(CheckTypeSize)
97 include(CheckSymbolExists)
100 macro(current_date var)
102 execute_process(COMMAND "date" +"%Y%m%d" OUTPUT_VARIABLE ${var})
106 current_date(RELEASE_DATE)
109 foreach(file ${ARGV})
110 file(RELATIVE_PATH relfile "${PROJECT_SOURCE_DIR}"
111 "${CMAKE_CURRENT_SOURCE_DIR}/${file}")
112 list(APPEND EXTRA_DIST "${relfile}")
114 set(EXTRA_DIST "${EXTRA_DIST}" PARENT_SCOPE)
126 # These are annoyingly verbose, produce false positives or don't work
127 # nicely with all supported compiler versions, so are disabled unless
128 # explicitly enabled.
129 option(extra-warnings "Enable extra compiler warnings" OFF)
131 # This will cause the compiler to fail when an error occurs.
132 option(fatal-warnings "Compiler warnings are errors" OFF)
134 # Check if the compiler supports each of the following additional
135 # flags, and enable them if supported. This greatly improves the
136 # quality of the build by checking for a number of common problems,
137 # some of which are quite serious.
138 if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR
139 CMAKE_C_COMPILER_ID MATCHES "Clang")
146 -Wdisabled-optimization
148 -Wdeclaration-after-statement
151 list(APPEND test_flags
157 list(APPEND test_flags
160 elseif(CMAKE_C_COMPILER_ID STREQUAL "MSVC")
163 list(APPEND test_flags
166 list(APPEND test_flags
170 list(APPEND test_flags
175 foreach(flag ${test_flags})
176 string(REGEX REPLACE "[^A-Za-z0-9]" "_" flag_var "${flag}")
177 set(test_c_flag "C_FLAG${flag_var}")
178 CHECK_C_COMPILER_FLAG(${flag} "${test_c_flag}")
180 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flag}")
181 endif (${test_c_flag})
182 endforeach(flag ${test_flags})
185 set(CMAKE_DEBUG_POSTFIX "d")
188 option(ld-version-script "Enable linker version script" ON)
189 # Check if LD supports linker scripts.
190 file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/conftest.map" "VERS_1 {
198 set(CMAKE_REQUIRED_FLAGS_SAVE ${CMAKE_REQUIRED_FLAGS})
199 set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} "-Wl,--version-script=${CMAKE_CURRENT_BINARY_DIR}/conftest.map")
200 check_c_source_compiles("int main(void){return 0;}" HAVE_LD_VERSION_SCRIPT)
201 set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_SAVE})
202 file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/conftest.map")
203 if (ld-version-script AND HAVE_LD_VERSION_SCRIPT)
204 set(HAVE_LD_VERSION_SCRIPT TRUE)
206 set(HAVE_LD_VERSION_SCRIPT FALSE)
209 # Find libm, if available
210 find_library(M_LIBRARY m)
212 check_include_file(assert.h HAVE_ASSERT_H)
213 check_include_file(dlfcn.h HAVE_DLFCN_H)
214 check_include_file(fcntl.h HAVE_FCNTL_H)
215 check_include_file(inttypes.h HAVE_INTTYPES_H)
216 check_include_file(io.h HAVE_IO_H)
217 check_include_file(search.h HAVE_SEARCH_H)
218 check_include_file(stdint.h HAVE_STDINT_H)
219 check_include_file(string.h HAVE_STRING_H)
220 check_include_file(strings.h HAVE_STRINGS_H)
221 check_include_file(sys/time.h HAVE_SYS_TIME_H)
222 check_include_file(sys/types.h HAVE_SYS_TYPES_H)
223 check_include_file(unistd.h HAVE_UNISTD_H)
225 # Inspired from /usr/share/autoconf/autoconf/c.m4
226 foreach(inline_keyword "inline" "__inline__" "__inline")
227 if(NOT DEFINED C_INLINE)
228 set(CMAKE_REQUIRED_DEFINITIONS_SAVE ${CMAKE_REQUIRED_DEFINITIONS})
229 set(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
230 "-Dinline=${inline_keyword}")
231 check_c_source_compiles("
233 static inline foo_t static_foo() {return 0;}
234 foo_t foo(){return 0;}
235 int main(int argc, char *argv[]) {return 0;}"
236 C_HAS_${inline_keyword})
237 set(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS_SAVE})
238 if(C_HAS_${inline_keyword})
240 set(INLINE_KEYWORD "${inline_keyword}")
244 if(NOT DEFINED C_INLINE)
248 # off_t and size_t checks omitted; not clear they are used at all
249 # Are off_t and size_t checks strictly necessary?
251 # Check if sys/time.h and time.h allow use together
252 check_c_source_compiles("
253 #include <sys/time.h>
255 int main(void){return 0;}"
258 # Check if struct tm is in sys/time.h
259 check_c_source_compiles("
260 #include <sys/types.h>
271 # NOTE: Could be replaced with C99 <stdint.h>
272 check_type_size("signed int" SIZEOF_SIGNED_INT)
273 check_type_size("unsigned int" SIZEOF_UNSIGNED_INT)
274 check_type_size("signed long" SIZEOF_SIGNED_LONG)
275 check_type_size("unsigned long" SIZEOF_UNSIGNED_LONG)
276 check_type_size("signed long long" SIZEOF_SIGNED_LONG_LONG)
277 check_type_size("unsigned long long" SIZEOF_UNSIGNED_LONG_LONG)
278 check_type_size("unsigned char *" SIZEOF_UNSIGNED_CHAR_P)
280 set(CMAKE_EXTRA_INCLUDE_FILES_SAVE ${CMAKE_EXTRA_INCLUDE_FILES})
281 set(CMAKE_EXTRA_INCLUDE_FILES ${CMAKE_EXTRA_INCLUDE_FILES} "stddef.h")
282 check_type_size("size_t" SIZEOF_SIZE_T)
283 check_type_size("ptrdiff_t" SIZEOF_PTRDIFF_T)
284 set(CMAKE_EXTRA_INCLUDE_FILES ${CMAKE_EXTRA_INCLUDE_FILES_SAVE})
288 message(STATUS "${val} set to ${${val}}")
292 set(TIFF_INT8_T "signed char")
293 set(TIFF_UINT8_T "unsigned char")
295 set(TIFF_INT16_T "signed short")
296 set(TIFF_UINT16_T "unsigned short")
298 if(SIZEOF_SIGNED_INT EQUAL 4)
299 set(TIFF_INT32_T "signed int")
300 set(TIFF_INT32_FORMAT "%d")
301 elseif(SIZEOF_SIGNED_LONG EQUAL 4)
302 set(TIFF_INT32_T "signed long")
303 set(TIFF_INT32_FORMAT "%ld")
306 if(SIZEOF_UNSIGNED_INT EQUAL 4)
307 set(TIFF_UINT32_T "unsigned int")
308 set(TIFF_UINT32_FORMAT "%u")
309 elseif(SIZEOF_UNSIGNED_LONG EQUAL 4)
310 set(TIFF_UINT32_T "unsigned long")
311 set(TIFF_UINT32_FORMAT "%lu")
314 if(SIZEOF_SIGNED_LONG EQUAL 8)
315 set(TIFF_INT64_T "signed long")
316 set(TIFF_INT64_FORMAT "%ld")
317 elseif(SIZEOF_SIGNED_LONG_LONG EQUAL 8)
318 set(TIFF_INT64_T "signed long long")
320 set(TIFF_INT64_FORMAT "%I64d")
322 set(TIFF_INT64_FORMAT "%lld")
326 if(SIZEOF_UNSIGNED_LONG EQUAL 8)
327 set(TIFF_UINT64_T "unsigned long")
328 set(TIFF_UINT64_FORMAT "%lu")
329 elseif(SIZEOF_UNSIGNED_LONG_LONG EQUAL 8)
330 set(TIFF_UINT64_T "unsigned long long")
332 set(TIFF_UINT64_FORMAT "%I64u")
334 set(TIFF_UINT64_FORMAT "%llu")
338 if(SIZEOF_UNSIGNED_INT EQUAL SIZEOF_SIZE_T)
339 set(TIFF_SIZE_T "unsigned int")
340 set(TIFF_SIZE_FORMAT "%u")
341 elseif(SIZEOF_UNSIGNED_LONG EQUAL SIZEOF_SIZE_T)
342 set(TIFF_SIZE_T "unsigned long")
343 set(TIFF_SIZE_FORMAT "%lu")
344 elseif(SIZEOF_UNSIGNED_LONG_LONG EQUAL SIZEOF_SIZE_T)
345 set(TIFF_SIZE_T "unsigned long")
347 set(TIFF_SIZE_FORMAT "%I64u")
349 set(TIFF_SIZE_FORMAT "%llu")
353 if(SIZEOF_SIGNED_INT EQUAL SIZEOF_UNSIGNED_CHAR_P)
354 set(TIFF_SSIZE_T "signed int")
355 set(TIFF_SSIZE_FORMAT "%d")
356 elseif(SIZEOF_SIGNED_LONG EQUAL SIZEOF_UNSIGNED_CHAR_P)
357 set(TIFF_SSIZE_T "signed long")
358 set(TIFF_SSIZE_FORMAT "%ld")
359 elseif(SIZEOF_SIGNED_LONG_LONG EQUAL SIZEOF_UNSIGNED_CHAR_P)
360 set(TIFF_SSIZE_T "signed long long")
362 set(TIFF_SSIZE_FORMAT "%I64d")
364 set(TIFF_SSIZE_FORMAT "%lld")
368 if(NOT SIZEOF_PTRDIFF_T)
369 set(TIFF_PTRDIFF_T "${TIFF_SSIZE_T}")
370 set(TIFF_PTRDIFF_FORMAT "${SSIZE_FORMAT}")
372 set(TIFF_PTRDIFF_T "ptrdiff_t")
373 set(TIFF_PTRDIFF_FORMAT "%ld")
376 #report_values(TIFF_INT8_T TIFF_INT8_FORMAT
377 # TIFF_UINT8_T TIFF_UINT8_FORMAT
378 # TIFF_INT16_T TIFF_INT16_FORMAT
379 # TIFF_UINT16_T TIFF_UINT16_FORMAT
380 # TIFF_INT32_T TIFF_INT32_FORMAT
381 # TIFF_UINT32_T TIFF_UINT32_FORMAT
382 # TIFF_INT64_T TIFF_INT64_FORMAT
383 # TIFF_UINT64_T TIFF_UINT64_FORMAT
384 # TIFF_SSIZE_T TIFF_SSIZE_FORMAT
385 # TIFF_PTRDIFF_T TIFF_PTRDIFF_FORMAT)
387 check_symbol_exists(mmap "sys/mman.h" HAVE_MMAP)
388 check_symbol_exists(setmode "unistd.h" HAVE_SETMODE)
389 check_symbol_exists(snprintf "stdio.h" HAVE_SNPRINTF)
390 check_symbol_exists(strcasecmp "strings.h" HAVE_STRCASECMP)
391 check_symbol_exists(strtol "stdlib.h" HAVE_STRTOL)
392 check_symbol_exists(strtoll "stdlib.h" HAVE_STRTOLL)
393 check_symbol_exists(strtoul "stdlib.h" HAVE_STRTOUL)
394 check_symbol_exists(strtoull "stdlib.h" HAVE_STRTOULL)
395 check_symbol_exists(getopt "unistd.h" HAVE_GETOPT)
396 check_symbol_exists(lfind "search.h" HAVE_LFIND)
398 if(NOT HAVE_SNPRINTF)
399 add_definitions(-DNEED_LIBPORT)
403 set(HOST_FILLORDER FILLORDER_MSB2LSB)
404 if(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "i.*86.*" OR
405 CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "amd64.*" OR
406 CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "x86_64.*")
407 set(HOST_FILLORDER FILLORDER_LSB2MSB)
411 include(TestBigEndian)
412 test_big_endian(HOST_BIG_ENDIAN)
414 # IEEE floating point
417 report_values(CMAKE_HOST_SYSTEM_PROCESSOR HOST_FILLORDER
418 HOST_BIG_ENDIAN HAVE_IEEEFP)
422 # This might not catch every possibility catered for by
424 add_definitions(-D_FILE_OFFSET_BITS=64)
425 set(FILE_OFFSET_BITS 64)
428 # Documentation install directory (default to cmake project docdir)
429 set(LIBTIFF_DOCDIR "${CMAKE_INSTALL_FULL_DOCDIR}")
431 # Options to enable and disable internal codecs
433 option(ccitt "support for CCITT Group 3 & 4 algorithms" ON)
434 set(CCITT_SUPPORT ${ccitt})
436 option(packbits "support for Macintosh PackBits algorithm" ON)
437 set(PACKBITS_SUPPORT ${packbits})
439 option(lzw "support for LZW algorithm" ON)
440 set(LZW_SUPPORT ${lzw})
442 option(thunder "support for ThunderScan 4-bit RLE algorithm" ON)
443 set(THUNDER_SUPPORT ${thunder})
445 option(next "support for NeXT 2-bit RLE algorithm" ON)
446 set(NEXT_SUPPORT ${next})
448 option(logluv "support for LogLuv high dynamic range algorithm" ON)
449 set(LOGLUV_SUPPORT ${logluv})
451 # Option for Microsoft Document Imaging
452 option(mdi "support for Microsoft Document Imaging" ON)
453 set(MDI_SUPPORT ${mdi})
456 option(zlib "use zlib (required for Deflate compression)" ON)
464 set(ZIP_SUPPORT ${ZLIB_SUPPORT})
465 # Option for Pixar log-format algorithm
468 option(pixarlog "support for Pixar log-format algorithm (requires Zlib)" ON)
469 set(PIXARLOG_SUPPORT FALSE)
472 set(PIXARLOG_SUPPORT TRUE)
477 option(jpeg "use libjpeg (required for JPEG compression)" ON)
481 set(JPEG_SUPPORT FALSE)
483 set(JPEG_SUPPORT TRUE)
486 option(old-jpeg "support for Old JPEG compression (read-only)" ON)
487 set(OJPEG_SUPPORT FALSE)
490 set(OJPEG_SUPPORT TRUE)
495 option(jbig "use ISO JBIG compression (requires JBIT-KIT library)" ON)
498 find_path(JBIG_INCLUDE_DIR jbig.h)
499 set(JBIG_NAMES ${JBIG_NAMES} jbig libjbig)
500 find_library(JBIG_LIBRARY NAMES ${JBIG_NAMES})
501 if (JBIG_INCLUDE_DIR AND JBIG_LIBRARY)
503 set(JBIG_LIBRARIES ${JBIG_LIBRARY})
511 set(JBIG_FOUND FALSE)
514 set(CMAKE_REQUIRED_INCLUDES_SAVE ${CMAKE_REQUIRED_INCLUDES})
515 set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${JBIG_INCLUDE_DIR})
516 check_symbol_exists(jbg_newlen "jbig.h" HAVE_JBG_NEWLEN)
517 set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SAVE})
520 option(lzma "use liblzma (required for LZMA2 compression)" ON)
522 find_package(LibLZMA)
530 option(zstd "use libzstd (required for ZSTD compression)" ON)
532 find_path(ZSTD_INCLUDE_DIR zstd.h)
533 find_library(ZSTD_LIBRARY NAMES zstd)
534 if (ZSTD_INCLUDE_DIR AND ZSTD_LIBRARY)
535 check_library_exists ("${ZSTD_LIBRARY}" ZSTD_decompressStream "" ZSTD_RECENT_ENOUGH)
536 if (ZSTD_RECENT_ENOUGH)
538 set(ZSTD_LIBRARIES ${ZSTD_LIBRARY})
539 message(STATUS "Found ZSTD library: ${ZSTD_LIBRARY}")
541 message(WARNING "Found ZSTD library, but not recent enough. Use zstd >= 1.0")
551 option(webp "use libwebp (required for WEBP compression)" ON)
553 find_path(WEBP_INCLUDE_DIR /webp/decode.h)
554 find_library(WEBP_LIBRARY NAMES webp)
557 set(WEBP_FOUND FALSE)
558 if (WEBP_INCLUDE_DIR AND WEBP_LIBRARY)
561 set(WEBP_LIBRARIES ${WEBP_LIBRARY})
562 message(STATUS "Found WEBP library: ${WEBP_LIBRARY}")
566 option(jpeg12 "enable libjpeg 8/12-bit dual mode (requires separate
567 12-bit libjpeg build)" ON)
568 set(JPEG12_INCLUDE_DIR JPEG12_INCLUDE_DIR-NOTFOUND CACHE PATH "Include directory for 12-bit libjpeg")
569 set(JPEG12_LIBRARY JPEG12_LIBRARY-NOTFOUND CACHE FILEPATH "12-bit libjpeg library")
570 set(JPEG12_FOUND FALSE)
571 if (JPEG12_INCLUDE_DIR AND JPEG12_LIBRARY)
572 set(JPEG12_LIBRARIES ${JPEG12_LIBRARY})
573 set(JPEG12_FOUND TRUE)
576 set(JPEG_DUAL_MODE_8_12 1)
577 set(LIBJPEG_12_PATH "${JPEG12_INCLUDE_DIR}/jpeglib.h")
581 option(cxx "Enable C++ stream API building (requires C++ compiler)" ON)
582 set(CXX_SUPPORT FALSE)
585 set(CXX_SUPPORT TRUE)
591 set(HAVE_OPENGL FALSE)
592 if(OPENGL_FOUND AND OPENGL_GLU_FOUND AND GLUT_FOUND)
593 set(HAVE_OPENGL TRUE)
595 # Purely to satisfy the generated headers:
596 check_include_file(GL/gl.h HAVE_GL_GL_H)
597 check_include_file(GL/glu.h HAVE_GL_GLU_H)
598 check_include_file(GL/glut.h HAVE_GL_GLUT_H)
599 check_include_file(GLUT/glut.h HAVE_GLUT_GLUT_H)
600 check_include_file(OpenGL/gl.h HAVE_OPENGL_GL_H)
601 check_include_file(OpenGL/glu.h HAVE_OPENGL_GLU_H)
609 set(USE_WIN32_FILEIO ${win32_io})
611 # Orthogonal features
614 option(strip-chopping "strip chopping (whether or not to convert single-strip uncompressed images to mutiple strips of specified size to reduce memory usage)" ON)
615 set(TIFF_DEFAULT_STRIP_SIZE 8192 CACHE STRING "default size of the strip in bytes (when strip chopping is enabled)")
617 set(STRIPCHOP_DEFAULT)
619 set(STRIPCHOP_DEFAULT TRUE)
620 if(TIFF_DEFAULT_STRIP_SIZE)
621 set(STRIP_SIZE_DEFAULT "${TIFF_DEFAULT_STRIP_SIZE}")
625 # Defer loading of strip/tile offsets
626 option(defer-strile-load "enable deferred strip/tile offset/size loading (experimental)" OFF)
627 set(DEFER_STRILE_LOAD ${defer-strile-load})
629 # CHUNKY_STRIP_READ_SUPPORT
630 option(chunky-strip-read "enable reading large strips in chunks for TIFFReadScanline() (experimental)" OFF)
631 set(CHUNKY_STRIP_READ_SUPPORT ${chunky-strip-read})
634 set(SUBIFD_SUPPORT 1)
636 # Default handling of ASSOCALPHA support.
637 option(extrasample-as-alpha "the RGBA interface will treat a fourth sample with no EXTRASAMPLE_ value as being ASSOCALPHA. Many packages produce RGBA files but don't mark the alpha properly" ON)
638 if(extrasample-as-alpha)
639 set(DEFAULT_EXTRASAMPLE_AS_ALPHA 1)
642 # Default handling of YCbCr subsampling support.
643 # See Bug 168 in Bugzilla, and JPEGFixupTestSubsampling() for details.
644 option(check-ycbcr-subsampling "enable picking up YCbCr subsampling info from the JPEG data stream to support files lacking the tag" ON)
645 if (check-ycbcr-subsampling)
646 set(CHECK_JPEG_YCBCR_SUBSAMPLING 1)
649 # Generate pkg-config file
650 set(prefix "${CMAKE_INSTALL_PREFIX}")
651 set(exec_prefix "${CMAKE_INSTALL_PREFIX}")
652 set(libdir "${CMAKE_INSTALL_FULL_LIBDIR}")
653 set(includedir "${CMAKE_INSTALL_FULL_INCLUDEDIR}")
654 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libtiff-4.pc.in
655 ${CMAKE_CURRENT_BINARY_DIR}/libtiff-4.pc)
656 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libtiff-4.pc
657 DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig")
659 # Includes used by libtiff (and tests)
660 if(ZLIB_INCLUDE_DIRS)
661 list(APPEND TIFF_INCLUDES ${ZLIB_INCLUDE_DIRS})
664 list(APPEND TIFF_INCLUDES ${JPEG_INCLUDE_DIR})
666 if(JPEG12_INCLUDE_DIR)
667 list(APPEND TIFF_INCLUDES ${JPEG12_INCLUDE_DIR})
670 list(APPEND TIFF_INCLUDES ${JBIG_INCLUDE_DIR})
672 if(LIBLZMA_INCLUDE_DIRS)
673 list(APPEND TIFF_INCLUDES ${LIBLZMA_INCLUDE_DIRS})
676 list(APPEND TIFF_INCLUDES ${ZSTD_INCLUDE_DIR})
679 list(APPEND TIFF_INCLUDES ${WEBP_INCLUDE_DIR})
682 # Libraries required by libtiff
683 set(TIFF_LIBRARY_DEPS)
685 list(APPEND TIFF_LIBRARY_DEPS ${M_LIBRARY})
688 list(APPEND TIFF_LIBRARY_DEPS ${ZLIB_LIBRARIES})
691 list(APPEND TIFF_LIBRARY_DEPS ${JPEG_LIBRARIES})
694 list(APPEND TIFF_LIBRARY_DEPS ${JPEG12_LIBRARIES})
697 list(APPEND TIFF_LIBRARY_DEPS ${JBIG_LIBRARIES})
699 if(LIBLZMA_LIBRARIES)
700 list(APPEND TIFF_LIBRARY_DEPS ${LIBLZMA_LIBRARIES})
703 list(APPEND TIFF_LIBRARY_DEPS ${ZSTD_LIBRARIES})
706 list(APPEND TIFF_LIBRARY_DEPS ${WEBP_LIBRARIES})
709 #report_values(TIFF_INCLUDES TIFF_LIBRARY_DEPS)
711 # Process subdirectories
712 add_subdirectory(port)
713 add_subdirectory(libtiff)
714 add_subdirectory(tools)
715 add_subdirectory(test)
716 add_subdirectory(contrib)
717 add_subdirectory(build)
718 add_subdirectory(man)
719 add_subdirectory(html)
721 #message(STATUS "EXTRA_DIST: ${EXTRA_DIST}")
724 message(STATUS "Libtiff is now configured for ${host}")
726 message(STATUS " Installation directory: ${prefix}")
727 message(STATUS " Documentation directory: ${LIBTIFF_DOCDIR}")
728 message(STATUS " C compiler: ${CMAKE_C_COMPILER}")
729 message(STATUS " C++ compiler: ${CMAKE_CXX_COMPILER}")
730 message(STATUS " Build shared libraries: ${BUILD_SHARED_LIBS}")
731 message(STATUS " Enable linker symbol versioning: ${HAVE_LD_VERSION_SCRIPT}")
732 message(STATUS " Support Microsoft Document Imaging: ${mdi}")
733 message(STATUS " Use win32 IO: ${USE_WIN32_FILEIO}")
735 message(STATUS " Support for internal codecs:")
736 message(STATUS " CCITT Group 3 & 4 algorithms: ${ccitt}")
737 message(STATUS " Macintosh PackBits algorithm: ${packbits}")
738 message(STATUS " LZW algorithm: ${lzw}")
739 message(STATUS " ThunderScan 4-bit RLE algorithm: ${thunder}")
740 message(STATUS " NeXT 2-bit RLE algorithm: ${next}")
741 message(STATUS " LogLuv high dynamic range encoding: ${logluv}")
743 message(STATUS " Support for external codecs:")
744 message(STATUS " ZLIB support: ${zlib} (requested) ${ZLIB_FOUND} (availability)")
745 message(STATUS " Pixar log-format algorithm: ${pixarlog} (requested) ${PIXARLOG_SUPPORT} (availability)")
746 message(STATUS " JPEG support: ${jpeg} (requested) ${JPEG_FOUND} (availability)")
747 message(STATUS " Old JPEG support: ${old-jpeg} (requested) ${JPEG_FOUND} (availability)")
748 message(STATUS " JPEG 8/12 bit dual mode: ${jpeg12} (requested) ${JPEG12_FOUND} (availability)")
749 message(STATUS " ISO JBIG support: ${jbig} (requested) ${JBIG_FOUND} (availability)")
750 message(STATUS " LZMA2 support: ${lzma} (requested) ${LIBLZMA_FOUND} (availability)")
751 message(STATUS " ZSTD support: ${zstd} (requested) ${ZSTD_FOUND} (availability)")
752 message(STATUS " WEBP support: ${webp} (requested) ${WEBP_FOUND} (availability)")
754 message(STATUS " C++ support: ${cxx} (requested) ${CXX_SUPPORT} (availability)")
756 # message(STATUS " X Athena Widgets support: ${HAVE_XAW}")
757 message(STATUS " OpenGL support: ${HAVE_OPENGL}")