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.
 
 
 

114 lines
4.1 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. add_definitions(-std=gnu11)
  18. if(WIN32)
  19. SET(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
  20. SET(BUILD_SHARED_LIBRARIES OFF)
  21. SET(CMAKE_EXE_LINKER_FLAGS "-static")
  22. add_definitions(-DPCRE_STATIC)
  23. add_definitions(-D_POSIX_C_SOURCE=200809L)
  24. # FIXME: needed for MingW only
  25. add_definitions(-D_GNU_SOURCE=1)
  26. endif(WIN32)
  27. add_executable(fixit_tiff fixit_tiff.c ${fixit_tiff_SOURCES})
  28. add_executable(find_potential_IFD_offsets archeological_tools/find_potential_IFD_offsets.c)
  29. add_executable(print_ifd_at_adress archeological_tools/print_ifd_at_adress.c)
  30. set(CMAKE_EXTRA_INCLUDE_FILES tiff.h)
  31. ## libtiff5
  32. find_package(TIFF REQUIRED)
  33. if(TIFF_FOUND)
  34. # Confirm required API is available
  35. #INCLUDE(CheckFunctionExists)
  36. SET(CMAKE_REQUIRED_LIBRARIES ${TIFF_LIBRARIES})
  37. #CHECK_FUNCTION_EXISTS(TIFFOpen HAVE_TIFFOPEN)
  38. #IF(NOT HAVE_TIFFOPEN)
  39. # SET(TIFF_FOUND) # ReSET to NOT found for TIFF library
  40. # MESSAGE(FATAL_ERROR "Failed to link with libtiff - TIFFOpen function not found")
  41. #ENDIF()
  42. # CHECK_FUNCTION_EXISTS(TIFFMergeFieldInfo HAVE_TIFFMERGEFIELDINFO)
  43. #IF(NOT HAVE_TIFFMERGEFIELDINFO)
  44. # SET(TIFF_FOUND) # ReSET to NOT found for TIFF library
  45. # 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")
  46. #ENDIF()
  47. INCLUDE_DIRECTORIES(${TIFF_INCLUDE_DIR})
  48. ADD_DEFINITIONS(-DHAVE_TIFF=1)
  49. CHECK_SYMBOL_EXISTS(TIFFTAG_IMAGELAYER "tiff.h" HAVE_TIFFTAG_IMAGE_LAYER)
  50. IF(NOT HAVE_TIFFTAG_IMAGE_LAYER)
  51. MESSAGE(STATUS "old tiff library detected, -DTIFFTAG_IMAGELAYER=34732 added")
  52. ADD_DEFINITIONS(-DTIFFTAG_IMAGELAYER=34732)
  53. ENDIF()
  54. CHECK_SYMBOL_EXISTS(TIFF_UINT64_T "tiff.h" HAVE_TIFF_UINT64_T)
  55. IF(NOT HAVE_TIFF_UINT64_T)
  56. MESSAGE(STATUS "old tiff library detected, -Duint64='unsigned long long' added")
  57. if(SIZEOF_UNSIGNED_LONG EQUAL 8)
  58. set(TIFF_UINT64_T "unsigned long")
  59. set(TIFF_UINT64_FORMAT "%lu")
  60. elseif(SIZEOF_UNSIGNED_LONG_LONG EQUAL 8)
  61. set(TIFF_UINT64_T "unsigned long long")
  62. if (MINGW)
  63. set(TIFF_UINT64_FORMAT "%I64u")
  64. else()
  65. set(TIFF_UINT64_FORMAT "%llu")
  66. endif()
  67. endif()
  68. ENDIF()
  69. CHECK_SYMBOL_EXISTS(TIFF_INT64_T "tiff.h" HAVE_TIFF_INT64_T)
  70. IF(NOT HAVE_TIFF_INT64_T)
  71. MESSAGE(STATUS "old tiff library detected, -Dint64='long long' added")
  72. if(SIZEOF_SIGNED_LONG EQUAL 8)
  73. set(TIFF_INT64_T "signed long")
  74. set(TIFF_INT64_FORMAT "%ld")
  75. elseif(SIZEOF_SIGNED_LONG_LONG EQUAL 8)
  76. set(TIFF_INT64_T "signed long long")
  77. if (MINGW)
  78. set(TIFF_INT64_FORMAT "%I64d")
  79. else()
  80. set(TIFF_INT64_FORMAT "%lld")
  81. endif()
  82. endif()
  83. ENDIF()
  84. else(TIFF_FOUND)
  85. MESSAGE(FATAL_ERROR "No TIFF library found, add $TIFF_INCLUDE_DIR manually")
  86. endif(TIFF_FOUND)
  87. TARGET_LINK_LIBRARIES(fixit_tiff ${TIFF_LIBRARIES})
  88. TARGET_LINK_LIBRARIES(find_potential_IFD_offsets ${TIFF_LIBRARIES})
  89. TARGET_LINK_LIBRARIES(print_ifd_at_adress ${TIFF_LIBRARIES})
  90. install( TARGETS fixit_tiff
  91. RUNTIME DESTINATION bin
  92. LIBRARY DESTINATION lib
  93. )
  94. install(DIRECTORY
  95. ../examples
  96. DESTINATION share/fixit_tiff/
  97. )
  98. file( GLOB README_FILES "../README*" "../FAQ" "../LICENSE" "../TODO" "../BUGS")
  99. install(FILES ${README_FILES} DESTINATION share/fixit_tiff/)