diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000..bdd443d6 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,660 @@ +# CMake build for libtiff +# Run "cmake" to generate the build files for your platform +# +# Copyright © 2015 Open Microscopy Environment / University of Dundee +# Written by Roger Leigh +# +# Permission to use, copy, modify, distribute, and sell this software and +# its documentation for any purpose is hereby granted without fee, provided +# that (i) the above copyright notices and this permission notice appear in +# all copies of the software and related documentation, and (ii) the names of +# Sam Leffler and Silicon Graphics may not be used in any advertising or +# publicity relating to the software without the specific, prior written +# permission of Sam Leffler and Silicon Graphics. +# +# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, +# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY +# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. +# +# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR +# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, +# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF +# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE +# OF THIS SOFTWARE. + +cmake_minimum_required(VERSION 3.0.0) + +# Default policy is from 3.0.0 +cmake_policy(VERSION 3.0.0) +# Set MacOSX @rpath usage globally. +if (POLICY CMP0020) + cmake_policy(SET CMP0020 NEW) +endif(POLICY CMP0020) +if (POLICY CMP0042) + cmake_policy(SET CMP0042 NEW) +endif(POLICY CMP0042) +# Use new variable expansion policy. +if (POLICY CMP0053) + cmake_policy(SET CMP0053 NEW) +endif(POLICY CMP0053) +if (POLICY CMP0054) + cmake_policy(SET CMP0054 NEW) +endif(POLICY CMP0054) + +# Project version +project(tiff VERSION 4.0.4 LANGUAGES C) +# the other tiff_VERSION_* variables are set automatically +set(tiff_VERSION_ALPHA beta) +# Library version (unlike libtool's baroque scheme, WYSIWYG here) +set(SO_COMPATVERSION 5) +set(SO_VERSION 5.2.1) + +# For autotools header compatibility +set(PACKAGE_NAME "LibTIFF Software") +set(PACKAGE_TARNAME "${PROJECT_NAME}") +set(PACKAGE_VERSION "${PROJECT_VERSION}${tiff_VERSION_ALPHA}") +set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") +set(PACKAGE_BUGREPORT "tiff@lists.maptools.org") + +include(GNUInstallDirs) +include(CheckCSourceCompiles) +include(CheckIncludeFile) +include(CheckTypeSize) +include(CheckFunctionExists) +enable_testing() + +macro(current_date var) + if(UNIX) + execute_process(COMMAND "date" +"%Y%m%d" OUTPUT_VARIABLE ${var}) + endif() +endmacro() + +current_date(RELEASE_DATE) + +macro(extra_dist) + foreach(file ${ARGV}) + file(RELATIVE_PATH relfile "${PROJECT_SOURCE_DIR}" + "${CMAKE_CURRENT_SOURCE_DIR}/${file}") + list(APPEND EXTRA_DIST "${relfile}") + endforeach() + set(EXTRA_DIST "${EXTRA_DIST}" PARENT_SCOPE) +endmacro() + +set(EXTRA_DIST + HOWTO-RELEASE + Makefile.vc + SConstruct + autogen.sh + configure.com + nmake.opt + libtiff-4.pc.in) + +# Check if LD supports linker scripts. +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/conftest.map" "VERS_1 { + global: sym; +}; + +VERS_2 { + global: sym; +} VERS_1; +") +set(CMAKE_REQUIRED_FLAGS_SAVE ${CMAKE_REQUIRED_FLAGS}) +set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} "-Wl,--version-script=${CMAKE_CURRENT_BINARY_DIR}/conftest.map") +check_c_source_compiles("int main(void){return 0;}" HAVE_LD_VERSION_SCRIPT) +set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_SAVE}) +file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/conftest.map") +if (HAVE_LD_VERSION_SCRIPT) + set(HAVE_LD_VERSION_SCRIPT TRUE) +else() + set(HAVE_LD_VERSION_SCRIPT FALSE) +endif() + +# Find libm, if available +find_library(M_LIBRARY m) + +check_include_file(assert.h HAVE_ASSERT_H) +check_include_file(dlfcn.h HAVE_DLFCN_H) +check_include_file(fcntl.h HAVE_FCNTL_H) +check_include_file(inttypes.h HAVE_INTTYPES_H) +check_include_file(io.h HAVE_IO_H) +check_include_file(limits.h HAVE_LIMITS_H) +check_include_file(malloc.h HAVE_MALLOC_H) +check_include_file(memory.h HAVE_MEMORY_H) +check_include_file(search.h HAVE_SEARCH_H) +check_include_file(stdint.h HAVE_STDINT_H) +check_include_file(string.h HAVE_STRING_H) +check_include_file(strings.h HAVE_STRINGS_H) +check_include_file(sys/time.h HAVE_SYS_TIME_H) +check_include_file(sys/types.h HAVE_SYS_TYPES_H) +check_include_file(unistd.h HAVE_UNISTD_H) + +# Inspired from /usr/share/autoconf/autoconf/c.m4 +foreach(inline_keyword "inline" "__inline__" "__inline") + if(NOT DEFINED C_INLINE) + set(CMAKE_REQUIRED_DEFINITIONS_SAVE ${CMAKE_REQUIRED_DEFINITIONS}) + set(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} + "-Dinline=${inline_keyword}") + check_c_source_compiles(" + typedef int foo_t; + static inline foo_t static_foo() {return 0;} + foo_t foo(){return 0;} + int main(int argc, char *argv[]) {return 0;}" + C_HAS_${inline_keyword}) + set(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS_SAVE}) + if(C_HAS_${inline_keyword}) + set(C_INLINE TRUE) + set(INLINE_KEYWORD "${inline_keyword}") + endif() + endif() +endforeach() +if(NOT DEFINED C_INLINE) + set(INLINE_KEYWORD) +endif() + +# off_t and size_t checks omitted; not clear they are used at all +# Are off_t and size_t checks strictly necessary? + +# Check if sys/time.h and time.h allow use together +check_c_source_compiles(" +#include +#include +int main(void){return 0;}" + TIME_WITH_SYS_TIME) + +# Check if struct tm is in sys/time.h +check_c_source_compiles(" +#include +#include + +int main(void){ + struct tm tm; + int *p = &tm.tm_sec; + return !p; +}" + TM_IN_SYS_TIME) + +# Check type sizes +# NOTE: Could be replaced with C99 +check_type_size("signed short" SIZEOF_SIGNED_SHORT) +check_type_size("unsigned short" SIZEOF_UNSIGNED_SHORT) +check_type_size("signed int" SIZEOF_SIGNED_INT) +check_type_size("unsigned int" SIZEOF_UNSIGNED_INT) +check_type_size("signed long" SIZEOF_SIGNED_LONG) +check_type_size("unsigned long" SIZEOF_UNSIGNED_LONG) +check_type_size("signed long long" SIZEOF_SIGNED_LONG_LONG) +check_type_size("unsigned long long" SIZEOF_UNSIGNED_LONG_LONG) +check_type_size("unsigned char *" SIZEOF_UNSIGNED_CHAR_P) + +set(CMAKE_EXTRA_INCLUDE_FILES_SAVE ${CMAKE_EXTRA_INCLUDE_FILES}) +set(CMAKE_EXTRA_INCLUDE_FILES ${CMAKE_EXTRA_INCLUDE_FILES} "stddef.h") +check_type_size("size_t" SIZEOF_SIZE_T) +check_type_size("ptrdiff_t" SIZEOF_PTRDIFF_T) +set(CMAKE_EXTRA_INCLUDE_FILES ${CMAKE_EXTRA_INCLUDE_FILES_SAVE}) + +macro(report_values) + foreach(val ${ARGV}) + message(STATUS "${val} set to ${${val}}") + endforeach() +endmacro() + +set(TIFF_INT8_T "signed char") +set(TIFF_UINT8_T "unsigned char") + +set(TIFF_INT16_T "signed short") +set(TIFF_UINT16_T "unsigned short") + +if(SIZEOF_SIGNED_INT EQUAL 4) + set(TIFF_INT32_T "signed int") + set(TIFF_INT32_FORMAT "%d") +elseif(SIZEOF_SIGNED_LONG EQUAL 4) + set(TIFF_INT32_T "signed long") + set(TIFF_INT32_FORMAT "%ld") +endif() + +if(SIZEOF_UNSIGNED_INT EQUAL 4) + set(TIFF_UINT32_T "unsigned int") + set(TIFF_UINT32_FORMAT "%u") +elseif(SIZEOF_UNSIGNED_LONG EQUAL 4) + set(TIFF_UINT32_T "unsigned long") + set(TIFF_UINT32_FORMAT "%lu") +endif() + +if(SIZEOF_SIGNED_LONG EQUAL 8) + set(TIFF_INT64_T "signed long") + set(TIFF_INT64_FORMAT "%ld") +elseif(SIZEOF_SIGNED_LONG_LONG EQUAL 8) + set(TIFF_INT64_T "signed long long") + if (MINGW) + set(TIFF_INT64_FORMAT "%I64d") + else() + set(TIFF_INT64_FORMAT "%lld") + endif() +endif() + +if(SIZEOF_UNSIGNED_LONG EQUAL 8) + set(TIFF_UINT64_T "unsigned long") + set(TIFF_UINT64_FORMAT "%lu") +elseif(SIZEOF_UNSIGNED_LONG_LONG EQUAL 8) + set(TIFF_UINT64_T "unsigned long long") + if (MINGW) + set(TIFF_UINT64_FORMAT "%I64u") + else() + set(TIFF_UINT64_FORMAT "%llu") + endif() +endif() + +if(SIZEOF_UNSIGNED_INT EQUAL SIZEOF_SIZE_T) + set(TIFF_SIZE_T "unsigned int") + set(TIFF_SIZE_FORMAT "%u") +elseif(SIZEOF_UNSIGNED_LONG EQUAL SIZEOF_SIZE_T) + set(TIFF_SIZE_T "unsigned long") + set(TIFF_SIZE_FORMAT "%lu") +elseif(SIZEOF_UNSIGNED_LONG_LONG EQUAL SIZEOF_SIZE_T) + set(TIFF_SIZE_T "unsigned long") + if (MINGW) + set(TIFF_SIZE_FORMAT "%I64u") + else() + set(TIFF_SIZE_FORMAT "%llu") + endif() +endif() + +if(SIZEOF_SIGNED_INT EQUAL SIZEOF_UNSIGNED_CHAR_P) + set(TIFF_SSIZE_T "signed int") + set(TIFF_SSIZE_FORMAT "%d") +elseif(SIZEOF_SIGNED_LONG EQUAL SIZEOF_UNSIGNED_CHAR_P) + set(TIFF_SSIZE_T "signed long") + set(TIFF_SSIZE_FORMAT "%ld") +elseif(SIZEOF_SIGNED_LONG_LONG EQUAL SIZEOF_UNSIGNED_CHAR_P) + set(TIFF_SSIZE_T "signed long long") + if (MINGW) + set(TIFF_SSIZE_FORMAT "%I64d") + else() + set(TIFF_SSIZE_FORMAT "%lld") + endif() +endif() + +if(NOT SIZEOF_PTRDIFF_T) + set(TIFF_PTRDIFF_T "${TIFF_SSIZE_T}") + set(TIFF_PTRDIFF_FORMAT "${SSIZE_FORMAT}") +else() + set(TIFF_PTRDIFF_T "ptrdiff_t") + set(TIFF_PTRDIFF_FORMAT "%ld") +endif() + +#report_values(TIFF_INT8_T TIFF_INT8_FORMAT +# TIFF_UINT8_T TIFF_UINT8_FORMAT +# TIFF_INT16_T TIFF_INT16_FORMAT +# TIFF_UINT16_T TIFF_UINT16_FORMAT +# TIFF_INT32_T TIFF_INT32_FORMAT +# TIFF_UINT32_T TIFF_UINT32_FORMAT +# TIFF_INT64_T TIFF_INT64_FORMAT +# TIFF_UINT64_T TIFF_UINT64_FORMAT +# TIFF_SSIZE_T TIFF_SSIZE_FORMAT +# TIFF_PTRDIFF_T TIFF_PTRDIFF_FORMAT) + +# Nonstandard int types +check_type_size(INT8 int8) +set(HAVE_INT8 ${INT8}) +check_type_size(INT16 int16) +set(HAVE_INT16 ${INT16}) +check_type_size(INT32 int32) +set(HAVE_INT32 ${INT32}) + +# Check functions +set(CMAKE_REQUIRED_LIBRARIES_SAVE ${CMAKE_REQUIRED_LIBRARIES}) +set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${M_LIBRARY}) +check_function_exists(floor HAVE_FLOOR) +check_function_exists(pow HAVE_POW) +check_function_exists(sqrt HAVE_SQRT) +set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES_SAVE}) + +check_function_exists(isascii HAVE_ISASCII) +check_function_exists(memmove HAVE_MEMMOVE) +check_function_exists(memset HAVE_MEMSET) +check_function_exists(mmap HAVE_MMAP) +check_function_exists(setmode HAVE_SETMODE) +check_function_exists(snprintf HAVE_SNPRINTF) +check_function_exists(strcasecmp HAVE_STRCASECMP) +check_function_exists(strchr HAVE_STRCHR) +check_function_exists(strrchr HAVE_STRRCHR) +check_function_exists(strstr HAVE_STRSTR) +check_function_exists(strtol HAVE_STRTOL) +check_function_exists(strtol HAVE_STRTOUL) +check_function_exists(strtoull HAVE_STRTOULL) +check_function_exists(getopt HAVE_GETOPT) +check_function_exists(lfind HAVE_LFIND) + +# VS2013 has a usable _snprintf +if(NOT MSVC_VERSION VERSION_LESS 1800 AND MSVC_VERSION VERSION_LESS 1900) + check_function_exists(_snprintf HAVE__SNPRINTF) +endif() + +# CPU bit order +set(fillorder FILLORDER_MSB2LSB) +if(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "i.*86.*" OR + CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "amd64.*" OR + CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "x86_64.*") + set(fillorder FILLORDER_LSB2MSB) +endif() +set(HOST_FILLORDER ${fillorder} CACHE STRING "Native CPU bit order") +mark_as_advanced(HOST_FILLORDER) + +# CPU endianness +include(TestBigEndian) +test_big_endian(bigendian) +if (bigendian) + set(bigendian ON) +else() + set(bigendian OFF) +endif() +set(HOST_BIG_ENDIAN ${bigendian} CACHE STRING "Native CPU bit order") +mark_as_advanced(HOST_BIG_ENDIAN) +if (HOST_BIG_ENDIAN) + set(HOST_BIG_ENDIAN 1) +else() + set(HOST_BIG_ENDIAN 0) +endif() + +# IEEE floating point +set(HAVE_IEEEFP 1 CACHE STRING "IEEE floating point is available") +mark_as_advanced(HAVE_IEEEFP) + +report_values(CMAKE_HOST_SYSTEM_PROCESSOR HOST_FILLORDER + HOST_BIG_ENDIAN HAVE_IEEEFP) + +# Large file support +if (UNIX) + # This might not catch every possibility catered for by + # AC_SYS_LARGEFILE. + add_definitions(-D_FILE_OFFSET_BITS=64) + set(FILE_OFFSET_BITS 64) +endif() + +# Documentation install directory (default to cmake project docdir) +set(LIBTIFF_DOCDIR "${CMAKE_INSTALL_FULL_DOCDIR}") + +# Options to enable and disable internal codecs + +option(ccitt "support for CCITT Group 3 & 4 algorithms" ON) +set(CCITT_SUPPORT ${ccitt}) + +option(packbits "support for Macintosh PackBits algorithm" ON) +set(PACKBITS_SUPPORT ${packbits}) + +option(lzw "support for LZW algorithm" ON) +set(LZW_SUPPORT ${lzw}) + +option(thunder "support for ThunderScan 4-bit RLE algorithm" ON) +set(THUNDER_SUPPORT ${thunder}) + +option(next "support for NeXT 2-bit RLE algorithm" ON) +set(NEXT_SUPPORT ${next}) + +option(logluv "support for LogLuv high dynamic range algorithm" ON) +set(LOGLUV_SUPPORT ${logluv}) + +# Option for Microsoft Document Imaging +option(mdi "support for Microsoft Document Imaging" ON) +set(MDI_SUPPORT ${mdi}) + +# ZLIB +option(zlib "use zlib (required for Deflate compression)" ON) +if (zlib) + find_package(ZLIB) +endif() +set(ZLIB_SUPPORT 0) +if(ZLIB_FOUND) + set(ZLIB_SUPPORT 1) +endif() +set(ZIP_SUPPORT ${ZLIB_SUPPORT}) +# Option for Pixar log-format algorithm + +# Pixar log format +option(pixarlog "support for Pixar log-format algorithm (requires Zlib)" ON) +set(PIXARLOG_SUPPORT FALSE) +if (ZLIB_SUPPORT) + if(pixarlog) + set(PIXARLOG_SUPPORT TRUE) + endif() +endif() + +# JPEG +option(jpeg "use libjpeg (required for JPEG compression)" ON) +if (jpeg) + find_package(JPEG) +endif() +set(JPEG_SUPPORT FALSE) +if(JPEG_FOUND) + set(JPEG_SUPPORT TRUE) +endif() + +option(old-jpeg "support for Old JPEG compression (read-only)" ON) +set(OJPEG_SUPPORT FALSE) +if (JPEG_SUPPORT) + if (old-jpeg) + set(OJPEG_SUPPORT TRUE) + endif() +endif() + +# JBIG-KIT +option(jbig "use ISO JBIG compression (requires JBIT-KIT library)" ON) +if (jbig) + set(JBIG_FOUND 0) + find_path(JBIG_INCLUDE_DIR jbig.h) + set(JBIG_NAMES ${JBIG_NAMES} jbig libjbig) + find_library(JBIG_LIBRARY NAMES ${JBIG_NAMES}) + if (JBIG_INCLUDE_DIR AND JBIG_LIBRARY) + set(JBIG_FOUND 1) + set(JBIG_LIBRARIES ${JBIG_LIBRARY}) + endif() +endif() +set(JBIG_SUPPORT 0) +if(JBIG_FOUND) + set(JBIG_FOUND TRUE) + set(JBIG_SUPPORT 1) +else() + set(JBIG_FOUND FALSE) +endif() + +set(CMAKE_REQUIRED_LIBRARIES_SAVE ${CMAKE_REQUIRED_LIBRARIES}) +set(CMAKE_REQUIRED_INCLUDES_SAVE ${CMAKE_REQUIRED_INCLUDES}) +set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${JBIG_INCLUDE_DIR}) +set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${JBIG_LIBRARY}) +check_function_exists(jbg_newlen HAVE_JBG_NEWLEN) +set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES_SAVE}) +set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SAVE}) + +# liblzma2 +option(lzma "use liblzma (required for LZMA2 compression)" ON) +if (lzma) + find_package(LibLZMA) +endif() +set(LZMA_SUPPORT 0) +if(LIBLZMA_FOUND) + set(LZMA_SUPPORT 1) +endif() + +# 8/12-bit jpeg mode +option(jpeg12 "enable libjpeg 8/12-bit dual mode (requires separate +12-bit libjpeg build)" ON) +set(JPEG12_INCLUDE_DIR JPEG12_INCLUDE_DIR-NOTFOUND CACHE PATH "Include directory for 12-bit libjpeg") +set(JPEG12_LIBRARY JPEG12_LIBRARY-NOTFOUND CACHE FILEPATH "12-bit libjpeg library") +set(JPEG12_FOUND FALSE) +if (JPEG12_INCLUDE_DIR AND JPEG12_LIBRARY) + set(JPEG12_LIBRARIES ${JPEG12_LIBRARY}) + set(JPEG12_FOUND TRUE) +endif() +if (JPEG12_FOUND) + set(JPEG_DUAL_MODE_8_12 1) + set(LIBJPEG_12_PATH "${JPEG12_INCLUDE_DIR}/jpeglib.h") +endif() + +# C++ support +option(cxx "Enable C++ stream API building (requires C++ compiler)" ON) +set(CXX_SUPPORT FALSE) +if (cxx) + enable_language(CXX) + set(CXX_SUPPORT TRUE) +endif() + +# OpenGL and GLUT +find_package(OpenGL) +find_package(GLUT) +set(HAVE_OPENGL FALSE) +if(OPENGL_FOUND AND OPENGL_GLU_FOUND AND GLUT_FOUND) + set(HAVE_OPENGL TRUE) +endif() +# Purely to satisfy the generated headers: +check_include_file(GL/gl.h HAVE_GL_GL_H) +check_include_file(GL/glu.h HAVE_GL_GLU_H) +check_include_file(GL/glut.h HAVE_GL_GLUT_H) +check_include_file(GLUT/glut.h HAVE_GLUT_GLUT_H) +check_include_file(OpenGL/gl.h HAVE_OPENGL_GL_H) +check_include_file(OpenGL/glu.h HAVE_OPENGL_GLU_H) + +# Win32 IO +set(win32_io FALSE) +if(WIN32) + set(win32_io TRUE) +endif() +set(USE_WIN32_FILEIO ${win32_io} CACHE BOOL "Use win32 IO system (Microsoft Windows only)") +if (USE_WIN32_FILEIO) + set(USE_WIN32_FILEIO TRUE) +else() + set(USE_WIN32_FILEIO FALSE) +endif() + +# Orthogonal features + +# Strip chopping +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) +set(TIFF_DEFAULT_STRIP_SIZE 8192 CACHE STRING "default size of the strip in bytes (when strip chopping is enabled)") + +set(STRIPCHOP_DEFAULT) +if(strip-chopping) + set(STRIPCHOP_DEFAULT TRUE) + if(TIFF_DEFAULT_STRIP_SIZE) + set(STRIP_SIZE_DEFAULT "${TIFF_DEFAULT_STRIP_SIZE}") + endif() +endif() + +# Defer loading of strip/tile offsets +option(defer-strile-load "enable deferred strip/tile offset/size loading (experimental)" OFF) +set(DEFER_STRILE_LOAD ${defer-strile-load}) + +# CHUNKY_STRIP_READ_SUPPORT +option(chunky-strip-read "enable reading large strips in chunks for TIFFReadScanline() (experimental)" OFF) +set(CHUNKY_STRIP_READ_SUPPORT ${chunky-strip-read}) + +# SUBIFD support +set(SUBIFD_SUPPORT 1) + +# Default handling of ASSOCALPHA support. +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) +if(extrasample-as-alpha) + set(DEFAULT_EXTRASAMPLE_AS_ALPHA 1) +endif() + +# Default handling of YCbCr subsampling support. +# See Bug 168 in Bugzilla, and JPEGFixupTestSubsampling() for details. +option(check-ycbcr-subsampling "enable picking up YCbCr subsampling info from the JPEG data stream to support files lacking the tag" ON) +if (check-ycbcr-subsampling) + set(CHECK_JPEG_YCBCR_SUBSAMPLING 1) +endif() + +# Generate pkg-config file +set(prefix "${CMAKE_INSTALL_PREFIX}") +set(exec_prefix "${CMAKE_INSTALL_PREFIX}") +set(libdir "${CMAKE_INSTALL_FULL_LIBDIR}") +set(includedir "${CMAKE_INSTALL_FULL_INCLUDEDIR}") +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libtiff-4.pc.in + ${CMAKE_CURRENT_BINARY_DIR}/libtiff-4.pc) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libtiff-4.pc + DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig") + +# Includes used by libtiff (and tests) +if(ZLIB_INCLUDE_DIRS) + list(APPEND TIFF_INCLUDES ${ZLIB_INCLUDE_DIRS}) +endif() +if(JPEG_INCLUDE_DIR) + list(APPEND TIFF_INCLUDES ${JPEG_INCLUDE_DIR}) +endif() +if(JPEG12_INCLUDE_DIR) + list(APPEND TIFF_INCLUDES ${JPEG12_INCLUDE_DIR}) +endif() +if(JBIG_INCLUDE_DIR) + list(APPEND TIFF_INCLUDES ${JBIG_INCLUDE_DIR}) +endif() +if(LIBLZMA_INCLUDE_DIRS) + list(APPEND TIFF_INCLUDES ${LIBLZMA_INCLUDE_DIRS}) +endif() + +# Libraries required by libtiff +set(TIFF_LIBRARY_DEPS) +if(M_LIBRARY) + list(APPEND TIFF_LIBRARY_DEPS ${M_LIBRARY}) +endif() +if(ZLIB_LIBRARIES) + list(APPEND TIFF_LIBRARY_DEPS ${ZLIB_LIBRARIES}) +endif() +if(JPEG_LIBRARIES) + list(APPEND TIFF_LIBRARY_DEPS ${JPEG_LIBRARIES}) +endif() +if(JPEG12_LIBRARIES) + list(APPEND TIFF_LIBRARY_DEPS ${JPEG12_LIBRARIES}) +endif() +if(JBIG_LIBRARIES) + list(APPEND TIFF_LIBRARY_DEPS ${JBIG_LIBRARIES}) +endif() +if(LIBLZMA_LIBRARIES) + list(APPEND TIFF_LIBRARY_DEPS ${LIBLZMA_LIBRARIES}) +endif() + +#report_values(TIFF_INCLUDES TIFF_LIBRARY_DEPS) + +# Process subdirectories +add_subdirectory(port) +add_subdirectory(libtiff) +add_subdirectory(tools) +add_subdirectory(test) +add_subdirectory(contrib) +add_subdirectory(build) +add_subdirectory(man) +add_subdirectory(html) + +#message(STATUS "EXTRA_DIST: ${EXTRA_DIST}") + +message(STATUS "") +message(STATUS "Libtiff is now configured for ${host}") +message(STATUS "") +message(STATUS " Installation directory: ${prefix}") +message(STATUS " Documentation directory: ${LIBTIFF_DOCDIR}") +message(STATUS " C compiler: ${CMAKE_C_COMPILER}") +message(STATUS " C++ compiler: ${CMAKE_CXX_COMPILER}") +message(STATUS " Enable linker symbol versioning: ${HAVE_LD_VERSION_SCRIPT}") +message(STATUS " Support Microsoft Document Imaging: ${mdi}") +message(STATUS " Use win32 IO: ${USE_WIN32_FILEIO}") +message(STATUS "") +message(STATUS " Support for internal codecs:") +message(STATUS " CCITT Group 3 & 4 algorithms: ${ccitt}") +message(STATUS " Macintosh PackBits algorithm: ${packbits}") +message(STATUS " LZW algorithm: ${lzw}") +message(STATUS " ThunderScan 4-bit RLE algorithm: ${thunder}") +message(STATUS " NeXT 2-bit RLE algorithm: ${next}") +message(STATUS " LogLuv high dynamic range encoding: ${logluv}") +message(STATUS "") +message(STATUS " Support for external codecs:") +message(STATUS " ZLIB support: ${zlib} (requested) ${ZLIB_FOUND} (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 "") +message(STATUS " C++ support: ${cxx} (requested) ${CXX_SUPPORT} (availability)") +message(STATUS "") +# message(STATUS " X Athena Widgets support: ${HAVE_XAW}") +message(STATUS " OpenGL support: ${HAVE_OPENGL}") +message(STATUS "") diff --git a/ChangeLog b/ChangeLog index c7ffe40e..3f91fa16 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2015-06-24 Bob Friesenhahn + + * CMakeLists.txt: Add CMake patchset by Roger Leigh as posted to + libtiff mailing list on Mon, 22 Jun 2015 21:21:01 +0100. Several + corrections to ensure that the autotools build still works were + added by me. I have not yet tested the build using 'cmake' or + MSVC with 'nmake'. + 2015-06-21 Bob Friesenhahn * test/Makefile.am: tiff2rgba-quad-tile.jpg.sh depends on the JPEG diff --git a/build/CMakeLists.txt b/build/CMakeLists.txt new file mode 100644 index 00000000..d44c6eac --- /dev/null +++ b/build/CMakeLists.txt @@ -0,0 +1,25 @@ +# CMake build for libtiff +# +# Copyright © 2015 Open Microscopy Environment / University of Dundee +# Written by Roger Leigh +# +# Permission to use, copy, modify, distribute, and sell this software and +# its documentation for any purpose is hereby granted without fee, provided +# that (i) the above copyright notices and this permission notice appear in +# all copies of the software and related documentation, and (ii) the names of +# Sam Leffler and Silicon Graphics may not be used in any advertising or +# publicity relating to the software without the specific, prior written +# permission of Sam Leffler and Silicon Graphics. +# +# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, +# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY +# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. +# +# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR +# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, +# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF +# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE +# OF THIS SOFTWARE. + +extra_dist(README) diff --git a/configure b/configure index 638fc53b..5b47d8b2 100755 --- a/configure +++ b/configure @@ -17935,8 +17935,8 @@ _ACEOF fi -for ac_func in floor isascii memmove memset mmap pow setmode sqrt\ - strchr strrchr strstr strtol strtoull +for ac_func in floor isascii memmove memset mmap pow setmode snprintf sqrt \ +strchr strrchr strstr strtol strtoul strtoull do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" @@ -17963,6 +17963,20 @@ esac fi +ac_fn_c_check_func "$LINENO" "snprintf" "ac_cv_func_snprintf" +if test "x$ac_cv_func_snprintf" = xyes; then : + $as_echo "#define HAVE_SNPRINTF 1" >>confdefs.h + +else + case " $LIBOBJS " in + *" snprintf.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS snprintf.$ac_objext" + ;; +esac + +fi + + ac_fn_c_check_func "$LINENO" "strcasecmp" "ac_cv_func_strcasecmp" if test "x$ac_cv_func_strcasecmp" = xyes; then : $as_echo "#define HAVE_STRCASECMP 1" >>confdefs.h diff --git a/configure.ac b/configure.ac index 7ba14ee9..b033bca3 100644 --- a/configure.ac +++ b/configure.ac @@ -414,11 +414,12 @@ AC_CHECK_TYPES([int8, int16, int32],,, ]) dnl Checks for library functions. -AC_CHECK_FUNCS([floor isascii memmove memset mmap pow setmode sqrt\ - strchr strrchr strstr strtol strtoull]) +AC_CHECK_FUNCS([floor isascii memmove memset mmap pow setmode snprintf sqrt \ +strchr strrchr strstr strtol strtoul strtoull]) dnl Will use local replacements for unavailable functions AC_REPLACE_FUNCS(getopt) +AC_REPLACE_FUNCS(snprintf) AC_REPLACE_FUNCS(strcasecmp) AC_REPLACE_FUNCS(strtoul) AC_REPLACE_FUNCS(strtoull) diff --git a/contrib/CMakeLists.txt b/contrib/CMakeLists.txt new file mode 100644 index 00000000..6bb124f4 --- /dev/null +++ b/contrib/CMakeLists.txt @@ -0,0 +1,35 @@ +# CMake build for libtiff +# +# Copyright © 2015 Open Microscopy Environment / University of Dundee +# Written by Roger Leigh +# +# Permission to use, copy, modify, distribute, and sell this software and +# its documentation for any purpose is hereby granted without fee, provided +# that (i) the above copyright notices and this permission notice appear in +# all copies of the software and related documentation, and (ii) the names of +# Sam Leffler and Silicon Graphics may not be used in any advertising or +# publicity relating to the software without the specific, prior written +# permission of Sam Leffler and Silicon Graphics. +# +# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, +# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY +# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. +# +# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR +# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, +# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF +# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE +# OF THIS SOFTWARE. + +add_subdirectory(addtiffo) +add_subdirectory(dbs) +add_subdirectory(iptcutil) +add_subdirectory(mfs) +add_subdirectory(pds) +add_subdirectory(ras) +add_subdirectory(stream) +add_subdirectory(tags) +add_subdirectory(win_dib) + +extra_dist(README) diff --git a/contrib/addtiffo/CMakeLists.txt b/contrib/addtiffo/CMakeLists.txt new file mode 100644 index 00000000..b7482635 --- /dev/null +++ b/contrib/addtiffo/CMakeLists.txt @@ -0,0 +1,34 @@ +# CMake build for libtiff +# +# Copyright © 2015 Open Microscopy Environment / University of Dundee +# Written by Roger Leigh +# +# Permission to use, copy, modify, distribute, and sell this software and +# its documentation for any purpose is hereby granted without fee, provided +# that (i) the above copyright notices and this permission notice appear in +# all copies of the software and related documentation, and (ii) the names of +# Sam Leffler and Silicon Graphics may not be used in any advertising or +# publicity relating to the software without the specific, prior written +# permission of Sam Leffler and Silicon Graphics. +# +# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, +# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY +# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. +# +# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR +# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, +# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF +# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE +# OF THIS SOFTWARE. + +extra_dist( + README + Makefile.vc) + +include_directories(${PROJECT_SOURCE_DIR}/libtiff + ${PROJECT_BINARY_DIR}/libtiff + ${CMAKE_CURRENT_BINARY_DIR}) + +add_executable(addtiffo addtiffo.c tif_overview.c tif_ovrcache.c tif_ovrcache.h) +target_link_libraries(addtiffo tiff port) diff --git a/contrib/dbs/CMakeLists.txt b/contrib/dbs/CMakeLists.txt new file mode 100644 index 00000000..b2e809b2 --- /dev/null +++ b/contrib/dbs/CMakeLists.txt @@ -0,0 +1,43 @@ +# CMake build for libtiff +# +# Copyright © 2015 Open Microscopy Environment / University of Dundee +# Written by Roger Leigh +# +# Permission to use, copy, modify, distribute, and sell this software and +# its documentation for any purpose is hereby granted without fee, provided +# that (i) the above copyright notices and this permission notice appear in +# all copies of the software and related documentation, and (ii) the names of +# Sam Leffler and Silicon Graphics may not be used in any advertising or +# publicity relating to the software without the specific, prior written +# permission of Sam Leffler and Silicon Graphics. +# +# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, +# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY +# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. +# +# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR +# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, +# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF +# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE +# OF THIS SOFTWARE. + +include_directories(${PROJECT_SOURCE_DIR}/libtiff + ${PROJECT_BINARY_DIR}/libtiff + ${CMAKE_CURRENT_BINARY_DIR}) + +add_executable(tiff-bi tiff-bi.c) +target_link_libraries(tiff-bi tiff port) + +add_executable(tiff-grayscale tiff-grayscale.c) +target_link_libraries(tiff-grayscale tiff port) + +add_executable(tiff-palette tiff-palette.c) +target_link_libraries(tiff-palette tiff port) + +add_executable(tiff-rgb tiff-rgb.c) +target_link_libraries(tiff-rgb tiff port) + +add_subdirectory(xtiff) + +extra_dist(README) diff --git a/contrib/dbs/xtiff/CMakeLists.txt b/contrib/dbs/xtiff/CMakeLists.txt new file mode 100644 index 00000000..fec4d0d8 --- /dev/null +++ b/contrib/dbs/xtiff/CMakeLists.txt @@ -0,0 +1,29 @@ +# CMake build for libtiff +# +# Copyright © 2015 Open Microscopy Environment / University of Dundee +# Written by Roger Leigh +# +# Permission to use, copy, modify, distribute, and sell this software and +# its documentation for any purpose is hereby granted without fee, provided +# that (i) the above copyright notices and this permission notice appear in +# all copies of the software and related documentation, and (ii) the names of +# Sam Leffler and Silicon Graphics may not be used in any advertising or +# publicity relating to the software without the specific, prior written +# permission of Sam Leffler and Silicon Graphics. +# +# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, +# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY +# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. +# +# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR +# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, +# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF +# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE +# OF THIS SOFTWARE. + +extra_dist( + README + patchlevel.h + xtiff.c + xtifficon.h) diff --git a/contrib/iptcutil/CMakeLists.txt b/contrib/iptcutil/CMakeLists.txt new file mode 100644 index 00000000..35cc2612 --- /dev/null +++ b/contrib/iptcutil/CMakeLists.txt @@ -0,0 +1,35 @@ +# CMake build for libtiff +# +# Copyright © 2015 Open Microscopy Environment / University of Dundee +# Written by Roger Leigh +# +# Permission to use, copy, modify, distribute, and sell this software and +# its documentation for any purpose is hereby granted without fee, provided +# that (i) the above copyright notices and this permission notice appear in +# all copies of the software and related documentation, and (ii) the names of +# Sam Leffler and Silicon Graphics may not be used in any advertising or +# publicity relating to the software without the specific, prior written +# permission of Sam Leffler and Silicon Graphics. +# +# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, +# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY +# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. +# +# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR +# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, +# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF +# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE +# OF THIS SOFTWARE. + +extra_dist( + README + test.iptc + test.txt) + +include_directories(${PROJECT_SOURCE_DIR}/libtiff + ${PROJECT_BINARY_DIR}/libtiff + ${CMAKE_CURRENT_BINARY_DIR}) + +add_executable(iptcutil iptcutil.c) +target_link_libraries(iptcutil tiff port) diff --git a/contrib/mfs/CMakeLists.txt b/contrib/mfs/CMakeLists.txt new file mode 100644 index 00000000..3f4f3a90 --- /dev/null +++ b/contrib/mfs/CMakeLists.txt @@ -0,0 +1,27 @@ +# CMake build for libtiff +# +# Copyright © 2015 Open Microscopy Environment / University of Dundee +# Written by Roger Leigh +# +# Permission to use, copy, modify, distribute, and sell this software and +# its documentation for any purpose is hereby granted without fee, provided +# that (i) the above copyright notices and this permission notice appear in +# all copies of the software and related documentation, and (ii) the names of +# Sam Leffler and Silicon Graphics may not be used in any advertising or +# publicity relating to the software without the specific, prior written +# permission of Sam Leffler and Silicon Graphics. +# +# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, +# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY +# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. +# +# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR +# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, +# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF +# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE +# OF THIS SOFTWARE. + +extra_dist( + README + mfs_file.c) diff --git a/contrib/pds/CMakeLists.txt b/contrib/pds/CMakeLists.txt new file mode 100644 index 00000000..53a0e056 --- /dev/null +++ b/contrib/pds/CMakeLists.txt @@ -0,0 +1,30 @@ +# CMake build for libtiff +# +# Copyright © 2015 Open Microscopy Environment / University of Dundee +# Written by Roger Leigh +# +# Permission to use, copy, modify, distribute, and sell this software and +# its documentation for any purpose is hereby granted without fee, provided +# that (i) the above copyright notices and this permission notice appear in +# all copies of the software and related documentation, and (ii) the names of +# Sam Leffler and Silicon Graphics may not be used in any advertising or +# publicity relating to the software without the specific, prior written +# permission of Sam Leffler and Silicon Graphics. +# +# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, +# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY +# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. +# +# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR +# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, +# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF +# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE +# OF THIS SOFTWARE. + +extra_dist( + README + tif_imageiter.c + tif_imageiter.h + tif_pdsdirread.c + tif_pdsdirwrite.c) diff --git a/contrib/ras/CMakeLists.txt b/contrib/ras/CMakeLists.txt new file mode 100644 index 00000000..b19a04fa --- /dev/null +++ b/contrib/ras/CMakeLists.txt @@ -0,0 +1,28 @@ +# CMake build for libtiff +# +# Copyright © 2015 Open Microscopy Environment / University of Dundee +# Written by Roger Leigh +# +# Permission to use, copy, modify, distribute, and sell this software and +# its documentation for any purpose is hereby granted without fee, provided +# that (i) the above copyright notices and this permission notice appear in +# all copies of the software and related documentation, and (ii) the names of +# Sam Leffler and Silicon Graphics may not be used in any advertising or +# publicity relating to the software without the specific, prior written +# permission of Sam Leffler and Silicon Graphics. +# +# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, +# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY +# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. +# +# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR +# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, +# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF +# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE +# OF THIS SOFTWARE. + +extra_dist( + README + ras2tif.c + tif2ras.c) diff --git a/contrib/stream/CMakeLists.txt b/contrib/stream/CMakeLists.txt new file mode 100644 index 00000000..c874ff64 --- /dev/null +++ b/contrib/stream/CMakeLists.txt @@ -0,0 +1,28 @@ +# CMake build for libtiff +# +# Copyright © 2015 Open Microscopy Environment / University of Dundee +# Written by Roger Leigh +# +# Permission to use, copy, modify, distribute, and sell this software and +# its documentation for any purpose is hereby granted without fee, provided +# that (i) the above copyright notices and this permission notice appear in +# all copies of the software and related documentation, and (ii) the names of +# Sam Leffler and Silicon Graphics may not be used in any advertising or +# publicity relating to the software without the specific, prior written +# permission of Sam Leffler and Silicon Graphics. +# +# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, +# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY +# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. +# +# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR +# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, +# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF +# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE +# OF THIS SOFTWARE. + +extra_dist( + README + tiffstream.cpp + tiffstream.h) diff --git a/contrib/tags/CMakeLists.txt b/contrib/tags/CMakeLists.txt new file mode 100644 index 00000000..9945da76 --- /dev/null +++ b/contrib/tags/CMakeLists.txt @@ -0,0 +1,32 @@ +# CMake build for libtiff +# +# Copyright © 2015 Open Microscopy Environment / University of Dundee +# Written by Roger Leigh +# +# Permission to use, copy, modify, distribute, and sell this software and +# its documentation for any purpose is hereby granted without fee, provided +# that (i) the above copyright notices and this permission notice appear in +# all copies of the software and related documentation, and (ii) the names of +# Sam Leffler and Silicon Graphics may not be used in any advertising or +# publicity relating to the software without the specific, prior written +# permission of Sam Leffler and Silicon Graphics. +# +# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, +# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY +# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. +# +# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR +# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, +# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF +# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE +# OF THIS SOFTWARE. + +extra_dist( + README + listtif.c + maketif.c + xtif_dir.c + xtiffio.h + xtiffiop.h) + diff --git a/contrib/win_dib/CMakeLists.txt b/contrib/win_dib/CMakeLists.txt new file mode 100644 index 00000000..11d124f5 --- /dev/null +++ b/contrib/win_dib/CMakeLists.txt @@ -0,0 +1,30 @@ +# CMake build for libtiff +# +# Copyright © 2015 Open Microscopy Environment / University of Dundee +# Written by Roger Leigh +# +# Permission to use, copy, modify, distribute, and sell this software and +# its documentation for any purpose is hereby granted without fee, provided +# that (i) the above copyright notices and this permission notice appear in +# all copies of the software and related documentation, and (ii) the names of +# Sam Leffler and Silicon Graphics may not be used in any advertising or +# publicity relating to the software without the specific, prior written +# permission of Sam Leffler and Silicon Graphics. +# +# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, +# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY +# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. +# +# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR +# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, +# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF +# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE +# OF THIS SOFTWARE. + +extra_dist( + Makefile.w95 + README.Tiffile + README.tiff2dib + Tiffile.cpp + tiff2dib.c) diff --git a/html/CMakeLists.txt b/html/CMakeLists.txt new file mode 100644 index 00000000..5f34e1e5 --- /dev/null +++ b/html/CMakeLists.txt @@ -0,0 +1,87 @@ +# CMake build for libtiff +# +# Copyright © 2015 Open Microscopy Environment / University of Dundee +# Written by Roger Leigh +# +# Permission to use, copy, modify, distribute, and sell this software and +# its documentation for any purpose is hereby granted without fee, provided +# that (i) the above copyright notices and this permission notice appear in +# all copies of the software and related documentation, and (ii) the names of +# Sam Leffler and Silicon Graphics may not be used in any advertising or +# publicity relating to the software without the specific, prior written +# permission of Sam Leffler and Silicon Graphics. +# +# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, +# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY +# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. +# +# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR +# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, +# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF +# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE +# OF THIS SOFTWARE. + +set(docfiles + addingtags.html + bugs.html + build.html + contrib.html + document.html + images.html + index.html + internals.html + intro.html + libtiff.html + misc.html + support.html + TIFFTechNote2.html + tools.html + v3.4beta007.html + v3.4beta016.html + v3.4beta018.html + v3.4beta024.html + v3.4beta028.html + v3.4beta029.html + v3.4beta031.html + v3.4beta032.html + v3.4beta033.html + v3.4beta034.html + v3.4beta035.html + v3.4beta036.html + v3.5.1.html + v3.5.2.html + v3.5.3.html + v3.5.4.html + v3.5.5.html + v3.5.6-beta.html + v3.5.7.html + v3.6.0.html + v3.6.1.html + v3.7.0alpha.html + v3.7.0beta.html + v3.7.0beta2.html + v3.7.0.html + v3.7.1.html + v3.7.2.html + v3.7.3.html + v3.7.4.html + v3.8.0.html + v3.8.1.html + v3.8.2.html + v3.9.0beta.html + v3.9.1.html + v3.9.2.html + v4.0.0.html + v4.0.1.html + v4.0.2.html + v4.0.3.html + v4.0.4beta.html) + +install(FILES ${docfiles} + DESTINATION "${LIBTIFF_DOCDIR}/html") + +add_subdirectory(images) +add_subdirectory(man) + +extra_dist(${docfiles}) diff --git a/html/images/CMakeLists.txt b/html/images/CMakeLists.txt new file mode 100644 index 00000000..e25f9f62 --- /dev/null +++ b/html/images/CMakeLists.txt @@ -0,0 +1,46 @@ +# CMake build for libtiff +# +# Copyright © 2015 Open Microscopy Environment / University of Dundee +# Written by Roger Leigh +# +# Permission to use, copy, modify, distribute, and sell this software and +# its documentation for any purpose is hereby granted without fee, provided +# that (i) the above copyright notices and this permission notice appear in +# all copies of the software and related documentation, and (ii) the names of +# Sam Leffler and Silicon Graphics may not be used in any advertising or +# publicity relating to the software without the specific, prior written +# permission of Sam Leffler and Silicon Graphics. +# +# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, +# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY +# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. +# +# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR +# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, +# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF +# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE +# OF THIS SOFTWARE. + +set(docfiles + back.gif + bali.jpg + cat.gif + cover.jpg + cramps.gif + dave.gif + info.gif + jello.jpg + jim.gif + note.gif + oxford.gif + quad.jpg + ring.gif + smallliz.jpg + strike.gif + warning.gif) + +install(FILES ${docfiles} + DESTINATION "${LIBTIFF_DOCDIR}/html/images") + +extra_dist(${docfiles}) diff --git a/html/man/CMakeLists.txt b/html/man/CMakeLists.txt new file mode 100644 index 00000000..f7c98ac0 --- /dev/null +++ b/html/man/CMakeLists.txt @@ -0,0 +1,115 @@ +# CMake build for libtiff +# +# Copyright © 2015 Open Microscopy Environment / University of Dundee +# Written by Roger Leigh +# +# Permission to use, copy, modify, distribute, and sell this software and +# its documentation for any purpose is hereby granted without fee, provided +# that (i) the above copyright notices and this permission notice appear in +# all copies of the software and related documentation, and (ii) the names of +# Sam Leffler and Silicon Graphics may not be used in any advertising or +# publicity relating to the software without the specific, prior written +# permission of Sam Leffler and Silicon Graphics. +# +# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, +# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY +# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. +# +# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR +# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, +# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF +# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE +# OF THIS SOFTWARE. + +set(indexfile index.html) + +set(docfiles + libtiff.3tiff.html + TIFFbuffer.3tiff.html + TIFFClose.3tiff.html + TIFFcodec.3tiff.html + TIFFcolor.3tiff.html + TIFFDataWidth.3tiff.html + TIFFError.3tiff.html + TIFFFieldDataType.3tiff.html + TIFFFieldName.3tiff.html + TIFFFieldPassCount.3tiff.html + TIFFFieldReadCount.3tiff.html + TIFFFieldTag.3tiff.html + TIFFFieldWriteCount.3tiff.html + TIFFFlush.3tiff.html + TIFFGetField.3tiff.html + TIFFmemory.3tiff.html + TIFFOpen.3tiff.html + TIFFPrintDirectory.3tiff.html + TIFFquery.3tiff.html + TIFFReadDirectory.3tiff.html + TIFFReadEncodedStrip.3tiff.html + TIFFReadEncodedTile.3tiff.html + TIFFReadRawStrip.3tiff.html + TIFFReadRawTile.3tiff.html + TIFFReadRGBAImage.3tiff.html + TIFFReadRGBAStrip.3tiff.html + TIFFReadRGBATile.3tiff.html + TIFFReadScanline.3tiff.html + TIFFReadTile.3tiff.html + TIFFRGBAImage.3tiff.html + TIFFSetDirectory.3tiff.html + TIFFSetField.3tiff.html + TIFFsize.3tiff.html + TIFFstrip.3tiff.html + TIFFswab.3tiff.html + TIFFtile.3tiff.html + TIFFWarning.3tiff.html + TIFFWriteDirectory.3tiff.html + TIFFWriteEncodedStrip.3tiff.html + TIFFWriteEncodedTile.3tiff.html + TIFFWriteRawStrip.3tiff.html + TIFFWriteRawTile.3tiff.html + TIFFWriteScanline.3tiff.html + TIFFWriteTile.3tiff.html + bmp2tiff.1.html + fax2ps.1.html + fax2tiff.1.html + gif2tiff.1.html + pal2rgb.1.html + ppm2tiff.1.html + ras2tiff.1.html + raw2tiff.1.html + rgb2ycbcr.1.html + sgi2tiff.1.html + thumbnail.1.html + tiff2bw.1.html + tiff2pdf.1.html + tiff2ps.1.html + tiff2rgba.1.html + tiffcmp.1.html + tiffcp.1.html + tiffcrop.1.html + tiffdither.1.html + tiffdump.1.html + tiffgt.1.html + tiffinfo.1.html + tiffmedian.1.html + tiffset.1.html + tiffsplit.1.html + tiffsv.1.html) + +set(doc_DATA ${indexfile} ${docfiles}) + +extra_dist(${doc_DATA}) + +install(FILES ${doc_DATA} + DESTINATION "${LIBTIFF_DOCDIR}/html/man") + +# htmldoc target to regenerate HTML files +string(REPLACE ";" "^" escaped_docfiles "${docfiles}") +add_custom_target(htmldoc + COMMAND "${CMAKE_COMMAND}" + "-DMANSRCDIR=${PROJECT_SOURCE_DIR}/man" + "-DHTMLMANDIR=${PROJECT_SOURCE_DIR}/html/man" + "-DINDEXFILE=${indexfile}" + "-DDOCFILES=${escaped_docfiles}" + -P "${CMAKE_CURRENT_SOURCE_DIR}/HtmlDoc.cmake") + diff --git a/html/man/HtmlDoc.cmake b/html/man/HtmlDoc.cmake new file mode 100644 index 00000000..7e5a1a0c --- /dev/null +++ b/html/man/HtmlDoc.cmake @@ -0,0 +1,50 @@ +# CMake documentation generation for libtiff +# +# Copyright © 2015 Open Microscopy Environment / University of Dundee +# Written by Roger Leigh +# +# Permission to use, copy, modify, distribute, and sell this software and +# its documentation for any purpose is hereby granted without fee, provided +# that (i) the above copyright notices and this permission notice appear in +# all copies of the software and related documentation, and (ii) the names of +# Sam Leffler and Silicon Graphics may not be used in any advertising or +# publicity relating to the software without the specific, prior written +# permission of Sam Leffler and Silicon Graphics. +# +# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, +# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY +# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. +# +# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR +# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, +# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF +# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE +# OF THIS SOFTWARE. + +string(REPLACE "^" ";" DOCFILES "${DOCFILES}") + +set(INDEXSTART "Libtiff HTML manpage index

    Man Pages

    ") +set(INDEXEND "

") + +set(indexcontent "${INDEXSTART} +") + +foreach(doc ${DOCFILES}) + string(REGEX REPLACE "(.*)\\.html$" "\\1" man "${doc}") + execute_process(COMMAND groff -Thtml -mandoc "${MANSRCDIR}/${man}" + OUTPUT_FILE "${HTMLMANDIR}/${doc}" + RESULT_VARIABLE GROFF_STATUS) + if(GROFF_STATUS) + message(FATAL_ERROR "Groff failed to generate HTML manpage") + endif() + message(STATUS "Generated ${HTMLMANDIR}/${doc} from ${MANSRCDIR}/${man}") + + set(indexcontent "${indexcontent}
  • ${man} +") +endforeach() + +set(indexcontent "${indexcontent}${INDEXEND} +") +file(WRITE "${HTMLMANDIR}/${INDEXFILE}" "${indexcontent}") +message(STATUS "Generated ${HTMLMANDIR}/${INDEXFILE}") diff --git a/libtiff/CMakeLists.txt b/libtiff/CMakeLists.txt new file mode 100644 index 00000000..72e49e62 --- /dev/null +++ b/libtiff/CMakeLists.txt @@ -0,0 +1,181 @@ +# CMake build for libtiff +# +# Copyright © 2015 Open Microscopy Environment / University of Dundee +# Written by Roger Leigh +# +# Permission to use, copy, modify, distribute, and sell this software and +# its documentation for any purpose is hereby granted without fee, provided +# that (i) the above copyright notices and this permission notice appear in +# all copies of the software and related documentation, and (ii) the names of +# Sam Leffler and Silicon Graphics may not be used in any advertising or +# publicity relating to the software without the specific, prior written +# permission of Sam Leffler and Silicon Graphics. +# +# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, +# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY +# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. +# +# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR +# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, +# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF +# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE +# OF THIS SOFTWARE. + +# Generate headers +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tif_config.h.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/tif_config.h + @ONLY) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tiffconf.h.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/tiffconf.h + @ONLY) + +extra_dist( + SConstruct + tif_config.h-vms + tif_config.vc.h + tif_config.wince.h + tiffconf.vc.h + tiffconf.wince.h + libtiff.def + libtiff.map + libtiffxx.map) + +set(tiff_HEADERS + tiff.h + tiffio.h + tiffvers.h) + +set(tiff_noinst_HEADERS + t4.h + tif_dir.h + tif_predict.h + tiffiop.h + uvcode.h) + +set(nodist_tiff_HEADERS + ${CMAKE_CURRENT_BINARY_DIR}/tiffconf.h) + +set(tiff_SOURCES + tif_aux.c + tif_close.c + tif_codec.c + tif_color.c + tif_compress.c + tif_dir.c + tif_dirinfo.c + tif_dirread.c + tif_dirwrite.c + tif_dumpmode.c + tif_error.c + tif_extension.c + tif_fax3.c + tif_fax3sm.c + tif_flush.c + tif_getimage.c + tif_jbig.c + tif_jpeg.c + tif_jpeg_12.c + tif_luv.c + tif_lzma.c + tif_lzw.c + tif_next.c + tif_ojpeg.c + tif_open.c + tif_packbits.c + tif_pixarlog.c + tif_predict.c + tif_print.c + tif_read.c + tif_strip.c + tif_swab.c + tif_thunder.c + tif_tile.c + tif_version.c + tif_warning.c + tif_write.c + tif_zip.c) + +set(tiffxx_HEADERS + tiffio.hxx) + +set(tiffxx_SOURCES + tif_stream.cxx) + +if(WIN32_IO) + extra_dist(tif_unix.c) + list(APPEND tiff_SOURCES tif_win32.c) +else() + extra_dist(tif_win32.c) + list(APPEND tiff_SOURCES tif_unix.c) +endif() + +include_directories(${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_BINARY_DIR} + ${TIFF_INCLUDES}) + +add_library(tiff SHARED ${tiff_SOURCES} ${tiff_HEADERS} ${nodist_tiff_HEADERS} + ${tiff_port_SOURCES} libtiff.def) +target_link_libraries(tiff ${TIFF_LIBRARY_DEPS}) +set_target_properties(tiff PROPERTIES SOVERSION ${SO_COMPATVERSION}) +if(NOT CYGWIN) + # This property causes shared libraries on Linux to have the full version + # encoded into their final filename. We disable this on Cygwin because + # it causes cygz-${TIFF_FULL_VERSION}.dll to be created when cygz.dll + # seems to be the default. + set_target_properties(tiff PROPERTIES VERSION ${SO_VERSION}) +endif() +if(HAVE_LD_VERSION_SCRIPT) + set_target_properties(tiff PROPERTIES LINK_FLAGS + "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/libtiff.map") +endif() + +add_library(tiff_static STATIC ${tiff_SOURCES} ${tiff_HEADERS}) +target_link_libraries(tiff_static ${TIFF_LIBRARY_DEPS} port) +if (NOT WIN32) + # Windows static and DLL import libraries both use .lib so the + # static lib can't use the same name as the DLL + set_target_properties(tiff_static PROPERTIES OUTPUT_NAME tiff) +endif() + +install(TARGETS tiff tiff_static + RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}) + +install(FILES ${tiff_HEADERS} ${nodist_tiff_HEADERS} + DESTINATION "${CMAKE_INSTALL_FULL_INCLUDEDIR}") + +if(cxx) + add_library(tiffxx SHARED ${tiffxx_SOURCES} ${tiffxx_HEADERS}) + target_link_libraries(tiffxx tiff) + set_target_properties(tiff PROPERTIES SOVERSION ${SO_COMPATVERSION}) + if(NOT CYGWIN) + # This property causes shared libraries on Linux to have the full version + # encoded into their final filename. We disable this on Cygwin because + # it causes cygz-${TIFF_FULL_VERSION}.dll to be created when cygz.dll + # seems to be the default. + set_target_properties(tiff PROPERTIES VERSION ${SO_VERSION}) + endif() + if(HAVE_LD_VERSION_SCRIPT) + set_target_properties(tiff PROPERTIES LINK_FLAGS + "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/libtiffxx.map") + endif() + + add_library(tiffxx_static STATIC ${tiffxx_SOURCES} ${tiffxx_HEADERS}) + target_link_libraries(tiffxx_static tiff_staticport) + if (NOT WIN32) + # Windows static and DLL import libraries both use .lib so the + # static lib can't use the same name as the DLL + set_target_properties(tiffxx_static PROPERTIES OUTPUT_NAME tiffxx) + endif() + + install(TARGETS tiffxx tiffxx_static + RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}) + + install(FILES ${tiffxx_HEADERS} + DESTINATION "${CMAKE_INSTALL_FULL_INCLUDEDIR}") + +endif() diff --git a/libtiff/tif_config.h.cmake.in b/libtiff/tif_config.h.cmake.in new file mode 100644 index 00000000..61596c33 --- /dev/null +++ b/libtiff/tif_config.h.cmake.in @@ -0,0 +1,268 @@ +/* libtiff/tif_config.h.cmake.in. Not generated, but originated from autoheader. */ +/* This file must be kept up-to-date with needed substitutions from libtiff/tif_config.h.in. */ + +/* Support CCITT Group 3 & 4 algorithms */ +#cmakedefine CCITT_SUPPORT 1 + +/* Pick up YCbCr subsampling info from the JPEG data stream to support files + lacking the tag (default enabled). */ +#cmakedefine CHECK_JPEG_YCBCR_SUBSAMPLING 1 + +/* enable partial strip reading for large strips (experimental) */ +#cmakedefine CHUNKY_STRIP_READ_SUPPORT 1 + +/* Support C++ stream API (requires C++ compiler) */ +#cmakedefine CXX_SUPPORT 1 + +/* enable deferred strip/tile offset/size loading (experimental) */ +#cmakedefine DEFER_STRILE_LOAD 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_ASSERT_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_DLFCN_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_FCNTL_H 1 + +/* Define to 1 if you have the `floor' function. */ +#cmakedefine HAVE_FLOOR 1 + +/* Define to 1 if you have the `getopt' function. */ +#cmakedefine HAVE_GETOPT 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_GLUT_GLUT_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_GL_GLUT_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_GL_GLU_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_GL_GL_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_IO_H 1 + +/* Define to 1 if you have the `isascii' function. */ +#cmakedefine HAVE_ISASCII 1 + +/* Define to 1 if you have the `jbg_newlen' function. */ +#cmakedefine HAVE_JBG_NEWLEN 1 + +/* Define to 1 if you have the `lfind' function. */ +#cmakedefine HAVE_LFIND 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_LIMITS_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_MALLOC_H 1 + +/* Define to 1 if you have the `memmove' function. */ +#cmakedefine HAVE_MEMMOVE 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_MEMORY_H 1 + +/* Define to 1 if you have the `memset' function. */ +#cmakedefine HAVE_MEMSET 1 + +/* Define to 1 if you have the `mmap' function. */ +#cmakedefine HAVE_MMAP 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_OPENGL_GLU_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_OPENGL_GL_H 1 + +/* Define to 1 if you have the `pow' function. */ +#cmakedefine HAVE_POW 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SEARCH_H 1 + +/* Define to 1 if you have the `setmode' function. */ +#cmakedefine HAVE_SETMODE 1 + +/* Define to 1 if you have the `snprintf' function. */ +#cmakedefine HAVE_SNPRINTF 1 + +/* Define to 1 if you have the `_snprintf' function. */ +#cmakedefine HAVE__SNPRINTF 1 + +#if !defined(HAVE_SNPRINTF) && defined(HAVE__SNPRINTF) +#define snprintf _snprintf +#endif + +/* Define to 1 if you have the `sqrt' function. */ +#cmakedefine HAVE_SQRT 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_STDINT_H 1 + +/* Define to 1 if you have the `strcasecmp' function. */ +#cmakedefine HAVE_STRCASECMP 1 + +/* Define to 1 if you have the `strchr' function. */ +#cmakedefine HAVE_STRCHR 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_STRING_H 1 + +/* Define to 1 if you have the `strrchr' function. */ +#cmakedefine HAVE_STRRCHR 1 + +/* Define to 1 if you have the `strstr' function. */ +#cmakedefine HAVE_STRSTR 1 + +/* Define to 1 if you have the `strtol' function. */ +#cmakedefine HAVE_STRTOL 1 + +/* Define to 1 if you have the `strtoul' function. */ +#cmakedefine HAVE_STRTOUL 1 + +/* Define to 1 if you have the `strtoull' function. */ +#cmakedefine HAVE_STRTOULL 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_TIME_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_UNISTD_H 1 + +/* 8/12 bit libjpeg dual mode enabled */ +#cmakedefine JPEG_DUAL_MODE_8_12 1 + +/* 12bit libjpeg primary include file with path */ +#define LIBJPEG_12_PATH @LIBJPEG_12_PATH@ + +/* Support LZMA2 compression */ +#cmakedefine LZMA_SUPPORT 1 + +/* Name of package */ +#define PACKAGE "@PACKAGE_NAME@" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "@PACKAGE_BUGREPORT@" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "@PACKAGE_NAME@" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "@PACKAGE_STRING@" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "@PACKAGE_TARNAME@" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "@PACKAGE_URL@" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "@PACKAGE_VERSION@" + +/* The size of `signed int', as computed by sizeof. */ +#define SIZEOF_SIGNED_INT @SIZEOF_SIGNED_INT@ + +/* The size of `signed long', as computed by sizeof. */ +#define SIZEOF_SIGNED_LONG @SIZEOF_SIGNED_LONG@ + +/* The size of `signed long long', as computed by sizeof. */ +#define SIZEOF_SIGNED_LONG_LONG @SIZEOF_SIGNED_LONG_LONG@ + +/* The size of `signed short', as computed by sizeof. */ +#define SIZEOF_SIGNED_SHORT @SIZEOF_SIGNED_SHORT@ + +/* The size of `unsigned char *', as computed by sizeof. */ +#define SIZEOF_UNSIGNED_CHAR_P @SIZEOF_UNSIGNED_CHAR_P@ + +/* The size of `unsigned int', as computed by sizeof. */ +#define SIZEOF_UNSIGNED_INT @SIZEOF_UNSIGNED_INT@ + +/* The size of `unsigned long', as computed by sizeof. */ +#define SIZEOF_UNSIGNED_LONG @SIZEOF_UNSIGNED_LONG@ + +/* The size of `unsigned long long', as computed by sizeof. */ +#define SIZEOF_UNSIGNED_LONG_LONG @SIZEOF_UNSIGNED_LONG_LONG@ + +/* The size of `unsigned short', as computed by sizeof. */ +#define SIZEOF_UNSIGNED_SHORT @SIZEOF_UNSIGNED_SHORT@ + +/* Default size of the strip in bytes (when strip chopping enabled) */ +#define STRIP_SIZE_DEFAULT @STRIP_SIZE_DEFAULT@ + +/* Signed 32-bit type formatter */ +#define TIFF_INT32_FORMAT "@TIFF_INT32_FORMAT@" + +/* Signed 64-bit type formatter */ +#define TIFF_INT64_FORMAT "@TIFF_INT64_FORMAT@" + +/* Pointer difference type formatter */ +#define TIFF_PTRDIFF_FORMAT "@TIFF_PTRDIFF_FORMAT@" + +/* Unsigned size type formatter */ +#define TIFF_SIZE_FORMAT "@TIFF_SIZE_FORMAT@" + +/* Signed size type formatter */ +#define TIFF_SSIZE_FORMAT "@TIFF_SSIZE_FORMAT@" + +/* Unsigned 32-bit type formatter */ +#define TIFF_UINT32_FORMAT "@TIFF_UINT32_FORMAT@" + +/* Unsigned 64-bit type formatter */ +#define TIFF_UINT64_FORMAT "@TIFF_UINT64_FORMAT@" + +/* Unsigned 8-bit type */ +#define TIFF_UINT8_T @TIFF_UINT8_T@ + +/* Define to 1 if you can safely include both and . */ +#undef TIME_WITH_SYS_TIME + +/* Define to 1 if your declares `struct tm'. */ +#cmakedefine TM_IN_SYS_TIME 1 + +/* define to use win32 IO system */ +#cmakedefine USE_WIN32_FILEIO 1 + +/* Version number of package */ +#define VERSION "@PACKAGE_VERSION@" + +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#if defined AC_APPLE_UNIVERSAL_BUILD +# if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +# endif +#else +# ifndef WORDS_BIGENDIAN +# undef WORDS_BIGENDIAN +# endif +#endif + +/* Number of bits in a file offset, on hosts where this is settable. */ +#define _FILE_OFFSET_BITS @FILE_OFFSET_BITS@ + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +#define inline @INLINE_KEYWORD@ +#endif + +/* Define to `long int' if does not define. */ +#undef off_t + +/* Define to `unsigned int' if does not define. */ +#undef size_t diff --git a/libtiff/tif_config.h.in b/libtiff/tif_config.h.in index 468ddbd3..6c336a9b 100644 --- a/libtiff/tif_config.h.in +++ b/libtiff/tif_config.h.in @@ -119,6 +119,9 @@ /* Define to 1 if you have the `setmode' function. */ #undef HAVE_SETMODE +/* Define to 1 if you have the `snprintf' function. */ +#undef HAVE_SNPRINTF + /* Define to 1 if you have the `sqrt' function. */ #undef HAVE_SQRT diff --git a/libtiff/tiffconf.h.cmake.in b/libtiff/tiffconf.h.cmake.in new file mode 100644 index 00000000..de8a807e --- /dev/null +++ b/libtiff/tiffconf.h.cmake.in @@ -0,0 +1,130 @@ +/* + Configuration defines for installed libtiff. + This file maintained for backward compatibility. Do not use definitions + from this file in your programs. +*/ + +#ifndef _TIFFCONF_ +#define _TIFFCONF_ + +/* Signed 16-bit type */ +#define TIFF_INT16_T @TIFF_INT16_T@ + +/* Signed 32-bit type */ +#define TIFF_INT32_T @TIFF_INT32_T@ + +/* Signed 64-bit type */ +#define TIFF_INT64_T @TIFF_INT64_T@ + +/* Signed 8-bit type */ +#define TIFF_INT8_T @TIFF_INT8_T@ + +/* Unsigned 16-bit type */ +#define TIFF_UINT16_T @TIFF_UINT16_T@ + +/* Unsigned 32-bit type */ +#define TIFF_UINT32_T @TIFF_UINT32_T@ + +/* Unsigned 64-bit type */ +#define TIFF_UINT64_T @TIFF_UINT64_T@ + +/* Unsigned 8-bit type */ +#define TIFF_UINT8_T @TIFF_UINT8_T@ + +/* Unsigned size type */ +#define TIFF_SIZE_T @TIFF_SIZE_T@ + +/* Signed size type */ +#define TIFF_SSIZE_T @TIFF_SSIZE_T@ + +/* Pointer difference type */ +#define TIFF_PTRDIFF_T @TIFF_PTRDIFF_T@ + +/* Define to 1 if the system has the type `int16'. */ +#cmakedefine HAVE_INT16 1 + +/* Define to 1 if the system has the type `int32'. */ +#cmakedefine HAVE_INT32 1 + +/* Define to 1 if the system has the type `int8'. */ +#cmakedefine HAVE_INT8 1 + +/* Compatibility stuff. */ + +/* Define as 0 or 1 according to the floating point format suported by the + machine */ +#cmakedefine HAVE_IEEEFP 1 + +/* Set the native cpu bit order (FILLORDER_LSB2MSB or FILLORDER_MSB2LSB) */ +#define HOST_FILLORDER @HOST_FILLORDER@ + +/* Native cpu byte order: 1 if big-endian (Motorola) or 0 if little-endian + (Intel) */ +#define HOST_BIGENDIAN @HOST_BIG_ENDIAN@ + +/* Support CCITT Group 3 & 4 algorithms */ +#cmakedefine CCITT_SUPPORT 1 + +/* Support JPEG compression (requires IJG JPEG library) */ +#cmakedefine JPEG_SUPPORT 1 + +/* Support JBIG compression (requires JBIG-KIT library) */ +#cmakedefine JBIG_SUPPORT + +/* Support LogLuv high dynamic range encoding */ +#cmakedefine LOGLUV_SUPPORT 1 + +/* Support LZW algorithm */ +#cmakedefine LZW_SUPPORT 1 + +/* Support NeXT 2-bit RLE algorithm */ +#cmakedefine NEXT_SUPPORT 1 + +/* Support Old JPEG compresson (read contrib/ojpeg/README first! Compilation + fails with unpatched IJG JPEG library) */ +#cmakedefine OJPEG_SUPPORT 1 + +/* Support Macintosh PackBits algorithm */ +#cmakedefine PACKBITS_SUPPORT 1 + +/* Support Pixar log-format algorithm (requires Zlib) */ +#cmakedefine PIXARLOG_SUPPORT 1 + +/* Support ThunderScan 4-bit RLE algorithm */ +#cmakedefine THUNDER_SUPPORT 1 + +/* Support Deflate compression */ +#cmakedefine ZIP_SUPPORT 1 + +/* Support strip chopping (whether or not to convert single-strip uncompressed + images to mutiple strips of ~8Kb to reduce memory usage) */ +#cmakedefine STRIPCHOP_DEFAULT 1 + +/* Enable SubIFD tag (330) support */ +#cmakedefine SUBIFD_SUPPORT 1 + +/* Treat extra sample as alpha (default enabled). 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. */ +#cmakedefine DEFAULT_EXTRASAMPLE_AS_ALPHA 1 + +/* Pick up YCbCr subsampling info from the JPEG data stream to support files + lacking the tag (default enabled). */ +#cmakedefine CHECK_JPEG_YCBCR_SUBSAMPLING 1 + +/* Support MS MDI magic number files as TIFF */ +#cmakedefine MDI_SUPPORT 1 + +/* + * Feature support definitions. + * XXX: These macros are obsoleted. Don't use them in your apps! + * Macros stays here for backward compatibility and should be always defined. + */ +#define COLORIMETRY_SUPPORT +#define YCBCR_SUPPORT +#define CMYK_SUPPORT +#define ICC_SUPPORT +#define PHOTOSHOP_SUPPORT +#define IPTC_SUPPORT + +#endif /* _TIFFCONF_ */ diff --git a/libtiff/tiffiop.h b/libtiff/tiffiop.h index 53357d85..41686eb0 100644 --- a/libtiff/tiffiop.h +++ b/libtiff/tiffiop.h @@ -1,4 +1,4 @@ -/* $Id: tiffiop.h,v 1.84 2012-05-30 01:50:17 fwarmerdam Exp $ */ +/* $Id: tiffiop.h,v 1.85 2015-06-25 02:28:01 bfriesen Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler @@ -57,6 +57,10 @@ extern void *lfind(const void *, const void *, size_t *, size_t, int (*)(const void *, const void *)); #endif +#if !defined(HAVE_SNPRINTF) && !defined(HAVE__SNPRINTF) +extern int snprintf(char* str, size_t size, const char* format, ...); +#endif + #include "tiffio.h" #include "tif_dir.h" diff --git a/man/CMakeLists.txt b/man/CMakeLists.txt new file mode 100644 index 00000000..f7f84620 --- /dev/null +++ b/man/CMakeLists.txt @@ -0,0 +1,104 @@ +# CMake build for libtiff +# +# Copyright © 2015 Open Microscopy Environment / University of Dundee +# Written by Roger Leigh +# +# Permission to use, copy, modify, distribute, and sell this software and +# its documentation for any purpose is hereby granted without fee, provided +# that (i) the above copyright notices and this permission notice appear in +# all copies of the software and related documentation, and (ii) the names of +# Sam Leffler and Silicon Graphics may not be used in any advertising or +# publicity relating to the software without the specific, prior written +# permission of Sam Leffler and Silicon Graphics. +# +# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, +# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY +# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. +# +# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR +# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, +# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF +# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE +# OF THIS SOFTWARE. + +set(man1_MANS + bmp2tiff.1 + fax2ps.1 + fax2tiff.1 + gif2tiff.1 + pal2rgb.1 + ppm2tiff.1 + ras2tiff.1 + raw2tiff.1 + rgb2ycbcr.1 + sgi2tiff.1 + thumbnail.1 + tiff2bw.1 + tiff2pdf.1 + tiff2ps.1 + tiff2rgba.1 + tiffcmp.1 + tiffcp.1 + tiffcrop.1 + tiffdither.1 + tiffdump.1 + tiffgt.1 + tiffinfo.1 + tiffmedian.1 + tiffset.1 + tiffsplit.1 + tiffsv.1) + +set(man3_MANS + libtiff.3tiff + TIFFbuffer.3tiff + TIFFClose.3tiff + TIFFcodec.3tiff + TIFFcolor.3tiff + TIFFDataWidth.3tiff + TIFFError.3tiff + TIFFFieldDataType.3tiff + TIFFFieldName.3tiff + TIFFFieldPassCount.3tiff + TIFFFieldReadCount.3tiff + TIFFFieldTag.3tiff + TIFFFieldWriteCount.3tiff + TIFFFlush.3tiff + TIFFGetField.3tiff + TIFFmemory.3tiff + TIFFOpen.3tiff + TIFFPrintDirectory.3tiff + TIFFquery.3tiff + TIFFReadDirectory.3tiff + TIFFReadEncodedStrip.3tiff + TIFFReadEncodedTile.3tiff + TIFFReadRawStrip.3tiff + TIFFReadRawTile.3tiff + TIFFReadRGBAImage.3tiff + TIFFReadRGBAStrip.3tiff + TIFFReadRGBATile.3tiff + TIFFReadScanline.3tiff + TIFFReadTile.3tiff + TIFFRGBAImage.3tiff + TIFFSetDirectory.3tiff + TIFFSetField.3tiff + TIFFsize.3tiff + TIFFstrip.3tiff + TIFFswab.3tiff + TIFFtile.3tiff + TIFFWarning.3tiff + TIFFWriteDirectory.3tiff + TIFFWriteEncodedStrip.3tiff + TIFFWriteEncodedTile.3tiff + TIFFWriteRawStrip.3tiff + TIFFWriteRawTile.3tiff + TIFFWriteScanline.3tiff + TIFFWriteTile.3tiff) + +install(FILES ${man1_MANS} + DESTINATION "${CMAKE_INSTALL_FULL_MANDIR}/man1") +install(FILES ${man3_MANS} + DESTINATION "${CMAKE_INSTALL_FULL_MANDIR}/man3") + +extra_dist(${man1_MANS} ${man3_MANS}) diff --git a/port/CMakeLists.txt b/port/CMakeLists.txt new file mode 100644 index 00000000..354ed4d7 --- /dev/null +++ b/port/CMakeLists.txt @@ -0,0 +1,60 @@ +# CMake build for libtiff +# +# Copyright © 2015 Open Microscopy Environment / University of Dundee +# Written by Roger Leigh +# +# Permission to use, copy, modify, distribute, and sell this software and +# its documentation for any purpose is hereby granted without fee, provided +# that (i) the above copyright notices and this permission notice appear in +# all copies of the software and related documentation, and (ii) the names of +# Sam Leffler and Silicon Graphics may not be used in any advertising or +# publicity relating to the software without the specific, prior written +# permission of Sam Leffler and Silicon Graphics. +# +# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, +# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY +# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. +# +# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR +# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, +# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF +# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE +# OF THIS SOFTWARE. + +set(port_HEADERS libport.h) +set(port_SOURCES dummy.c) +set(port_optional_SOURCES + getopt.c + lfind.c + strcasecmp.c + strtoul.c + strtoull.c) + +set(port_USED_FILES ${port_SOURCES} ${port_HEADERS}) + +if(NOT HAVE_GETOPT) + list(APPEND port_USED_FILES getopt.c) +endif() +if(NOT HAVE_LFIND) + list(APPEND port_USED_FILES lfind.c) +endif() +if(NOT HAVE_SNPRINTF AND NOT HAVE__SNPRINTF) + list(APPEND port_USED_FILES snprintf.c) +endif() +if(NOT HAVE_STRCASECMP) + list(APPEND port_USED_FILES strcasecmp.c) +endif() +if(NOT HAVE_STRTOUL) + list(APPEND port_USED_FILES strtoul.c) +endif() +if(NOT HAVE_STRTOULL) + list(APPEND port_USED_FILES strtoull.c) +endif() + +add_library(port STATIC ${port_USED_FILES}) + +foreach(file ${port_USED_FILES}) + list(APPEND tiff_port_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/${file}") +endforeach() +set(tiff_port_SOURCES ${tiff_port_SOURCES} PARENT_SCOPE) diff --git a/port/Makefile.am b/port/Makefile.am index 94504fd8..e8253455 100644 --- a/port/Makefile.am +++ b/port/Makefile.am @@ -23,7 +23,7 @@ # Process this file with automake to produce Makefile.in. -EXTRA_DIST = Makefile.vc libport.h +EXTRA_DIST = Makefile.vc libport.h snprintf.c noinst_LTLIBRARIES = libport.la libport_la_SOURCES = dummy.c libport.h diff --git a/port/Makefile.in b/port/Makefile.in index 7e6e93ed..394f69b7 100644 --- a/port/Makefile.in +++ b/port/Makefile.in @@ -196,7 +196,7 @@ am__define_uniq_tagged_files = \ ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/config/depcomp \ - $(top_srcdir)/config/mkinstalldirs getopt.c lfind.c \ + $(top_srcdir)/config/mkinstalldirs getopt.c lfind.c snprintf.c \ strcasecmp.c strtoul.c strtoull.c DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ @@ -345,7 +345,7 @@ tiff_libs_private = @tiff_libs_private@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -EXTRA_DIST = Makefile.vc libport.h +EXTRA_DIST = Makefile.vc libport.h snprintf.c noinst_LTLIBRARIES = libport.la libport_la_SOURCES = dummy.c libport.h libport_la_LIBADD = @LTLIBOBJS@ @@ -405,6 +405,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/getopt.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/lfind.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/snprintf.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/strcasecmp.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/strtoul.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/strtoull.Plo@am__quote@ diff --git a/port/libport.h b/port/libport.h index 802f478b..909ae1fc 100644 --- a/port/libport.h +++ b/port/libport.h @@ -1,4 +1,4 @@ -/* $Id: libport.h,v 1.2 2009-11-02 14:44:13 bfriesen Exp $ */ +/* $Id: libport.h,v 1.3 2015-06-25 02:28:01 bfriesen Exp $ */ /* * Copyright (c) 2009 Frank Warmerdam @@ -48,4 +48,8 @@ lfind(const void *key, const void *base, size_t *nmemb, size_t size, int(*compar)(const void *, const void *)); #endif +#if !defined(HAVE_SNPRINTF) && !defined(HAVE__SNPRINTF) +int snprintf(char* str, size_t size, const char* format, ...); +#endif + #endif /* ndef _LIBPORT_ */ diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 00000000..b9e373f9 --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,374 @@ +# CMake build for libtiff +# +# Copyright © 2015 Open Microscopy Environment / University of Dundee +# Written by Roger Leigh +# +# Permission to use, copy, modify, distribute, and sell this software and +# its documentation for any purpose is hereby granted without fee, provided +# that (i) the above copyright notices and this permission notice appear in +# all copies of the software and related documentation, and (ii) the names of +# Sam Leffler and Silicon Graphics may not be used in any advertising or +# publicity relating to the software without the specific, prior written +# permission of Sam Leffler and Silicon Graphics. +# +# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, +# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY +# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. +# +# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR +# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, +# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF +# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE +# OF THIS SOFTWARE. + +include_directories(${PROJECT_SOURCE_DIR}/libtiff + ${PROJECT_BINARY_DIR}/libtiff + ${CMAKE_CURRENT_BINARY_DIR} + ${TIFF_INCLUDES}) + +# Test scripts (not used by CMake) +set(TESTSCRIPTS + bmp2tiff_palette.sh + bmp2tiff_rgb.sh + gif2tiff.sh + ppm2tiff_pbm.sh + ppm2tiff_pgm.sh + ppm2tiff_ppm.sh + tiffcp-g3.sh + tiffcp-g3-1d.sh + tiffcp-g3-1d-fill.sh + tiffcp-g3-2d.sh + tiffcp-g3-2d-fill.sh + tiffcp-g4.sh + tiffcp-logluv.sh + tiffcp-thumbnail.sh + tiffdump.sh + tiffinfo.sh + tiffcp-split.sh + tiffcp-split-join.sh + tiff2ps-PS1.sh + tiff2ps-PS2.sh + tiff2ps-PS3.sh + tiff2ps-EPS1.sh + tiff2pdf.sh + tiffcrop-doubleflip-logluv-3c-16b.sh + tiffcrop-doubleflip-minisblack-1c-16b.sh + tiffcrop-doubleflip-minisblack-1c-8b.sh + tiffcrop-doubleflip-minisblack-2c-8b-alpha.sh + tiffcrop-doubleflip-miniswhite-1c-1b.sh + tiffcrop-doubleflip-palette-1c-1b.sh + tiffcrop-doubleflip-palette-1c-4b.sh + tiffcrop-doubleflip-palette-1c-8b.sh + tiffcrop-doubleflip-rgb-3c-16b.sh + tiffcrop-doubleflip-rgb-3c-8b.sh + tiffcrop-extract-logluv-3c-16b.sh + tiffcrop-extract-minisblack-1c-16b.sh + tiffcrop-extract-minisblack-1c-8b.sh + tiffcrop-extract-minisblack-2c-8b-alpha.sh + tiffcrop-extract-miniswhite-1c-1b.sh + tiffcrop-extract-palette-1c-1b.sh + tiffcrop-extract-palette-1c-4b.sh + tiffcrop-extract-palette-1c-8b.sh + tiffcrop-extract-rgb-3c-16b.sh + tiffcrop-extract-rgb-3c-8b.sh + tiffcrop-extractz14-logluv-3c-16b.sh + tiffcrop-extractz14-minisblack-1c-16b.sh + tiffcrop-extractz14-minisblack-1c-8b.sh + tiffcrop-extractz14-minisblack-2c-8b-alpha.sh + tiffcrop-extractz14-miniswhite-1c-1b.sh + tiffcrop-extractz14-palette-1c-1b.sh + tiffcrop-extractz14-palette-1c-4b.sh + tiffcrop-extractz14-palette-1c-8b.sh + tiffcrop-extractz14-rgb-3c-16b.sh + tiffcrop-extractz14-rgb-3c-8b.sh + tiffcrop-R90-logluv-3c-16b.sh + tiffcrop-R90-minisblack-1c-16b.sh + tiffcrop-R90-minisblack-1c-8b.sh + tiffcrop-R90-minisblack-2c-8b-alpha.sh + tiffcrop-R90-miniswhite-1c-1b.sh + tiffcrop-R90-palette-1c-1b.sh + tiffcrop-R90-palette-1c-4b.sh + tiffcrop-R90-palette-1c-8b.sh + tiffcrop-R90-rgb-3c-16b.sh + tiffcrop-R90-rgb-3c-8b.sh + tiff2rgba-logluv-3c-16b.sh + tiff2rgba-minisblack-1c-16b.sh + tiff2rgba-minisblack-1c-8b.sh + tiff2rgba-minisblack-2c-8b-alpha.sh + tiff2rgba-miniswhite-1c-1b.sh + tiff2rgba-palette-1c-1b.sh + tiff2rgba-palette-1c-4b.sh + tiff2rgba-palette-1c-8b.sh + tiff2rgba-rgb-3c-16b.sh + tiff2rgba-rgb-3c-8b.sh + tiff2rgba-quad-tile.jpg.sh) + +# This list should contain all of the TIFF files in the 'images' +# subdirectory which are intended to be used as input images for +# tests. All of these files should use the extension ".tiff". +set(TIFFIMAGES + images/logluv-3c-16b.tiff + images/minisblack-1c-16b.tiff + images/minisblack-1c-8b.tiff + images/minisblack-2c-8b-alpha.tiff + images/miniswhite-1c-1b.tiff + images/palette-1c-1b.tiff + images/palette-1c-4b.tiff + images/palette-1c-8b.tiff + images/rgb-3c-16b.tiff + images/rgb-3c-8b.tiff + images/quad-tile.jpg.tiff) + +set(BMPIMAGES + images/palette-1c-8b.bmp + images/rgb-3c-8b.bmp) + +set(GIFIMAGES + images/palette-1c-8b.gif) + +set(PNMIMAGES + images/minisblack-1c-8b.pgm + images/miniswhite-1c-1b.pbm + images/rgb-3c-8b.ppm) + +# All uncompressed image files +set(UNCOMPRESSEDIMAGES + images/minisblack-1c-16b.tiff + images/minisblack-1c-8b.tiff + images/miniswhite-1c-1b.tiff + images/palette-1c-1b.tiff + images/palette-1c-4b.tiff + images/palette-1c-8b.tiff + images/rgb-3c-8b.tiff) + +# This list should include all of the files in the 'images' +# subdirectory which are intended to be distributed. This may include +# files which are not currently used by the tests. +set(IMAGES_EXTRA_DIST + images/README.txt + ${BMPIMAGES} + ${GIFIMAGES} + ${PNMIMAGES} + ${TIFFIMAGES}) + +extra_dist( + ${TESTSCRIPTS} + ${IMAGES_EXTRA_DIST} + common.sh) + +set(noinst_HEADERS tifftest.h) + +add_executable(ascii_tag ascii_tag.c) +target_link_libraries(ascii_tag tiff port) + +add_executable(long_tag long_tag.c check_tag.c) +target_link_libraries(long_tag tiff port) + +add_executable(short_tag short_tag.c check_tag.c) +target_link_libraries(short_tag tiff port) + +add_executable(strip_rw strip_rw.c strip.c test_arrays.c test_arrays.h) +target_link_libraries(strip_rw tiff port) + +add_executable(rewrite rewrite_tag.c) +target_link_libraries(rewrite tiff port) + +if(JPEG_SUPPORT) + add_executable(raw_decode raw_decode.c) + target_link_libraries(raw_decode tiff port) +endif() + +add_executable(custom_dir custom_dir.c) +target_link_libraries(custom_dir tiff port) + +set(TEST_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/output") +file(MAKE_DIRECTORY "${TEST_OUTPUT}") + +macro(tiff_test_convert name command1 command2 command3 infile outfile validate) + add_test(NAME "${name}" + COMMAND "${CMAKE_COMMAND}" + "-DCONVERT_COMMAND1=${command1}" + "-DCONVERT_COMMAND2=${command2}" + "-DCONVERT_COMMAND3=${command3}" + "-DINFILE=${infile}" + "-DOUTFILE=${outfile}" + "-DTIFFINFO=$" + "-DLIBTIFF=$" + "-DVALIDATE=${validate}" + -P "${CMAKE_CURRENT_SOURCE_DIR}/TiffTest.cmake") +endmacro() + +macro(tiff_test_stdout name command infile outfile) + add_test(NAME "${name}" + COMMAND "${CMAKE_COMMAND}" + "-DSTDOUT_COMMAND=${command}" + "-DINFILE=${infile}" + "-DOUTFILE=${outfile}" + "-DTIFFINFO=$" + "-DLIBTIFF=$" + -P "${CMAKE_CURRENT_SOURCE_DIR}/TiffTest.cmake") +endmacro() + +macro(tiff_test_reader name command infile) + add_test(NAME "${name}" + COMMAND "${CMAKE_COMMAND}" + "-DREADER_COMMAND=${command}" + "-DINFILE=${infile}" + "-DTIFFINFO=$" + "-DLIBTIFF=$" + -P "${CMAKE_CURRENT_SOURCE_DIR}/TiffTest.cmake") +endmacro() + +macro(add_convert_test_multi commandname1 commandname2 commandname3 + categoryname commandargs1 commandargs2 commandargs3 + image validate) + string(REPLACE " " "^" escaped_commandargs1 "${commandargs1}") + string(REPLACE " " "^" escaped_commandargs2 "${commandargs2}") + string(REPLACE " " "^" escaped_commandargs3 "${commandargs3}") + get_filename_component(name "${image}" NAME) + get_filename_component(base "${image}" NAME_WE) + set(testname "${commandname1}-${categoryname}-${base}") + if(commandname1) + set(command1 + "$^${escaped_commandargs1}") + else() + set(command1) + endif() + if(commandname2) + set(command2 + "$^${escaped_commandargs2}") + else() + set(command2) + endif() + if(commandname3) + set(command3 + "$^${escaped_commandargs3}") + else() + set(command3) + endif() + set(infile "${CMAKE_CURRENT_SOURCE_DIR}/${image}") + set(outfile "${TEST_OUTPUT}/${commandname1}-${categoryname}-${name}") + string(REGEX REPLACE "\\.tiff\$" "" name "${name}") + tiff_test_convert("${testname}" "${command1}" "${command2}" "${command3}" + "${infile}" "${outfile}" "${validate}") +endmacro() + +macro(add_convert_test commandname + categoryname commandargs + image validate) + add_convert_test_multi("${commandname}" "" "" + "${categoryname}" "${commandargs}" "" "" + "${image}" "${validate}") +endmacro() + +macro(add_convert_tests_multi commandname commandname2 commandname3 + categoryname + commandargs1 commandargs2 commandargs3 + images validate) + foreach(file ${${images}}) + add_convert_test_multi("${commandname1}" "${commandname2}" + "${commandname3}" "${categoryname}" + "${commandargs1}" "${commandargs2}" + "${commandargs3}" "${file}" "${validate}") + endforeach() +endmacro() + +macro(add_convert_tests commandname categoryname commandargs images validate) + foreach(file ${${images}}) + add_convert_test("${commandname}" "${categoryname}" + "${commandargs}" "${file}" "${validate}") + endforeach() +endmacro() + +macro(add_stdout_test commandname commandargs image) + string(REPLACE " " "^" escaped_commandargs "${commandargs}") + get_filename_component(name "${image}" NAME) + get_filename_component(base "${image}" NAME_WE) + set(testname "${commandname}-${base}") + set(command "$^${escaped_commandargs}") + set(infile "${CMAKE_CURRENT_SOURCE_DIR}/${image}") + set(outfile "${TEST_OUTPUT}/${commandname}-${name}") + string(REGEX REPLACE "\\.tiff\$" "" name "${name}") + tiff_test_stdout("${testname}" "${command}" "${infile}" "${outfile}") +endmacro() + +macro(add_reader_test commandname commandargs image) + string(REPLACE " " "^" escaped_commandargs "${commandargs}") + get_filename_component(name "${image}" NAME) + get_filename_component(base "${image}" NAME_WE) + set(testname "${commandname}-${base}") + set(command "$^${escaped_commandargs}") + set(infile "${CMAKE_CURRENT_SOURCE_DIR}/${image}") + string(REGEX REPLACE "\\.tiff\$" "" name "${name}") + tiff_test_reader("${testname}" "${command}" "${infile}") +endmacro() + +# BMP +add_convert_test(bmp2tiff palette "" "images/palette-1c-8b.bmp" TRUE) +add_convert_test(bmp2tiff rgb "" "images/rgb-3c-8b.bmp" TRUE) + +# GIF +add_convert_test(gif2tiff palette "" "images/palette-1c-8b.gif" TRUE) + +# PPM +add_convert_test(ppm2tiff miniswhite "" "images/miniswhite-1c-1b.pbm" TRUE) +add_convert_test(ppm2tiff minisblack "" "images/minisblack-1c-8b.pgm" TRUE) +add_convert_test(ppm2tiff rgb "" "images/rgb-3c-8b.ppm" TRUE) + +# tiffcp +add_convert_test(tiffcp g3 "-c g3" "images/miniswhite-1c-1b.tiff" FALSE) +add_convert_test(tiffcp g31d "-c g3:1d" "images/miniswhite-1c-1b.tiff" FALSE) +add_convert_test(tiffcp g31dfill "-c g3:1d:fill" "images/miniswhite-1c-1b.tiff" FALSE) +add_convert_test(tiffcp g32d "-c g3:2d" "images/miniswhite-1c-1b.tiff" FALSE) +add_convert_test(tiffcp g32dfill "-c g3:2d:fill" "images/miniswhite-1c-1b.tiff" FALSE) +add_convert_test(tiffcp g4 "-c g4" "images/miniswhite-1c-1b.tiff" FALSE) +add_convert_test_multi(tiffcp tiffcp "" logluv "-c none" "-c sgilog" "" + "images/logluv-3c-16b.tiff" FALSE) +add_convert_test_multi(tiffcp thumbnail "" thumbnail "g3:1d" "" "" + "images/miniswhite-1c-1b.tiff" FALSE) + +# tiffdump +add_reader_test(tiffdump "" "images/miniswhite-1c-1b.tiff") + +# tiffinfo +add_reader_test(tiffinfo "-c -D -d -j -s" "images/minisblack-1c-16b.tiff") + +# tiffcp split/join +foreach(image ${UNCOMPRESSEDIMAGES}) + list(APPEND ESCAPED_UNCOMPRESSED "${CMAKE_CURRENT_SOURCE_DIR}/${image}") +endforeach() +string(REPLACE ";" "^" ESCAPED_UNCOMPRESSED "${ESCAPED_UNCOMPRESSED}") +add_test(NAME "tiffcp-split" + COMMAND "${CMAKE_COMMAND}" + "-DTESTFILES=${ESCAPED_UNCOMPRESSED}" + "-DCONJOINED=${TEST_OUTPUT}/tiffcp-split-conjoined.tif" + "-DSPLITFILE=${TEST_OUTPUT}/tiffcp-split-split-" + "-DTIFFCP=$" + "-DTIFFSPLIT=$" + "-DLIBTIFF=$" + -P "${CMAKE_CURRENT_SOURCE_DIR}/TiffSplitTest.cmake") +add_test(NAME "tiffcp-split-join" + COMMAND "${CMAKE_COMMAND}" + "-DTESTFILES=${ESCAPED_UNCOMPRESSED}" + "-DCONJOINED=${TEST_OUTPUT}/tiffcp-split-join-conjoined.tif" + "-DSPLITFILE=${TEST_OUTPUT}/tiffcp-split-join-split-" + "-DRECONJOINED=${TEST_OUTPUT}/tiffcp-split-join-reconjoined.tif" + "-DTIFFCP=$" + "-DTIFFSPLIT=$" + "-DLIBTIFF=$" + -P "${CMAKE_CURRENT_SOURCE_DIR}/TiffSplitTest.cmake") + +# PDF +add_stdout_test(tiff2pdf "" "images/miniswhite-1c-1b.tiff" TRUE) + +# RGBA +add_convert_tests(tiff2rgba default "" TIFFIMAGES TRUE) +# Test rotations +add_convert_tests(tiffcrop R90 "-R90" TIFFIMAGES TRUE) +# Test flip (mirror) +add_convert_tests(tiffcrop doubleflip "-F both" TIFFIMAGES TRUE) +# Test extracting a section 60 pixels wide and 60 pixels high +add_convert_tests(tiffcrop extract "-U px -E top -X 60 -Y 60" TIFFIMAGES TRUE) +# Test extracting the first and fourth quarters from the left side. +add_convert_tests(tiffcrop extractz14 "-E left -Z1:4,2:4" TIFFIMAGES TRUE) diff --git a/test/TiffSplitTest.cmake b/test/TiffSplitTest.cmake new file mode 100644 index 00000000..cf31f442 --- /dev/null +++ b/test/TiffSplitTest.cmake @@ -0,0 +1,34 @@ +# CMake tests for libtiff +# +# Copyright © 2015 Open Microscopy Environment / University of Dundee +# Written by Roger Leigh +# +# Permission to use, copy, modify, distribute, and sell this software and +# its documentation for any purpose is hereby granted without fee, provided +# that (i) the above copyright notices and this permission notice appear in +# all copies of the software and related documentation, and (ii) the names of +# Sam Leffler and Silicon Graphics may not be used in any advertising or +# publicity relating to the software without the specific, prior written +# permission of Sam Leffler and Silicon Graphics. +# +# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, +# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY +# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. +# +# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR +# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, +# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF +# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE +# OF THIS SOFTWARE. + +include(${CMAKE_CURRENT_LIST_DIR}/TiffTestCommon.cmake) + +string(REPLACE "^" ";" TESTFILES "${TESTFILES}") + +test_convert_multi("${TIFFCP}" "${TESTFILES}" "${CONJOINED}") +test_convert("${TIFFSPLIT}" "${CONJOINED}" "${SPLITFILE}") +if (RECONJOINED) + file(GLOB SPLITFILES "${SPLITFILE}*") + test_convert_multi("${TIFFCP}" "${SPLITFILES}" "${RECONJOINED}") +endif() diff --git a/test/TiffTest.cmake b/test/TiffTest.cmake new file mode 100644 index 00000000..c1cf4d05 --- /dev/null +++ b/test/TiffTest.cmake @@ -0,0 +1,63 @@ +# CMake tests for libtiff +# +# Copyright © 2015 Open Microscopy Environment / University of Dundee +# Written by Roger Leigh +# +# Permission to use, copy, modify, distribute, and sell this software and +# its documentation for any purpose is hereby granted without fee, provided +# that (i) the above copyright notices and this permission notice appear in +# all copies of the software and related documentation, and (ii) the names of +# Sam Leffler and Silicon Graphics may not be used in any advertising or +# publicity relating to the software without the specific, prior written +# permission of Sam Leffler and Silicon Graphics. +# +# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, +# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY +# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. +# +# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR +# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, +# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF +# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE +# OF THIS SOFTWARE. + +include(${CMAKE_CURRENT_LIST_DIR}/TiffTestCommon.cmake) + +string(REPLACE "^" ";" CONVERT_COMMAND1 "${CONVERT_COMMAND1}") +string(REPLACE "^" ";" CONVERT_COMMAND2 "${CONVERT_COMMAND2}") +string(REPLACE "^" ";" CONVERT_COMMAND3 "${CONVERT_COMMAND3}") +string(REPLACE "^" ";" STDOUT_COMMAND "${STDOUT_COMMAND}") +string(REPLACE "^" ";" READER_COMMAND "${READER_COMMAND}") + +if(CONVERT_COMMAND1) + test_convert("${CONVERT_COMMAND1}" "${INFILE}" "${OUTFILE}") + if(VALIDATE) + tiffinfo_validate("${OUTFILE}") + endif() +endif() + +get_filename_component(base "${OUTFILE}" NAME) +get_filename_component(ext "${OUTFILE}" EXT) + +if(CONVERT_COMMAND2) + test_convert("${CONVERT_COMMAND2}" "${OUTFILE}" "${base}-2${ext}") + if(VALIDATE) + tiffinfo_validate("${base}-2${ext}") + endif() +endif() + +if(CONVERT_COMMAND3) + test_convert("${CONVERT_COMMAND3}" "${base}-2${ext}" "${base}-3${ext}") + if(VALIDATE) + tiffinfo_validate("${base}-3${ext}") + endif() +endif() + +if(STDOUT_COMMAND) + test_stdout("${STDOUT_COMMAND}" "${INFILE}" "${OUTFILE}") +endif() + +if(READER_COMMAND) + test_reader("${READER_COMMAND}" "${INFILE}") +endif() diff --git a/test/TiffTestCommon.cmake b/test/TiffTestCommon.cmake new file mode 100644 index 00000000..50a4c34a --- /dev/null +++ b/test/TiffTestCommon.cmake @@ -0,0 +1,103 @@ +# CMake tests for libtiff (common functionality) +# +# Copyright © 2015 Open Microscopy Environment / University of Dundee +# Written by Roger Leigh +# +# Permission to use, copy, modify, distribute, and sell this software and +# its documentation for any purpose is hereby granted without fee, provided +# that (i) the above copyright notices and this permission notice appear in +# all copies of the software and related documentation, and (ii) the names of +# Sam Leffler and Silicon Graphics may not be used in any advertising or +# publicity relating to the software without the specific, prior written +# permission of Sam Leffler and Silicon Graphics. +# +# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, +# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY +# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. +# +# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR +# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, +# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF +# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE +# OF THIS SOFTWARE. + +# +# Test a simple convert-like command. +# +# test_convert command infile outfile +macro(test_convert command infile outfile) + file(TO_NATIVE_PATH "${infile}" native_infile) + file(TO_NATIVE_PATH "${outfile}" native_outfile) + file(REMOVE "${outfile}") + message(STATUS Running "${MEMCHECK} ${command} ${native_infile} ${native_outfile}") + execute_process(COMMAND ${MEMCHECK} ${command} "${native_infile}" "${native_outfile}" + RESULT_VARIABLE TEST_STATUS) + if(TEST_STATUS) + message(FATAL_ERROR "Returned failed status ${TEST_STATUS}! Output (if any) is in \"${native_outfile}\"") + endif() +endmacro() + +# +# Test a simple convert-like command. +# +# test_convert command infile outfile +macro(test_convert_multi command infile outfile) + foreach(file ${infile}) + file(TO_NATIVE_PATH "${file}" native_file) + list(APPEND native_infile "${native_file}") + endforeach() + file(TO_NATIVE_PATH "${outfile}" native_outfile) + file(REMOVE "${outfile}") + message(STATUS Running "${MEMCHECK} ${command} ${native_infile} ${native_outfile}") + execute_process(COMMAND ${MEMCHECK} ${command} ${native_infile} "${native_outfile}" + RESULT_VARIABLE TEST_STATUS) + if(TEST_STATUS) + message(FATAL_ERROR "Returned failed status ${TEST_STATUS}! Output (if any) is in \"${native_outfile}\"") + endif() +endmacro() +# +# Test a simple command which sends output to stdout +# +# test_stdout command infile outfile +macro(test_stdout command infile outfile) + file(TO_NATIVE_PATH "${infile}" native_infile) + file(TO_NATIVE_PATH "${outfile}" native_outfile) + file(REMOVE "${outfile}") + message(STATUS "Running ${MEMCHECK} ${command} ${native_infile} > ${native_outfile}") + execute_process(COMMAND ${MEMCHECK} ${command} "${native_infile}" + OUTPUT_FILE "${outfile}" + RESULT_VARIABLE TEST_STATUS) + if(TEST_STATUS) + message(FATAL_ERROR "Returned failed status ${TEST_STATUS}! Output (if any) is in \"${native_outfile}") + endif() +endmacro() + +# +# Execute a simple command (e.g. tiffinfo) with one input file +# +# test_exec command infile +macro(test_reader command infile) + file(TO_NATIVE_PATH "${infile}" native_infile) + message(STATUS "Running ${MEMCHECK} ${command} ${native_infile}") + execute_process(COMMAND ${MEMCHECK} ${command} "${native_infile}" + RESULT_VARIABLE TEST_STATUS) + if(TEST_STATUS) + message(FATAL_ERROR "Returned failed status ${TEST_STATUS}! Output (if any) is in \"${native_outfile}") + endif() +endmacro() + +# +# Execute tiffinfo on a specified file to validate it +# +# tiffinfo_validate infile +macro(tiffinfo_validate file) + test_reader("${TIFFINFO};-D" "${file}") +endmacro() + +# Add the directory containing libtiff to the PATH (Windows only) +if(WIN32) + get_filename_component(LIBTIFF_DIR "${LIBTIFF}" DIRECTORY) + file(TO_NATIVE_PATH "${LIBTIFF_DIR}" LIBTIFF_DIR) + set(ENV{PATH} "${LIBTIFF_DIR};$ENV{PATH}") +endif() diff --git a/test/rewrite_tag.c b/test/rewrite_tag.c index f2af99ae..b65d5c01 100644 --- a/test/rewrite_tag.c +++ b/test/rewrite_tag.c @@ -1,4 +1,4 @@ -/* $Id: rewrite_tag.c,v 1.7 2015-06-20 16:33:40 bfriesen Exp $ */ +/* $Id: rewrite_tag.c,v 1.8 2015-06-25 02:28:01 bfriesen Exp $ */ /* * Copyright (c) 2007, Frank Warmerdam @@ -324,9 +324,6 @@ main(int argc, char **argv) { int failure = 0; - (void) argc; - (void) argv; - failure |= test_packbits(); /* test fairly normal use */ diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt new file mode 100644 index 00000000..c8a5005f --- /dev/null +++ b/tools/CMakeLists.txt @@ -0,0 +1,138 @@ +# CMake build for libtiff +# +# Copyright © 2015 Open Microscopy Environment / University of Dundee +# Written by Roger Leigh +# +# Permission to use, copy, modify, distribute, and sell this software and +# its documentation for any purpose is hereby granted without fee, provided +# that (i) the above copyright notices and this permission notice appear in +# all copies of the software and related documentation, and (ii) the names of +# Sam Leffler and Silicon Graphics may not be used in any advertising or +# publicity relating to the software without the specific, prior written +# permission of Sam Leffler and Silicon Graphics. +# +# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, +# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY +# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. +# +# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR +# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, +# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF +# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE +# OF THIS SOFTWARE. + +extra_dist(Makefile.vc) + +include_directories(${PROJECT_SOURCE_DIR}/libtiff + ${PROJECT_BINARY_DIR}/libtiff + ${CMAKE_CURRENT_BINARY_DIR}) + +add_executable(bmp2tiff bmp2tiff.c) +target_link_libraries(bmp2tiff tiff port) + +add_executable(fax2ps fax2ps.c) +target_link_libraries(fax2ps tiff port) + +add_executable(fax2tiff fax2tiff.c) +target_link_libraries(fax2tiff tiff port) + +add_executable(gif2tiff gif2tiff.c) +target_link_libraries(gif2tiff tiff port) + +add_executable(pal2rgb pal2rgb.c) +target_link_libraries(pal2rgb tiff port) + +add_executable(ppm2tiff ppm2tiff.c) +target_link_libraries(ppm2tiff tiff port) + +add_executable(ras2tiff ras2tiff.c rasterfile.h) +target_link_libraries(ras2tiff tiff port) + +add_executable(raw2tiff raw2tiff.c) +target_link_libraries(raw2tiff tiff port) + +add_executable(rgb2ycbcr rgb2ycbcr.c) +target_link_libraries(rgb2ycbcr tiff port) + +add_executable(thumbnail thumbnail.c) +target_link_libraries(thumbnail tiff port) + +add_executable(tiff2bw tiff2bw.c) +target_link_libraries(tiff2bw tiff port) + +add_executable(tiff2pdf tiff2pdf.c) +target_link_libraries(tiff2pdf tiff port) + +add_executable(tiff2ps tiff2ps.c) +target_link_libraries(tiff2ps tiff port) + +add_executable(tiff2rgba tiff2rgba.c) +target_link_libraries(tiff2rgba tiff port) + +add_executable(tiffcmp tiffcmp.c) +target_link_libraries(tiffcmp tiff port) + +add_executable(tiffcp tiffcp.c) +target_link_libraries(tiffcp tiff port) + +add_executable(tiffcrop tiffcrop.c) +target_link_libraries(tiffcrop tiff port) + +add_executable(tiffdither tiffdither.c) +target_link_libraries(tiffdither tiff port) + +add_executable(tiffdump tiffdump.c) +target_link_libraries(tiffdump tiff port) + +add_executable(tiffinfo tiffinfo.c) +target_link_libraries(tiffinfo tiff port) + +add_executable(tiffmedian tiffmedian.c) +target_link_libraries(tiffmedian tiff port) + +add_executable(tiffset tiffset.c) +target_link_libraries(tiffset tiff port) + +add_executable(tiffsplit tiffsplit.c) +target_link_libraries(tiffsplit tiff port) + +install(TARGETS bmp2tiff + fax2ps + fax2tiff + gif2tiff + pal2rgb + ppm2tiff + ras2tiff + raw2tiff + rgb2ycbcr + thumbnail + tiff2bw + tiff2pdf + tiff2ps + tiff2rgba + tiffcmp + tiffcp + tiffcrop + tiffdither + tiffdump + tiffinfo + tiffmedian + tiffset + tiffsplit + RUNTIME DESTINATION "${CMAKE_INSTALL_FULL_BINDIR}") + +if(HAVE_OPENGL) + if(OPENGL_INCLUDE_DIR) + include_directories(${OPENGL_INCLUDE_DIR}) + endif() + if(GLUT_INCLUDE_DIR) + include_directories(${GLUT_INCLUDE_DIR}) + endif() + + add_executable(tiffgt tiffgt.c) + target_link_libraries(tiffgt tiff ${GLUT_LIBRARIES} ${OPENGL_LIBRARIES}) + + install(TARGETS tiffgt + RUNTIME DESTINATION "${CMAKE_INSTALL_FULL_BINDIR}") +endif() diff --git a/tools/tiffgt.c b/tools/tiffgt.c index 84ca491c..3a0d5154 100644 --- a/tools/tiffgt.c +++ b/tools/tiffgt.c @@ -1,4 +1,4 @@ -/* $Id: tiffgt.c,v 1.13 2015-06-21 01:09:11 bfriesen Exp $ */ +/* $Id: tiffgt.c,v 1.14 2015-06-25 02:28:01 bfriesen Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler @@ -31,11 +31,14 @@ #include #include -#if HAVE_APPLE_OPENGL_FRAMEWORK +#ifdef HAVE_OPENGL_GL_H # include -# include #else # include +#endif +#ifdef HAVE_GLUT_GLUT_H +# include +#else # include #endif