Home | History | Annotate | Download | only in libtiff
      1 # ----------------------------------------------------------------------------
      2 #  CMake file for libtiff. See root CMakeLists.txt
      3 #
      4 # ----------------------------------------------------------------------------
      5 project(${TIFF_LIBRARY})
      6 
      7 include(CheckFunctionExists)
      8 include(CheckIncludeFile)
      9 
     10 check_include_file(assert.h HAVE_ASSERT_H)
     11 check_include_file(fcntl.h HAVE_FCNTL_H)
     12 check_include_file(io.h HAVE_IO_H)
     13 check_function_exists(jbg_newlen HAVE_JBG_NEWLEN)
     14 check_function_exists(mmap HAVE_MMAP)
     15 check_include_file(search.h HAVE_SEARCH_H)
     16 check_include_file(string.h HAVE_STRING_H)
     17 check_include_file(sys/types.h HAVE_SYS_TYPES_H)
     18 check_include_file(unistd.h HAVE_UNISTD_H)
     19 
     20 if(WIN32 AND NOT WINRT)
     21   set(USE_WIN32_FILEIO 1)
     22 endif()
     23 
     24 configure_file("${CMAKE_CURRENT_SOURCE_DIR}/tif_config.h.cmakein"
     25                "${CMAKE_CURRENT_BINARY_DIR}/tif_config.h" @ONLY)
     26 
     27 ocv_include_directories("${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_BINARY_DIR}" ${ZLIB_INCLUDE_DIRS})
     28 
     29 set(lib_srcs
     30     tif_aux.c
     31     tif_close.c
     32     tif_codec.c
     33     tif_color.c
     34     tif_compress.c
     35     tif_dir.c
     36     tif_dirinfo.c
     37     tif_dirread.c
     38     tif_dirwrite.c
     39     tif_dumpmode.c
     40     tif_error.c
     41     tif_extension.c
     42     tif_fax3.c
     43     tif_fax3sm.c
     44     tif_flush.c
     45     tif_getimage.c
     46     tif_jbig.c
     47     tif_jpeg_12.c
     48     tif_jpeg.c
     49     tif_luv.c
     50     tif_lzma.c
     51     tif_lzw.c
     52     tif_next.c
     53     tif_ojpeg.c
     54     tif_open.c
     55     tif_packbits.c
     56     tif_pixarlog.c
     57     tif_predict.c
     58     tif_print.c
     59     tif_read.c
     60     tif_strip.c
     61     tif_swab.c
     62     tif_thunder.c
     63     tif_tile.c
     64     tif_version.c
     65     tif_warning.c
     66     tif_write.c
     67     tif_zip.c
     68     tif_stream.cxx
     69     t4.h
     70     tif_dir.h
     71     tif_fax3.h
     72     tiff.h
     73     tiffio.h
     74     tiffiop.h
     75     tiffvers.h
     76     tif_predict.h
     77     uvcode.h
     78     tiffio.hxx
     79     "${CMAKE_CURRENT_BINARY_DIR}/tif_config.h"
     80     )
     81 
     82 if(WIN32 AND NOT WINRT)
     83   list(APPEND lib_srcs tif_win32.c)
     84 else()
     85   list(APPEND lib_srcs tif_unix.c)
     86 endif()
     87 
     88 ocv_warnings_disable(CMAKE_C_FLAGS -Wno-unused-but-set-variable -Wmissing-prototypes -Wmissing-declarations -Wundef -Wunused -Wsign-compare
     89                                    -Wcast-align -Wshadow -Wno-maybe-uninitialized -Wno-pointer-to-int-cast -Wno-int-to-pointer-cast)
     90 ocv_warnings_disable(CMAKE_C_FLAGS -Wunused-parameter) # clang
     91 ocv_warnings_disable(CMAKE_CXX_FLAGS -Wmissing-declarations -Wunused-parameter)
     92 ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4018 /wd4100 /wd4127 /wd4311 /wd4701 /wd4706) # vs2005
     93 ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4244) # vs2008
     94 ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4267 /wd4305 /wd4306) # vs2008 Win64
     95 ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4703) # vs2012
     96 
     97 ocv_warnings_disable(CMAKE_C_FLAGS /wd4267 /wd4244 /wd4018)
     98 
     99 if(UNIX AND (CMAKE_COMPILER_IS_GNUCXX OR CV_ICC))
    100   set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
    101 endif()
    102 
    103 add_library(${TIFF_LIBRARY} STATIC ${lib_srcs})
    104 target_link_libraries(${TIFF_LIBRARY} ${ZLIB_LIBRARIES})
    105 
    106 set_target_properties(${TIFF_LIBRARY}
    107     PROPERTIES
    108     OUTPUT_NAME "${TIFF_LIBRARY}"
    109     DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
    110     ARCHIVE_OUTPUT_DIRECTORY ${3P_LIBRARY_OUTPUT_PATH}
    111     )
    112 
    113 if(ENABLE_SOLUTION_FOLDERS)
    114   set_target_properties(${TIFF_LIBRARY} PROPERTIES FOLDER "3rdparty")
    115 endif()
    116 
    117 if(NOT BUILD_SHARED_LIBS)
    118   ocv_install_target(${TIFF_LIBRARY} EXPORT OpenCVModules ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev)
    119 endif()
    120