* CMakeLists.txt, libtiff/test/Makefile.am: Applied patches by

Roger Leigh (via tiff mailing list on 2015-08-31.

CMake reads all version information directly from configure.ac to
avoid duplication of values.  This basically greps over the file
for the LIBTIFF_* variables, then translates them to the form
needed for cmake. This includes the release version and libtool
shared library version information.

Make shared/static library building configurable.  Currently it
always builds shared libraries, with static libs having a _static
suffix (copying zlib, but it means it's got a non-standard name).
CMake has a -DBUILD_SHARED_LIBS=ON|OFF option to select one or the
other, which is now used instead.  There's now a single "tiff"
target to build either shared or static as required, and all the
tests and tools are linked with this. Note: the Windows tests fail
when linked with a static libtiff (says: libtiff.dll not found).
Not really a regression since this was not tested up to this
point, and it's likely the unit tests haven't (ever?) been run on
Windows with a static libtiff, so there's some additional
portability issue here to address.  Works fine on UNIX systems,
and fine on Windows with the default to build a DLL.

Add a missing file which wasn't being distributed, causing unit
tests to fail.  Note that "find . -name '*.cmake'" lists all the
CMake files which need distributing in addition to all the
CMakeLists.txt files (which now are distributed).
This commit is contained in:
Bob Friesenhahn 2015-09-01 02:51:50 +00:00
parent 704f717cf5
commit ba57d5f0b7
5 changed files with 70 additions and 27 deletions

View File

@ -42,13 +42,38 @@ if (POLICY CMP0054)
cmake_policy(SET CMP0054 NEW)
endif(POLICY CMP0054)
# Read version information from configure.ac.
FILE(READ "${CMAKE_CURRENT_SOURCE_DIR}/configure.ac" configure)
STRING(REGEX REPLACE ";" "\\\\;" configure "${configure}")
STRING(REGEX REPLACE "\n" ";" configure "${configure}")
foreach(line ${configure})
foreach(var LIBTIFF_MAJOR_VERSION LIBTIFF_MINOR_VERSION LIBTIFF_MICRO_VERSION LIBTIFF_ALPHA_VERSION
LIBTIFF_CURRENT LIBTIFF_REVISION LIBTIFF_AGE)
if(NOT ${var})
string(REGEX MATCH "^${var}=(.*)" ${var}_MATCH "${line}")
if(${var}_MATCH)
string(REGEX REPLACE "^${var}=(.*)" "\\1" ${var} "${line}")
endif()
endif()
endforeach()
endforeach()
math(EXPR SO_MAJOR "${LIBTIFF_CURRENT} - ${LIBTIFF_AGE}")
set(SO_MINOR "${LIBTIFF_AGE}")
set(SO_REVISION "${LIBTIFF_REVISION}")
message(STATUS "Building tiff version ${LIBTIFF_MAJOR_VERSION}.${LIBTIFF_MINOR_VERSION}.${LIBTIFF_MICRO_VERSION}${LIBTIFF_ALPHA_VERSION}")
message(STATUS "libtiff library version ${SO_MAJOR}.${SO_MINOR}.${SO_REVISION}")
set(BUILD_SHARED_LIBS ON CACHE BOOL "Build shared libraries")
# Project version
project(tiff VERSION 4.0.5 LANGUAGES C)
project(tiff VERSION "${LIBTIFF_MAJOR_VERSION}.${LIBTIFF_MINOR_VERSION}.${LIBTIFF_MICRO_VERSION}" LANGUAGES C)
# the other tiff_VERSION_* variables are set automatically
set(tiff_VERSION_ALPHA beta)
set(tiff_VERSION_ALPHA "${LIBTIFF_ALPHA_VERSION}")
# Library version (unlike libtool's baroque scheme, WYSIWYG here)
set(SO_COMPATVERSION 5)
set(SO_VERSION 5.2.2)
set(SO_COMPATVERSION "${SO_MAJOR}")
set(SO_VERSION "${SO_MAJOR}.${SO_MINOR}.${SO_REVISION}")
# For autotools header compatibility
set(PACKAGE_NAME "LibTIFF Software")
@ -704,6 +729,7 @@ 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 " Build shared libraries: ${BUILD_SHARED_LIBS}")
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}")

View File

@ -1,5 +1,35 @@
2015-08-31 Bob Friesenhahn <bfriesen@simple.dallas.tx.us>
* CMakeLists.txt, libtiff/test/Makefile.am: Applied patches by
Roger Leigh (via tiff mailing list on 2015-08-31.
CMake reads all version information directly from configure.ac to
avoid duplication of values. This basically greps over the file
for the LIBTIFF_* variables, then translates them to the form
needed for cmake. This includes the release version and libtool
shared library version information.
Make shared/static library building configurable. Currently it
always builds shared libraries, with static libs having a _static
suffix (copying zlib, but it means it's got a non-standard name).
CMake has a -DBUILD_SHARED_LIBS=ON|OFF option to select one or the
other, which is now used instead. There's now a single "tiff"
target to build either shared or static as required, and all the
tests and tools are linked with this. Note: the Windows tests fail
when linked with a static libtiff (says: libtiff.dll not found).
Not really a regression since this was not tested up to this
point, and it's likely the unit tests haven't (ever?) been run on
Windows with a static libtiff, so there's some additional
portability issue here to address. Works fine on UNIX systems,
and fine on Windows with the default to build a DLL.
Add a missing file which wasn't being distributed, causing unit
tests to fail. Note that "find . -name '*.cmake'" lists all the
CMake files which need distributing in addition to all the
CMakeLists.txt files (which now are distributed).
2015-08-31 Even Rouault <even.rouault at spatialys.com>
* libtiff/tif_predict.c: pedantic change to add explicit masking
with 0xff before casting to uchar in floating-point horizontal
differencing and accumulation routines.
@ -18,6 +48,7 @@
undefined behaviour with shifts (gcc -fsanitize=shift)
2015-08-30 Even Rouault <even.rouault at spatialys.com>
* libtiff/tif_fax3.c, libtiff/tif_lzw.c, libtiff/tif_predict.c:
add explicit masking with 0xff before casting
to unsigned char (make icc -check=conversions happy)

View File

@ -114,7 +114,7 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
${TIFF_INCLUDES})
add_library(tiff SHARED ${tiff_SOURCES} ${tiff_HEADERS} ${nodist_tiff_HEADERS}
add_library(tiff ${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})
@ -130,15 +130,7 @@ if(HAVE_LD_VERSION_SCRIPT)
"-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
install(TARGETS tiff
RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR})
@ -147,7 +139,7 @@ install(FILES ${tiff_HEADERS} ${nodist_tiff_HEADERS}
DESTINATION "${CMAKE_INSTALL_FULL_INCLUDEDIR}")
if(cxx)
add_library(tiffxx SHARED ${tiffxx_SOURCES} ${tiffxx_HEADERS})
add_library(tiffxx ${tiffxx_SOURCES} ${tiffxx_HEADERS})
target_link_libraries(tiffxx tiff)
set_target_properties(tiffxx PROPERTIES SOVERSION ${SO_COMPATVERSION})
if(NOT CYGWIN)
@ -162,15 +154,7 @@ if(cxx)
"-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
install(TARGETS tiffxx
RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR})

View File

@ -39,7 +39,8 @@ EXTRA_DIST = \
CMakeLists.txt \
common.sh \
TiffSplitTest.cmake \
TiffTestCommon.cmake
TiffTestCommon.cmake \
TiffTest.cmake
# All of the tests to execute via 'make check'
TESTS = $(check_PROGRAMS) $(TESTSCRIPTS)

View File

@ -643,7 +643,8 @@ EXTRA_DIST = \
CMakeLists.txt \
common.sh \
TiffSplitTest.cmake \
TiffTestCommon.cmake
TiffTestCommon.cmake \
TiffTest.cmake
# Extra files which should be cleaned by 'make clean'