tool to fixes some issues in baseline tiffs (with extensions), see http://andreas-romeyke.de
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

88 lines
3.2 KiB

  1. cmake_minimum_required (VERSION 2.6)
  2. project (fixit_tiff)
  3. include_directories("${PROJECT_SOURCE_DIR}")
  4. include (CheckSymbolExists)
  5. file( GLOB fixit_tiff_SOURCES
  6. "${PROJECT_SOURCE_DIR}/*.c"
  7. )
  8. #
  9. # Make a version file containing the current version from git.
  10. #
  11. execute_process( COMMAND git rev-list HEAD --count OUTPUT_VARIABLE REPO_REVISION OUTPUT_STRIP_TRAILING_WHITESPACE )
  12. execute_process( COMMAND git rev-parse --abbrev-ref HEAD OUTPUT_VARIABLE BUILD_BRANCH OUTPUT_STRIP_TRAILING_WHITESPACE)
  13. execute_process( COMMAND git rev-parse HEAD OUTPUT_VARIABLE BUILD_REV_ID OUTPUT_STRIP_TRAILING_WHITESPACE)
  14. execute_process( COMMAND git describe --long --tags --dirty --always OUTPUT_VARIABLE BUILD_REV_ID_SHORT OUTPUT_STRIP_TRAILING_WHITESPACE)
  15. add_definitions(-DVERSION="${BUILD_BRANCH}")
  16. add_definitions(-DREPO_REVISION="${REPO_REVISION}")
  17. if(WIN32)
  18. SET(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
  19. SET(BUILD_SHARED_LIBRARIES OFF)
  20. SET(CMAKE_EXE_LINKER_FLAGS "-static")
  21. add_definitions(-DPCRE_STATIC)
  22. add_definitions(-D_POSIX_C_SOURCE=200809L)
  23. # FIXME: needed for MingW only
  24. add_definitions(-D_GNU_SOURCE=1)
  25. endif(WIN32)
  26. add_executable(fixit_tiff fixit_tiff.c ${fixit_tiff_SOURCES})
  27. set(CMAKE_EXTRA_INCLUDE_FILES tiff.h)
  28. ## libtiff5
  29. find_package(TIFF REQUIRED)
  30. if(TIFF_FOUND)
  31. # Confirm required API is available
  32. #INCLUDE(CheckFunctionExists)
  33. SET(CMAKE_REQUIRED_LIBRARIES ${TIFF_LIBRARIES})
  34. #CHECK_FUNCTION_EXISTS(TIFFOpen HAVE_TIFFOPEN)
  35. #IF(NOT HAVE_TIFFOPEN)
  36. # SET(TIFF_FOUND) # ReSET to NOT found for TIFF library
  37. # MESSAGE(FATAL_ERROR "Failed to link with libtiff - TIFFOpen function not found")
  38. #ENDIF()
  39. # CHECK_FUNCTION_EXISTS(TIFFMergeFieldInfo HAVE_TIFFMERGEFIELDINFO)
  40. #IF(NOT HAVE_TIFFMERGEFIELDINFO)
  41. # SET(TIFF_FOUND) # ReSET to NOT found for TIFF library
  42. # MESSAGE(FATAL_ERROR "Failed to link with libtiff - TIFFMergeFieldInfo function not found. libtiff 3.6.0 Beta or later required. Please upgrade or use an older version of libgeotiff")
  43. #ENDIF()
  44. INCLUDE_DIRECTORIES(${TIFF_INCLUDE_DIR})
  45. ADD_DEFINITIONS(-DHAVE_TIFF=1)
  46. CHECK_SYMBOL_EXISTS(TIFFTAG_IMAGELAYER "tiff.h" HAVE_TIFFTAG_IMAGE_LAYER)
  47. IF(NOT HAVE_TIFFTAG_IMAGE_LAYER)
  48. MESSAGE(STATUS "old tiff library detected, -DTIFFTAG_IMAGELAYER=34732 added")
  49. ADD_DEFINITIONS(-DTIFFTAG_IMAGELAYER=34732)
  50. ENDIF()
  51. CHECK_SYMBOL_EXISTS(TIFF_UINT64_T "tiff.h" HAVE_TIFF_UINT64_T)
  52. IF(NOT HAVE_TIFF_UINT64_T)
  53. MESSAGE(STATUS "old tiff library detected, -Duint64='unsigned long long' added")
  54. ADD_DEFINITIONS(-Duint64=unsigned\ long\ long)
  55. ENDIF()
  56. CHECK_SYMBOL_EXISTS(TIFF_INT64_T "tiff.h" HAVE_TIFF_INT64_T)
  57. IF(NOT HAVE_TIFF_INT64_T)
  58. MESSAGE(STATUS "old tiff library detected, -Dint64='long long' added")
  59. ADD_DEFINITIONS(-Dint64=long\ long)
  60. ENDIF()
  61. else(TIFF_FOUND)
  62. MESSAGE(FATAL_ERROR "No TIFF library found, add $TIFF_INCLUDE_DIR manually")
  63. endif(TIFF_FOUND)
  64. TARGET_LINK_LIBRARIES(fixit_tiff ${TIFF_LIBRARIES})
  65. install( TARGETS fixit_tiff
  66. RUNTIME DESTINATION bin
  67. LIBRARY DESTINATION lib
  68. )
  69. install(DIRECTORY
  70. ../examples
  71. DESTINATION share/fixit_tiff/
  72. )
  73. file( GLOB README_FILES "../README*" "../FAQ" "../LICENSE" "../TODO" "../BUGS")
  74. install(FILES ${README_FILES} DESTINATION share/fixit_tiff/)