1 | # ----------------------------------------------------------------------------
|
2 | # CMake file for highgui. See root CMakeLists.txt
|
3 | # Some parts taken from version of Hartmut Seichter, HIT Lab NZ.
|
4 | # Jose Luis Blanco, 2008
|
5 | # ----------------------------------------------------------------------------
|
6 | project(opencv_highgui)
|
7 |
|
8 | if(WITH_JPEG)
|
9 | add_definitions(-DHAVE_JPEG)
|
10 | if(NOT JPEG_FOUND)
|
11 | set(use_3rdparty TRUE)
|
12 | endif()
|
13 | endif()
|
14 |
|
15 | if(WITH_PNG)
|
16 | add_definitions(-DHAVE_PNG)
|
17 | if(NOT PNG_FOUND)
|
18 | set(use_3rdparty TRUE)
|
19 | endif()
|
20 | endif()
|
21 |
|
22 | if(WITH_TIFF)
|
23 | add_definitions(-DHAVE_TIFF)
|
24 | if(NOT TIFF_FOUND)
|
25 | set(use_3rdparty TRUE)
|
26 | endif()
|
27 | endif()
|
28 |
|
29 | if(WITH_JASPER)
|
30 | add_definitions(-DHAVE_JASPER)
|
31 | if(NOT JASPER_FOUND)
|
32 | set(use_3rdparty TRUE)
|
33 | endif()
|
34 | endif()
|
35 |
|
36 | if(use_3rdparty)
|
37 | include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../../3rdparty/include")
|
38 | endif()
|
39 |
|
40 | if(MSVC)
|
41 | set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /NODEFAULTLIB:libcmt.lib")
|
42 | endif()
|
43 |
|
44 | file(GLOB grfmt_hdrs src/grfmt*.hpp)
|
45 | file(GLOB grfmt_srcs src/grfmt*.cpp)
|
46 | set(grfmt_hdrs src/bitstrm.hpp ${grfmt_hdrs})
|
47 | set(grfmt_srcs src/bitstrm.cpp ${grfmt_srcs})
|
48 |
|
49 | source_group("Src\\grfmts" FILES ${grfmt_hdrs} ${grfmt_srcs})
|
50 |
|
51 | set(highgui_srcs
|
52 | src/cap.cpp
|
53 | src/cap_images.cpp
|
54 | src/loadsave.cpp
|
55 | src/precomp.cpp
|
56 | src/utils.cpp
|
57 | src/window.cpp
|
58 | )
|
59 |
|
60 | set(highgui_hdrs src/precomp.hpp src/utils.hpp)
|
61 |
|
62 | #YV
|
63 | set(lib_hdr_names highgui_c.h highgui.hpp)
|
64 | set(highgui_ext_hdrs)
|
65 | foreach(h ${lib_hdr_names})
|
66 | list(APPEND highgui_ext_hdrs "${CMAKE_CURRENT_SOURCE_DIR}/include/opencv2/highgui/${h}")
|
67 | endforeach()
|
68 |
|
69 | #YV
|
70 | if(WIN32)
|
71 |
|
72 | if (HAVE_QT)
|
73 |
|
74 | #SET(QT_USE_QTXML 1)
|
75 | INCLUDE(${QT_USE_FILE})
|
76 |
|
77 | SET(_MOC_HEADERS src/window_QT.h )
|
78 | QT4_WRAP_CPP(_MOC_OUTFILES ${_MOC_HEADERS})
|
79 |
|
80 | set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} ${QT_LIBRARIES})
|
81 | set(highgui_srcs ${highgui_srcs} src/window_QT.cpp ${_MOC_OUTFILES})
|
82 |
|
83 | else()
|
84 | set(highgui_srcs ${highgui_srcs} src/window_w32.cpp)
|
85 | endif()
|
86 |
|
87 | set(highgui_srcs ${highgui_srcs} src/cap_vfw.cpp src/cap_cmu.cpp src/cap_w32.cpp src/cap_dshow.cpp)
|
88 | if(HAVE_MIL)
|
89 | set(highgui_srcs ${highgui_srcs} src/cap_mil.cpp)
|
90 | endif()
|
91 | endif()
|
92 |
|
93 | if(UNIX)
|
94 |
|
95 | if (HAVE_QT)
|
96 |
|
97 | #SET(QT_USE_QTXML 1)
|
98 | INCLUDE(${QT_USE_FILE})
|
99 |
|
100 | SET(_MOC_HEADERS src/window_QT.h)
|
101 | QT4_WRAP_CPP(_MOC_OUTFILES ${_MOC_HEADERS})
|
102 |
|
103 | set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} ${QT_LIBRARIES})
|
104 | set(highgui_srcs ${highgui_srcs} src/window_QT.cpp ${_MOC_OUTFILES})
|
105 |
|
106 | else()
|
107 | if(HAVE_GTK)
|
108 | set(highgui_srcs ${highgui_srcs} src/window_gtk.cpp)
|
109 | endif()
|
110 |
|
111 | endif()
|
112 |
|
113 | if(HAVE_XINE)
|
114 | set(highgui_srcs ${highgui_srcs} src/cap_xine.cpp)
|
115 | endif()
|
116 |
|
117 | if(HAVE_DC1394_2)
|
118 | set(highgui_srcs ${highgui_srcs} src/cap_dc1394_v2.cpp)
|
119 | endif()
|
120 |
|
121 | if(HAVE_DC1394)
|
122 | set(highgui_srcs ${highgui_srcs} src/cap_dc1394.cpp)
|
123 | endif()
|
124 |
|
125 | if(HAVE_FFMPEG)
|
126 | set(highgui_srcs ${highgui_srcs} src/cap_ffmpeg.cpp)
|
127 | if(BZIP2_LIBRARIES)
|
128 | set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} ${BZIP2_LIBRARIES})
|
129 | endif()
|
130 | endif()
|
131 |
|
132 | if(HAVE_PVAPI)
|
133 | add_definitions(-DHAVE_PVAPI)
|
134 | set(highgui_srcs src/cap_pvapi.cpp ${highgui_srcs})
|
135 | set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} PvAPI)
|
136 | endif()
|
137 |
|
138 | if(HAVE_GSTREAMER)
|
139 | set(highgui_srcs ${highgui_srcs} src/cap_gstreamer.cpp)
|
140 | if(NOT HAVE_GSTREAMER_APP)
|
141 | set(highgui_srcs ${highgui_srcs} src/gstappsink.cpp)
|
142 | set(highgui_hdrs ${highgui_hdrs} src/gstappsink.h)
|
143 | endif()
|
144 | endif()
|
145 |
|
146 | if(HAVE_UNICAP)
|
147 | set(highgui_srcs ${highgui_srcs} src/cap_unicap.cpp)
|
148 | endif()
|
149 |
|
150 | if(HAVE_LIBV4L)
|
151 | set(highgui_srcs ${highgui_srcs} src/cap_libv4l.cpp)
|
152 | else()
|
153 | if(HAVE_CAMV4L OR HAVE_CAMV4L2)
|
154 | set(highgui_srcs ${highgui_srcs} src/cap_v4l.cpp)
|
155 | endif()
|
156 | endif()
|
157 |
|
158 | if(JPEG_FOUND)
|
159 | include_directories(${JPEG_INCLUDE_DIR})
|
160 | endif()
|
161 | if(PNG_FOUND)
|
162 | add_definitions(${PNG_DEFINITIONS})
|
163 | include_directories(${PNG_INCLUDE_DIR})
|
164 | endif()
|
165 | if(TIFF_FOUND)
|
166 | include_directories(${TIFF_INCLUDE_DIR})
|
167 | endif()
|
168 | if(JASPER_FOUND)
|
169 | include_directories(${JASPER_INCLUDE_DIR})
|
170 | endif()
|
171 |
|
172 | foreach(P ${HIGHGUI_INCLUDE_DIRS})
|
173 | include_directories(${P})
|
174 | endforeach()
|
175 |
|
176 | foreach(P ${HIGHGUI_LIBRARY_DIRS})
|
177 | link_directories(${P})
|
178 | endforeach()
|
179 | endif()
|
180 |
|
181 | #YV
|
182 | if(APPLE)
|
183 | add_definitions(-DHAVE_QUICKTIME=1)
|
184 | if(NOT OPENCV_BUILD_3RDPARTY_LIBS)
|
185 | add_definitions(-DHAVE_IMAGEIO=1)
|
186 | endif()
|
187 |
|
188 | if (HAVE_QT)
|
189 |
|
190 | #SET(QT_USE_QTXML 1)
|
191 | INCLUDE(${QT_USE_FILE})
|
192 |
|
193 | SET(_MOC_HEADERS src/window_QT.h)
|
194 | QT4_WRAP_CPP(_MOC_OUTFILES ${_MOC_HEADERS})
|
195 |
|
196 | set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} ${QT_LIBRARIES})
|
197 | set(highgui_srcs ${highgui_srcs} src/window_QT.cpp ${_MOC_OUTFILES})
|
198 |
|
199 | else()
|
200 | if(WITH_CARBON)
|
201 | add_definitions(-DHAVE_CARBON=1)
|
202 | set(highgui_srcs ${highgui_srcs} src/window_carbon.cpp)
|
203 | else()
|
204 | add_definitions(-DHAVE_COCOA=1)
|
205 | set(highgui_srcs ${highgui_srcs} src/window_cocoa.mm)
|
206 | endif()
|
207 | endif()
|
208 |
|
209 | if(WITH_QUICKTIME)
|
210 | set(highgui_srcs ${highgui_srcs} src/cap_qt.cpp)
|
211 | else()
|
212 | set(highgui_srcs ${highgui_srcs} src/cap_qtkit.mm)
|
213 | endif()
|
214 | endif(APPLE)
|
215 |
|
216 | source_group("Src" FILES ${highgui_srcs} ${highgui_hdrs})
|
217 | source_group("Include" FILES ${highgui_ext_hdrs})
|
218 |
|
219 | if(OPENCV_BUILD_3RDPARTY_LIBS)
|
220 | if(WIN32)
|
221 | link_directories("${CMAKE_CURRENT_SOURCE_DIR}/../../3rdparty/lib")
|
222 | endif()
|
223 | link_directories(
|
224 | "${CMAKE_BINARY_DIR}/3rdparty/lib"
|
225 | "${CMAKE_BINARY_DIR}/3rdparty/lib/${ConfigurationName}"
|
226 | )
|
227 | endif()
|
228 |
|
229 | set(lib_srcs ${highgui_srcs} ${grfmt_srcs})
|
230 |
|
231 | # ----------------------------------------------------------------------------------
|
232 | # Define the library target:
|
233 | # ----------------------------------------------------------------------------------
|
234 | set(the_target "opencv_highgui")
|
235 |
|
236 | add_definitions(-DHIGHGUI_EXPORTS -DCVAPI_EXPORTS)
|
237 |
|
238 | include_directories("${CMAKE_CURRENT_SOURCE_DIR}/include"
|
239 | "${CMAKE_CURRENT_SOURCE_DIR}/../core/include"
|
240 | "${CMAKE_CURRENT_SOURCE_DIR}/../imgproc/include"
|
241 | "${CMAKE_CURRENT_SOURCE_DIR}/../video/include"
|
242 | "${CMAKE_CURRENT_SOURCE_DIR}/../features2d/include"
|
243 | "${CMAKE_CURRENT_SOURCE_DIR}/../calib3d/include"
|
244 | "${CMAKE_CURRENT_SOURCE_DIR}/../objdetect/include"
|
245 | "${CMAKE_CURRENT_SOURCE_DIR}/src"
|
246 | "${CMAKE_CURRENT_BINARY_DIR}")
|
247 |
|
248 | add_library(${the_target} ${lib_srcs} ${highgui_hdrs} ${grfmt_hdrs} ${highgui_ext_hdrs})
|
249 |
|
250 | if(PCHSupport_FOUND)
|
251 | set(pch_header ${CMAKE_CURRENT_SOURCE_DIR}/src/precomp.hpp)
|
252 | if(${CMAKE_GENERATOR} MATCHES "Visual*" OR ${CMAKE_GENERATOR} MATCHES "Xcode*")
|
253 | if(${CMAKE_GENERATOR} MATCHES "Visual*")
|
254 | set(${the_target}_pch "src/precomp.cpp")
|
255 | endif()
|
256 | add_native_precompiled_header(${the_target} ${pch_header})
|
257 | elseif(CMAKE_COMPILER_IS_GNUCXX AND ${CMAKE_GENERATOR} MATCHES ".*Makefiles")
|
258 | add_precompiled_header(${the_target} ${pch_header})
|
259 | endif()
|
260 | endif()
|
261 |
|
262 | # For dynamic link numbering convenions
|
263 | set_target_properties(${the_target} PROPERTIES
|
264 | VERSION ${OPENCV_VERSION}
|
265 | SOVERSION ${OPENCV_SOVERSION}
|
266 | OUTPUT_NAME "${the_target}${OPENCV_DLLVERSION}"
|
267 | )
|
268 |
|
269 | # Additional target properties
|
270 | set_target_properties(${the_target} PROPERTIES
|
271 | DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
|
272 | ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib/"
|
273 | RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/"
|
274 | LINK_INTERFACE_LIBRARIES ""
|
275 | )
|
276 |
|
277 | if(MSVC)
|
278 | set_target_properties(${the_target} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:atlthunk.lib")
|
279 | endif(MSVC)
|
280 |
|
281 | # Dependencies of this target:
|
282 | add_dependencies(${the_target} opencv_core opencv_imgproc)
|
283 |
|
284 | # Add the required libraries for linking:
|
285 | target_link_libraries(${the_target} ${OPENCV_LINKER_LIBS} opencv_core opencv_imgproc ${JPEG_LIBRARIES} ${PNG_LIBRARIES} ${TIFF_LIBRARIES} ${JASPER_LIBRARIES} ${HIGHGUI_LIBRARIES})
|
286 |
|
287 | if(WITH_JASPER AND NOT JASPER_FOUND)
|
288 | add_dependencies(${the_target} libjasper)
|
289 | target_link_libraries(${the_target} libjasper)
|
290 | endif()
|
291 |
|
292 | if(WITH_JPEG AND NOT JPEG_FOUND)
|
293 | add_dependencies(${the_target} libjpeg)
|
294 | target_link_libraries(${the_target} libjpeg)
|
295 | endif()
|
296 |
|
297 | if(WITH_PNG AND NOT PNG_FOUND)
|
298 | add_dependencies(${the_target} libpng zlib)
|
299 | target_link_libraries(${the_target} libpng zlib)
|
300 | endif()
|
301 |
|
302 | if(WITH_TIFF AND NOT TIFF_FOUND)
|
303 | add_dependencies(${the_target} libtiff)
|
304 | target_link_libraries(${the_target} libtiff)
|
305 | endif()
|
306 |
|
307 | #if(OPENCV_BUILD_3RDPARTY_LIBS)
|
308 | # add_dependencies(${the_target} libjasper libjpeg libpng libtiff zlib)
|
309 | # target_link_libraries(${the_target} libjasper libjpeg libpng libtiff zlib)
|
310 | #endif()
|
311 | if(WIN32)
|
312 | target_link_libraries(${the_target} comctl32 gdi32 ole32)
|
313 |
|
314 | if (MSVC)
|
315 | target_link_libraries(${the_target} vfw32)
|
316 | endif()
|
317 |
|
318 | if(MINGW)
|
319 | if(MINGW64)
|
320 | target_link_libraries(${the_target} msvfw32 avifil32 avicap32 winmm videoInput64 strmiids)
|
321 | else()
|
322 | target_link_libraries(${the_target} vfw32 winmm videoInput strmiids)
|
323 | endif()
|
324 | endif()
|
325 | endif()
|
326 |
|
327 | if(APPLE)
|
328 | target_link_libraries(${the_target} "-lbz2 -framework Cocoa -framework QuartzCore")
|
329 | if(WITH_CARBON)
|
330 | target_link_libraries(${the_target} "-framework Carbon")
|
331 | endif()
|
332 | if(NOT WITH_QUICKTIME)
|
333 | target_link_libraries(${the_target} "-framework QTKit")
|
334 | endif()
|
335 | if(WITH_CARBON OR WITH_QUICKTIME)
|
336 | target_link_libraries(${the_target} "-framework QuickTime -framework CoreFoundation")
|
337 | endif()
|
338 | endif()
|
339 |
|
340 | install(TARGETS ${the_target}
|
341 | RUNTIME DESTINATION bin COMPONENT main
|
342 | LIBRARY DESTINATION lib COMPONENT main
|
343 | ARCHIVE DESTINATION lib COMPONENT main)
|
344 |
|
345 | install(FILES ${highgui_ext_hdrs}
|
346 | DESTINATION include/opencv2/highgui
|
347 | COMPONENT main)
|