• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# ----------------------------------------------------------------------------
2#  CMake file for libtiff. See root CMakeLists.txt
3#
4# ----------------------------------------------------------------------------
5project(${TIFF_LIBRARY})
6
7include(CheckFunctionExists)
8include(CheckIncludeFile)
9
10check_include_file(assert.h HAVE_ASSERT_H)
11check_include_file(fcntl.h HAVE_FCNTL_H)
12check_include_file(io.h HAVE_IO_H)
13check_function_exists(jbg_newlen HAVE_JBG_NEWLEN)
14check_function_exists(mmap HAVE_MMAP)
15check_include_file(search.h HAVE_SEARCH_H)
16check_include_file(string.h HAVE_STRING_H)
17check_include_file(sys/types.h HAVE_SYS_TYPES_H)
18check_include_file(unistd.h HAVE_UNISTD_H)
19
20if(WIN32 AND NOT WINRT)
21  set(USE_WIN32_FILEIO 1)
22endif()
23
24configure_file("${CMAKE_CURRENT_SOURCE_DIR}/tif_config.h.cmakein"
25               "${CMAKE_CURRENT_BINARY_DIR}/tif_config.h" @ONLY)
26
27ocv_include_directories("${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_BINARY_DIR}" ${ZLIB_INCLUDE_DIRS})
28
29set(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
82if(WIN32 AND NOT WINRT)
83  list(APPEND lib_srcs tif_win32.c)
84else()
85  list(APPEND lib_srcs tif_unix.c)
86endif()
87
88ocv_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)
90ocv_warnings_disable(CMAKE_C_FLAGS -Wunused-parameter) # clang
91ocv_warnings_disable(CMAKE_CXX_FLAGS -Wmissing-declarations -Wunused-parameter)
92ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4018 /wd4100 /wd4127 /wd4311 /wd4701 /wd4706) # vs2005
93ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4244) # vs2008
94ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4267 /wd4305 /wd4306) # vs2008 Win64
95ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4703) # vs2012
96
97ocv_warnings_disable(CMAKE_C_FLAGS /wd4267 /wd4244 /wd4018)
98
99if(UNIX AND (CMAKE_COMPILER_IS_GNUCXX OR CV_ICC))
100  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
101endif()
102
103add_library(${TIFF_LIBRARY} STATIC ${lib_srcs})
104target_link_libraries(${TIFF_LIBRARY} ${ZLIB_LIBRARIES})
105
106set_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
113if(ENABLE_SOLUTION_FOLDERS)
114  set_target_properties(${TIFF_LIBRARY} PROPERTIES FOLDER "3rdparty")
115endif()
116
117if(NOT BUILD_SHARED_LIBS)
118  ocv_install_target(${TIFF_LIBRARY} EXPORT OpenCVModules ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev)
119endif()
120