| 1 |
# CMake build for libtiff |
| 2 |
# Run "cmake" to generate the build files for your platform |
| 3 |
# |
| 4 |
# Copyright © 2015 Open Microscopy Environment / University of Dundee |
| 5 |
# Copyright © 2021 Roger Leigh <[email protected]> |
| 6 |
# Written by Roger Leigh <[email protected]> |
| 7 |
# |
| 8 |
# Permission to use, copy, modify, distribute, and sell this software and |
| 9 |
# its documentation for any purpose is hereby granted without fee, provided |
| 10 |
# that (i) the above copyright notices and this permission notice appear in |
| 11 |
# all copies of the software and related documentation, and (ii) the names of |
| 12 |
# Sam Leffler and Silicon Graphics may not be used in any advertising or |
| 13 |
# publicity relating to the software without the specific, prior written |
| 14 |
# permission of Sam Leffler and Silicon Graphics. |
| 15 |
# |
| 16 |
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, |
| 17 |
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY |
| 18 |
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. |
| 19 |
# |
| 20 |
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR |
| 21 |
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, |
| 22 |
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, |
| 23 |
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF |
| 24 |
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE |
| 25 |
# OF THIS SOFTWARE. |
| 26 |
|
| 27 |
cmake_minimum_required(VERSION 3.9.0) |
| 28 |
|
| 29 |
# Default policy is from 3.9.0 |
| 30 |
cmake_policy(VERSION 3.9.0) |
| 31 |
|
| 32 |
# Find CMake modules in cmake/ |
| 33 |
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake") |
| 34 |
|
| 35 |
# Read version information from configure.ac. |
| 36 |
include(AutotoolsVersion) |
| 37 |
message(STATUS "Building tiff version ${LIBTIFF_VERSION_FULL}") |
| 38 |
|
| 39 |
# Project definition |
| 40 |
set(CMAKE_C_STANDARD 99) |
| 41 |
project(tiff |
| 42 |
VERSION "${LIBTIFF_VERSION}" |
| 43 |
LANGUAGES C CXX) |
| 44 |
|
| 45 |
if(NOT CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) |
| 46 |
# libtiff is being included as a subproject of some other project. |
| 47 |
set(TIFF_INSTALL_DEFAULT OFF) |
| 48 |
else() |
| 49 |
set(TIFF_INSTALL_DEFAULT ON) |
| 50 |
option(BUILD_SHARED_LIBS "Build shared libraries" ON) |
| 51 |
endif() |
| 52 |
|
| 53 |
option(tiff-tools "build TIFF tools" ON) |
| 54 |
option(tiff-tests "build TIFF tests" ON) |
| 55 |
option(tiff-contrib "build TIFF contrib" ON) |
| 56 |
option(tiff-docs "build TIFF documentation" ON) |
| 57 |
option(tiff-deprecated "build TIFF deprecated features" OFF) |
| 58 |
option(tiff-install "install TIFF targets" ${TIFF_INSTALL_DEFAULT}) |
| 59 |
|
| 60 |
# Disable deprecated features to ensure clean build |
| 61 |
if (tiff-deprecated) |
| 62 |
add_definitions(-DTIFF_DISABLE_DEPRECATED) |
| 63 |
endif() |
| 64 |
|
| 65 |
# Autotools compatibility |
| 66 |
include(AutotoolsCompat) |
| 67 |
|
| 68 |
# Compiler checks (warning flags, etc.) |
| 69 |
include(CompilerChecks) |
| 70 |
|
| 71 |
# Linker checks (version script, etc.) |
| 72 |
include(LinkerChecks) |
| 73 |
|
| 74 |
# Processor checks (endianness, fill order, floating point, etc.) |
| 75 |
include(ProcessorChecks) |
| 76 |
|
| 77 |
# Checks for headers |
| 78 |
include(IncludeChecks) |
| 79 |
|
| 80 |
# Checks for functions and other symbols |
| 81 |
include(SymbolChecks) |
| 82 |
|
| 83 |
# Standard installation paths |
| 84 |
include(GNUInstallDirs) |
| 85 |
# Documentation install directory (default to cmake project docdir) |
| 86 |
set(LIBTIFF_DOCDIR "${CMAKE_INSTALL_DOCDIR}") |
| 87 |
|
| 88 |
# CTest testing |
| 89 |
enable_testing() |
| 90 |
|
| 91 |
# Checks for type presence and size |
| 92 |
include(TypeSizeChecks) |
| 93 |
|
| 94 |
# Check for POSIX Large File Support (LFS) |
| 95 |
include(LargeFileSupport) |
| 96 |
|
| 97 |
# Options for internal codec support |
| 98 |
include(InternalCodecs) |
| 99 |
|
| 100 |
# Check for Deflate codec |
| 101 |
include(DeflateCodec) |
| 102 |
|
| 103 |
# Check for PixarLog codec |
| 104 |
include(PixarLogCodec) |
| 105 |
|
| 106 |
# Check for JPEG codec |
| 107 |
include(JPEGCodec) |
| 108 |
|
| 109 |
# Check for JBIG codec |
| 110 |
include(JBIGCodec) |
| 111 |
|
| 112 |
# Check for LERC codec |
| 113 |
include(LERCCodec) |
| 114 |
|
| 115 |
# Check for LZMA codec |
| 116 |
include(LZMACodec) |
| 117 |
|
| 118 |
# Check for ZSTD codec |
| 119 |
include(ZSTDCodec) |
| 120 |
|
| 121 |
# Check for WebP codec |
| 122 |
include(WebPCodec) |
| 123 |
|
| 124 |
# Option for C++ libtiffxx library |
| 125 |
include(CXXLibrary) |
| 126 |
|
| 127 |
# Checks for OpenGL support |
| 128 |
include(OpenGLChecks) |
| 129 |
|
| 130 |
# Windows support |
| 131 |
include(WindowsSupport) |
| 132 |
|
| 133 |
# Orthogonal features |
| 134 |
include(LibraryFeatures) |
| 135 |
|
| 136 |
|
| 137 |
# math.h/libm portability |
| 138 |
find_package(CMath REQUIRED) |
| 139 |
|
| 140 |
# Release support |
| 141 |
include(Release) |
| 142 |
|
| 143 |
# Process subdirectories |
| 144 |
add_subdirectory(port) |
| 145 |
add_subdirectory(libtiff) |
| 146 |
if(tiff-tools) |
| 147 |
add_subdirectory(tools) |
| 148 |
endif() |
| 149 |
if(tiff-tests) |
| 150 |
add_subdirectory(test) |
| 151 |
endif() |
| 152 |
if(tiff-contrib) |
| 153 |
add_subdirectory(contrib) |
| 154 |
endif() |
| 155 |
add_subdirectory(build) |
| 156 |
if(tiff-docs) |
| 157 |
add_subdirectory(doc) |
| 158 |
endif() |
| 159 |
|
| 160 |
# pkg-config support |
| 161 |
include(PkgConfig) |
| 162 |
|
| 163 |
message(STATUS "") |
| 164 |
message(STATUS "Libtiff is now configured for ${CMAKE_SYSTEM}") |
| 165 |
message(STATUS "") |
| 166 |
if (NOT LIBTIFF_RELEASE_VERSION STREQUAL LIBTIFF_VERSION_FULL) |
| 167 |
message(STATUS " Libtiff release version ${LIBTIFF_RELEASE_VERSION} is not equal to build version!") |
| 168 |
endif() |
| 169 |
message(STATUS " Libtiff build version: ${LIBTIFF_VERSION_FULL}") |
| 170 |
message(STATUS " Libtiff library version: ${SO_VERSION}") |
| 171 |
message(STATUS " Libtiff release date: ${LIBTIFF_RELEASE_DATE}") |
| 172 |
message(STATUS "") |
| 173 |
message(STATUS " Installation directory: ${prefix}") |
| 174 |
message(STATUS " Documentation directory: ${LIBTIFF_DOCDIR}") |
| 175 |
message(STATUS " C compiler: ${CMAKE_C_COMPILER}") |
| 176 |
message(STATUS " C++ compiler: ${CMAKE_CXX_COMPILER}") |
| 177 |
message(STATUS " Build shared libraries: ${BUILD_SHARED_LIBS}") |
| 178 |
message(STATUS " Build tools: ${tiff-tools}") |
| 179 |
message(STATUS " Build tests: ${tiff-tests}") |
| 180 |
message(STATUS " Build contrib: ${tiff-contrib}") |
| 181 |
message(STATUS " Build docs: ${tiff-docs}") |
| 182 |
message(STATUS " Build deprecated features: ${tiff-deprecated}") |
| 183 |
message(STATUS " Enable linker symbol versioning: ${HAVE_LD_VERSION_SCRIPT}") |
| 184 |
message(STATUS " Support Microsoft Document Imaging: ${mdi}") |
| 185 |
message(STATUS " Use win32 IO: ${USE_WIN32_FILEIO}") |
| 186 |
message(STATUS "") |
| 187 |
message(STATUS " Support for internal codecs:") |
| 188 |
message(STATUS " CCITT Group 3 & 4 algorithms: ${ccitt}") |
| 189 |
message(STATUS " Macintosh PackBits algorithm: ${packbits}") |
| 190 |
message(STATUS " LZW algorithm: ${lzw}") |
| 191 |
message(STATUS " ThunderScan 4-bit RLE algorithm: ${thunder}") |
| 192 |
message(STATUS " NeXT 2-bit RLE algorithm: ${next}") |
| 193 |
message(STATUS " LogLuv high dynamic range encoding: ${logluv}") |
| 194 |
message(STATUS "") |
| 195 |
message(STATUS " Support for external codecs:") |
| 196 |
message(STATUS " ZLIB support: Requested:${zlib} Availability:${ZLIB_FOUND} Support:${ZLIB_SUPPORT}") |
| 197 |
if(ZLIB_SUPPORT) |
| 198 |
message(STATUS " libdeflate support: Requested:${libdeflate} Availability:${DEFLATE_FOUND} Support:${LIBDEFLATE_SUPPORT}") |
| 199 |
else() |
| 200 |
message(STATUS " libdeflate support: Requested:${libdeflate} Availability:${DEFLATE_FOUND} Support:${LIBDEFLATE_SUPPORT} (Depends on ZLIB Support)") |
| 201 |
endif() |
| 202 |
if(ZLIB_SUPPORT) |
| 203 |
message(STATUS " Pixar log-format algorithm: Requested:${pixarlog} Availability:${ZLIB_FOUND} Support:${PIXARLOG_SUPPORT}") |
| 204 |
else() |
| 205 |
message(STATUS " Pixar log-format algorithm: Requested:${pixarlog} Availability:${ZLIB_FOUND} Support:${PIXARLOG_SUPPORT} (Depends on ZLIB Support)") |
| 206 |
endif() |
| 207 |
message(STATUS " JPEG support: Requested:${jpeg} Availability:${JPEG_FOUND} Support:${JPEG_SUPPORT}") |
| 208 |
if(JPEG_SUPPORT) |
| 209 |
message(STATUS " Old JPEG support: Requested:${old-jpeg} Availability:${JPEG_SUPPORT} Support:${OJPEG_SUPPORT}") |
| 210 |
else() |
| 211 |
message(STATUS " Old JPEG support: Requested:${old-jpeg} Availability:${JPEG_SUPPORT} Support:${OJPEG_SUPPORT} (Depends on JPEG Support)") |
| 212 |
endif() |
| 213 |
if(JPEG_SUPPORT AND HAVE_JPEGTURBO_DUAL_MODE_8_12) |
| 214 |
message(STATUS " JPEG 8/12 bit dual mode: Support: yes (libjpeg turbo >= 3.0 dual mode)") |
| 215 |
else() |
| 216 |
message(STATUS " JPEG 8/12 bit dual mode: Requested:${jpeg12} Availability:${JPEG12_FOUND} Support:${JPEG_DUAL_MODE_8_12}") |
| 217 |
endif() |
| 218 |
message(STATUS " ISO JBIG support: Requested:${jbig} Availability:${JBIG_FOUND} Support:${JBIG_SUPPORT}") |
| 219 |
if(ZLIB_SUPPORT) |
| 220 |
message(STATUS " LERC support: Requested:${lerc} Availability:${LERC_FOUND} Support:${LERC_SUPPORT}") |
| 221 |
else() |
| 222 |
message(STATUS " LERC support: Requested:${lerc} Availability:${LERC_FOUND} Support:${LERC_SUPPORT} (Depends on ZLIB Support)") |
| 223 |
endif() |
| 224 |
message(STATUS " LZMA2 support: Requested:${lzma} Availability:${liblzma_FOUND} Support:${LZMA_SUPPORT}") |
| 225 |
message(STATUS " ZSTD support: Requested:${zstd} Availability:${ZSTD_USABLE} Support:${ZSTD_SUPPORT}") |
| 226 |
message(STATUS " WEBP support: Requested:${webp} Availability:${WebP_FOUND} Support:${WEBP_SUPPORT}") |
| 227 |
message(STATUS "") |
| 228 |
message(STATUS " C++ support: ${cxx} (requested) ${CXX_SUPPORT} (availability)") |
| 229 |
message(STATUS "") |
| 230 |
# message(STATUS " X Athena Widgets support: ${HAVE_XAW}") |
| 231 |
message(STATUS " OpenGL support: Requested:${tiff-opengl} Availability:${HAVE_OPENGL} Support:${OPENGL_SUPPORT}") |
| 232 |
message(STATUS "") |