2012-02-03 19:26:49 +08:00
|
|
|
set(the_description "High-level GUI and Media I/O")
|
|
|
|
ocv_add_module(highgui opencv_imgproc OPTIONAL opencv_androidcamera)
|
|
|
|
|
2010-05-12 01:44:00 +08:00
|
|
|
# ----------------------------------------------------------------------------
|
|
|
|
# CMake file for highgui. See root CMakeLists.txt
|
|
|
|
# Some parts taken from version of Hartmut Seichter, HIT Lab NZ.
|
|
|
|
# Jose Luis Blanco, 2008
|
|
|
|
# ----------------------------------------------------------------------------
|
2012-01-25 00:55:47 +08:00
|
|
|
|
2012-02-03 19:26:49 +08:00
|
|
|
set(GRFMT_LIBS "")
|
2011-04-26 23:46:15 +08:00
|
|
|
|
|
|
|
if(WITH_PNG OR WITH_TIFF OR WITH_OPENEXR)
|
2012-03-03 23:49:23 +08:00
|
|
|
ocv_include_directories(${ZLIB_INCLUDE_DIR})
|
2012-02-24 21:53:22 +08:00
|
|
|
set(GRFMT_LIBS ${GRFMT_LIBS} ${ZLIB_LIBRARIES})
|
2011-04-26 23:46:15 +08:00
|
|
|
endif()
|
|
|
|
|
2010-05-12 01:44:00 +08:00
|
|
|
if(WITH_JPEG)
|
2012-02-24 21:53:22 +08:00
|
|
|
add_definitions(-DHAVE_JPEG)
|
2012-03-03 23:49:23 +08:00
|
|
|
ocv_include_directories(${JPEG_INCLUDE_DIR})
|
2012-02-24 21:53:22 +08:00
|
|
|
set(GRFMT_LIBS ${GRFMT_LIBS} ${JPEG_LIBRARIES})
|
2010-05-12 01:44:00 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(WITH_PNG)
|
2012-02-24 21:53:22 +08:00
|
|
|
add_definitions(-DHAVE_PNG)
|
|
|
|
add_definitions(${PNG_DEFINITIONS})
|
2012-03-03 23:49:23 +08:00
|
|
|
ocv_include_directories(${PNG_INCLUDE_DIR})
|
2012-02-24 21:53:22 +08:00
|
|
|
set(GRFMT_LIBS ${GRFMT_LIBS} ${PNG_LIBRARIES})
|
2010-05-12 01:44:00 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(WITH_TIFF)
|
2012-02-24 21:53:22 +08:00
|
|
|
add_definitions(-DHAVE_TIFF)
|
2012-03-03 23:49:23 +08:00
|
|
|
ocv_include_directories(${TIFF_INCLUDE_DIR})
|
2012-02-24 21:53:22 +08:00
|
|
|
set(GRFMT_LIBS ${GRFMT_LIBS} ${TIFF_LIBRARIES})
|
2010-05-12 01:44:00 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(WITH_JASPER)
|
2012-02-24 21:53:22 +08:00
|
|
|
add_definitions(-DHAVE_JASPER)
|
2012-03-03 23:49:23 +08:00
|
|
|
ocv_include_directories(${JASPER_INCLUDE_DIR})
|
2012-02-24 21:53:22 +08:00
|
|
|
set(GRFMT_LIBS ${GRFMT_LIBS} ${JASPER_LIBRARIES})
|
2010-05-12 01:44:00 +08:00
|
|
|
endif()
|
|
|
|
|
2010-07-04 20:32:31 +08:00
|
|
|
if(WITH_OPENEXR AND OPENEXR_FOUND)
|
2012-02-24 21:53:22 +08:00
|
|
|
add_definitions(-DHAVE_OPENEXR)
|
2012-03-03 23:49:23 +08:00
|
|
|
ocv_include_directories(${OPENEXR_INCLUDE_PATHS})
|
2012-02-24 21:53:22 +08:00
|
|
|
set(GRFMT_LIBS ${GRFMT_LIBS} ${OPENEXR_LIBRARIES})
|
2010-05-12 01:44:00 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
file(GLOB grfmt_hdrs src/grfmt*.hpp)
|
|
|
|
file(GLOB grfmt_srcs src/grfmt*.cpp)
|
|
|
|
set(grfmt_hdrs src/bitstrm.hpp ${grfmt_hdrs})
|
|
|
|
set(grfmt_srcs src/bitstrm.cpp ${grfmt_srcs})
|
|
|
|
|
|
|
|
source_group("Src\\grfmts" FILES ${grfmt_hdrs} ${grfmt_srcs})
|
|
|
|
|
2012-02-03 19:26:49 +08:00
|
|
|
set(highgui_hdrs src/precomp.hpp src/utils.hpp)
|
2012-03-13 01:07:54 +08:00
|
|
|
|
|
|
|
if(NEW_FFMPEG)
|
|
|
|
set(highgui_srcs
|
|
|
|
src/cap.cpp
|
|
|
|
src/cap_images.cpp
|
|
|
|
src/cap_ffmpeg_v2.cpp
|
2012-04-06 02:26:49 +08:00
|
|
|
src/cap_ffmpeg_impl_v2.hpp
|
|
|
|
src/cap_ffmpeg_impl.hpp
|
2012-03-13 01:07:54 +08:00
|
|
|
src/loadsave.cpp
|
|
|
|
src/precomp.cpp
|
|
|
|
src/utils.cpp
|
|
|
|
src/window.cpp
|
|
|
|
)
|
|
|
|
else()
|
2010-05-12 01:44:00 +08:00
|
|
|
set(highgui_srcs
|
|
|
|
src/cap.cpp
|
|
|
|
src/cap_images.cpp
|
2011-07-05 00:18:12 +08:00
|
|
|
src/cap_ffmpeg.cpp
|
2012-04-06 02:26:49 +08:00
|
|
|
src/cap_ffmpeg_impl_v2.hpp
|
|
|
|
src/cap_ffmpeg_impl.hpp
|
2010-05-12 01:44:00 +08:00
|
|
|
src/loadsave.cpp
|
|
|
|
src/precomp.cpp
|
|
|
|
src/utils.cpp
|
|
|
|
src/window.cpp
|
|
|
|
)
|
2012-03-13 01:07:54 +08:00
|
|
|
endif()
|
|
|
|
|
2012-02-03 19:26:49 +08:00
|
|
|
file(GLOB highgui_ext_hdrs "include/opencv2/${name}/*.hpp" "include/opencv2/${name}/*.h")
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-06-07 16:29:10 +08:00
|
|
|
#YV
|
2010-07-12 23:29:31 +08:00
|
|
|
if (HAVE_QT)
|
|
|
|
if (HAVE_QT_OPENGL)
|
|
|
|
set(QT_USE_QTOPENGL TRUE)
|
|
|
|
endif()
|
|
|
|
INCLUDE(${QT_USE_FILE})
|
2010-07-16 17:12:15 +08:00
|
|
|
|
|
|
|
SET(_RCCS_FILES src/window_QT.qrc)
|
2011-05-27 21:47:18 +08:00
|
|
|
QT4_ADD_RESOURCES(_RCC_OUTFILES ${_RCCS_FILES})
|
2010-07-16 17:12:15 +08:00
|
|
|
|
2010-07-12 23:29:31 +08:00
|
|
|
SET(_MOC_HEADERS src/window_QT.h )
|
|
|
|
QT4_WRAP_CPP(_MOC_OUTFILES ${_MOC_HEADERS})
|
|
|
|
|
2011-06-17 17:26:53 +08:00
|
|
|
set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} ${QT_LIBRARIES} ${QT_QTTEST_LIBRARY})
|
2010-07-16 17:12:15 +08:00
|
|
|
set(highgui_srcs ${highgui_srcs} src/window_QT.cpp ${_MOC_OUTFILES} ${_RCC_OUTFILES} )
|
2010-07-12 23:29:31 +08:00
|
|
|
endif()
|
|
|
|
|
2010-05-12 01:44:00 +08:00
|
|
|
if(WIN32)
|
2010-07-12 23:29:31 +08:00
|
|
|
if(NOT HAVE_QT)
|
2010-06-07 16:29:10 +08:00
|
|
|
set(highgui_srcs ${highgui_srcs} src/window_w32.cpp)
|
|
|
|
endif()
|
2011-07-05 00:18:12 +08:00
|
|
|
set(highgui_srcs ${highgui_srcs} src/cap_vfw.cpp src/cap_cmu.cpp src/cap_dshow.cpp)
|
2010-05-12 01:44:00 +08:00
|
|
|
if(HAVE_MIL)
|
|
|
|
set(highgui_srcs ${highgui_srcs} src/cap_mil.cpp)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2011-09-06 23:30:28 +08:00
|
|
|
if(UNIX)
|
2010-07-12 23:29:31 +08:00
|
|
|
if(NOT HAVE_QT)
|
2011-05-27 21:47:18 +08:00
|
|
|
if(HAVE_GTK)
|
2010-06-07 16:29:10 +08:00
|
|
|
set(highgui_srcs ${highgui_srcs} src/window_gtk.cpp)
|
2011-05-27 21:47:18 +08:00
|
|
|
endif()
|
2010-05-12 01:44:00 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(HAVE_XINE)
|
|
|
|
set(highgui_srcs ${highgui_srcs} src/cap_xine.cpp)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(HAVE_DC1394_2)
|
|
|
|
set(highgui_srcs ${highgui_srcs} src/cap_dc1394_v2.cpp)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(HAVE_DC1394)
|
|
|
|
set(highgui_srcs ${highgui_srcs} src/cap_dc1394.cpp)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(HAVE_FFMPEG)
|
|
|
|
if(BZIP2_LIBRARIES)
|
|
|
|
set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} ${BZIP2_LIBRARIES})
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(HAVE_PVAPI)
|
|
|
|
add_definitions(-DHAVE_PVAPI)
|
|
|
|
set(highgui_srcs src/cap_pvapi.cpp ${highgui_srcs})
|
|
|
|
set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} PvAPI)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(HAVE_GSTREAMER)
|
|
|
|
set(highgui_srcs ${highgui_srcs} src/cap_gstreamer.cpp)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(HAVE_UNICAP)
|
|
|
|
set(highgui_srcs ${highgui_srcs} src/cap_unicap.cpp)
|
|
|
|
endif()
|
|
|
|
|
2011-05-27 21:47:18 +08:00
|
|
|
if(HAVE_LIBV4L)
|
|
|
|
set(highgui_srcs ${highgui_srcs} src/cap_libv4l.cpp)
|
|
|
|
else()
|
|
|
|
if(HAVE_CAMV4L OR HAVE_CAMV4L2)
|
|
|
|
set(highgui_srcs ${highgui_srcs} src/cap_v4l.cpp)
|
|
|
|
endif()
|
|
|
|
endif()
|
2010-05-12 01:44:00 +08:00
|
|
|
|
|
|
|
foreach(P ${HIGHGUI_INCLUDE_DIRS})
|
2012-03-03 23:49:23 +08:00
|
|
|
ocv_include_directories(${P})
|
2010-05-12 01:44:00 +08:00
|
|
|
endforeach()
|
|
|
|
|
|
|
|
foreach(P ${HIGHGUI_LIBRARY_DIRS})
|
|
|
|
link_directories(${P})
|
|
|
|
endforeach()
|
|
|
|
endif()
|
|
|
|
|
2011-01-22 01:00:08 +08:00
|
|
|
#OpenNI
|
|
|
|
if(WITH_OPENNI AND HAVE_OPENNI)
|
|
|
|
set(highgui_srcs ${highgui_srcs} src/cap_openni.cpp)
|
2012-03-03 23:49:23 +08:00
|
|
|
ocv_include_directories(${OPENNI_INCLUDE_DIR})
|
2011-01-22 01:00:08 +08:00
|
|
|
endif()
|
|
|
|
|
2010-06-07 16:29:10 +08:00
|
|
|
#YV
|
2011-08-24 18:53:57 +08:00
|
|
|
if(APPLE)
|
|
|
|
if (NOT IOS)
|
2011-09-06 23:30:28 +08:00
|
|
|
add_definitions(-DHAVE_QUICKTIME=1)
|
2011-08-24 18:53:57 +08:00
|
|
|
endif()
|
|
|
|
|
2010-05-12 01:44:00 +08:00
|
|
|
if(NOT OPENCV_BUILD_3RDPARTY_LIBS)
|
|
|
|
add_definitions(-DHAVE_IMAGEIO=1)
|
|
|
|
endif()
|
2010-06-07 16:29:10 +08:00
|
|
|
|
2010-07-12 23:29:31 +08:00
|
|
|
if (NOT HAVE_QT)
|
2010-06-07 16:29:10 +08:00
|
|
|
if(WITH_CARBON)
|
|
|
|
add_definitions(-DHAVE_CARBON=1)
|
|
|
|
set(highgui_srcs ${highgui_srcs} src/window_carbon.cpp)
|
|
|
|
else()
|
|
|
|
add_definitions(-DHAVE_COCOA=1)
|
|
|
|
set(highgui_srcs ${highgui_srcs} src/window_cocoa.mm)
|
|
|
|
endif()
|
2010-05-12 01:44:00 +08:00
|
|
|
endif()
|
2010-06-07 16:29:10 +08:00
|
|
|
|
2011-05-27 21:47:18 +08:00
|
|
|
if(WITH_QUICKTIME)
|
2011-09-06 23:30:28 +08:00
|
|
|
set(highgui_srcs ${highgui_srcs} src/cap_qt.cpp)
|
|
|
|
else()
|
2011-08-24 18:53:57 +08:00
|
|
|
if (WITH_AVFOUNDATION)
|
|
|
|
add_definitions(-DHAVE_AVFOUNDATION=1)
|
|
|
|
set(highgui_srcs ${highgui_srcs} src/cap_avfoundation.mm)
|
|
|
|
else()
|
2011-09-06 23:30:28 +08:00
|
|
|
set(highgui_srcs ${highgui_srcs} src/cap_qtkit.mm)
|
|
|
|
endif()
|
|
|
|
endif()
|
2012-04-06 02:26:49 +08:00
|
|
|
|
|
|
|
if(HAVE_FFMPEG)
|
|
|
|
set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} "-framework VideoDecodeAcceleration")
|
|
|
|
endif()
|
2011-08-24 18:53:57 +08:00
|
|
|
endif(APPLE)
|
2011-08-23 19:19:58 +08:00
|
|
|
|
2012-02-10 04:22:36 +08:00
|
|
|
if(HAVE_opencv_androidcamera)
|
2011-04-06 22:31:03 +08:00
|
|
|
set(highgui_srcs ${highgui_srcs} src/cap_android.cpp)
|
2012-02-03 19:26:49 +08:00
|
|
|
add_definitions(-DHAVE_ANDROID_NATIVE_CAMERA)#TODO: remove this line
|
2011-04-06 22:31:03 +08:00
|
|
|
endif()
|
|
|
|
|
2011-08-12 02:06:09 +08:00
|
|
|
if(HAVE_XIMEA AND XIMEA_FOUND)
|
2012-02-06 21:29:48 +08:00
|
|
|
set(highgui_srcs ${highgui_srcs} src/cap_ximea.cpp)
|
2012-03-03 23:49:23 +08:00
|
|
|
ocv_include_directories(${XIMEA_PATH})
|
2012-02-06 21:29:48 +08:00
|
|
|
link_directories(${XIMEA_LIBRARY_DIR})
|
|
|
|
set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} m3api)
|
|
|
|
set(highgui_srcs ${highgui_srcs} src/cap_ximea.cpp)
|
2011-08-12 02:06:09 +08:00
|
|
|
endif()
|
|
|
|
|
2012-01-25 17:04:49 +08:00
|
|
|
if(OPENNI_LIBRARY)
|
2012-02-06 21:29:48 +08:00
|
|
|
set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} ${OPENNI_LIBRARY})
|
2012-01-25 17:04:49 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(APPLE AND NOT IOS)
|
2012-02-06 21:29:48 +08:00
|
|
|
set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} bz2 "-framework Cocoa" "-framework QuartzCore")
|
|
|
|
if(WITH_CARBON)
|
|
|
|
set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} "-framework Carbon")
|
|
|
|
endif()
|
|
|
|
if(NOT WITH_QUICKTIME)
|
|
|
|
set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} "-framework QTKit")
|
|
|
|
endif()
|
|
|
|
if(WITH_CARBON OR WITH_QUICKTIME)
|
|
|
|
set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} "-framework QuickTime" "-framework CoreFoundation")
|
|
|
|
endif()
|
2012-01-25 17:04:49 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(IOS)
|
2012-02-06 21:29:48 +08:00
|
|
|
set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} bz2 "-framework QuartzCore" "-framework CoreFoundation" "-framework ImageIO" "-framework CoreGraphics" "-framework AVFoundation")
|
|
|
|
endif()
|
|
|
|
|
2012-02-17 04:29:35 +08:00
|
|
|
if(WIN32)
|
2012-02-06 21:29:48 +08:00
|
|
|
link_directories("${CMAKE_CURRENT_SOURCE_DIR}/../../3rdparty/lib")
|
2012-03-03 23:49:23 +08:00
|
|
|
include_directories(AFTER "${CMAKE_CURRENT_SOURCE_DIR}/../../3rdparty/include") #for directshow
|
2012-01-25 17:04:49 +08:00
|
|
|
endif()
|
|
|
|
|
2010-05-12 01:44:00 +08:00
|
|
|
source_group("Src" FILES ${highgui_srcs} ${highgui_hdrs})
|
|
|
|
source_group("Include" FILES ${highgui_ext_hdrs})
|
2012-02-03 19:26:49 +08:00
|
|
|
ocv_set_module_sources(HEADERS ${highgui_ext_hdrs} SOURCES ${highgui_srcs} ${highgui_hdrs} ${grfmt_srcs} ${grfmt_hdrs})
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2012-02-03 19:26:49 +08:00
|
|
|
ocv_module_include_directories()
|
2011-04-27 00:10:26 +08:00
|
|
|
|
2012-02-03 19:26:49 +08:00
|
|
|
ocv_create_module(${GRFMT_LIBS} ${HIGHGUI_LIBRARIES})
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2012-01-25 17:04:49 +08:00
|
|
|
if(BUILD_SHARED_LIBS)
|
2012-02-06 21:29:48 +08:00
|
|
|
add_definitions(-DHIGHGUI_EXPORTS)
|
2011-06-03 20:01:55 +08:00
|
|
|
endif()
|
|
|
|
|
2010-05-12 01:44:00 +08:00
|
|
|
if(MSVC)
|
2012-02-06 21:29:48 +08:00
|
|
|
set_target_properties(${the_module} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:atlthunk.lib /NODEFAULTLIB:atlsd.lib /NODEFAULTLIB:libcmt.lib /DEBUG")
|
2011-06-17 02:00:41 +08:00
|
|
|
endif()
|
|
|
|
|
2012-02-05 02:57:41 +08:00
|
|
|
#stop automatic dependencies propagation for this module
|
|
|
|
set_target_properties(${the_module} PROPERTIES LINK_INTERFACE_LIBRARIES "")
|
|
|
|
|
2012-02-03 19:26:49 +08:00
|
|
|
ocv_add_precompiled_headers(${the_module})
|
|
|
|
|
2012-04-09 05:49:19 +08:00
|
|
|
if(CMAKE_COMPILER_IS_GNUCXX AND NOT ENABLE_NOISY_WARNINGS)
|
2012-03-19 19:21:01 +08:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations")
|
|
|
|
endif()
|
|
|
|
|
2012-03-03 23:49:23 +08:00
|
|
|
if(WIN32)
|
|
|
|
#copy ffmpeg dll to the output folder
|
|
|
|
if(MSVC64 OR MINGW64)
|
|
|
|
set(FFMPEG_SUFFIX _64)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(ffmpeg_bare_name "opencv_ffmpeg${FFMPEG_SUFFIX}.dll")
|
|
|
|
set(ffmpeg_path "${OpenCV_SOURCE_DIR}/3rdparty/ffmpeg/${ffmpeg_bare_name}")
|
|
|
|
|
|
|
|
if(CMAKE_VERSION VERSION_GREATER "2.8.2")
|
|
|
|
add_custom_command(TARGET ${the_module} POST_BUILD
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy "${ffmpeg_path}" "${EXECUTABLE_OUTPUT_PATH}/$<CONFIGURATION>/${ffmpeg_bare_name}"
|
|
|
|
COMMENT "Copying ${ffmpeg_path} to the output directory")
|
|
|
|
elseif(MSVC_IDE)
|
|
|
|
add_custom_command(TARGET ${the_module} POST_BUILD
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy "${ffmpeg_path}" "${EXECUTABLE_OUTPUT_PATH}/Release/${ffmpeg_bare_name}"
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy "${ffmpeg_path}" "${EXECUTABLE_OUTPUT_PATH}/Debug/${ffmpeg_bare_name}"
|
|
|
|
COMMENT "Copying ${ffmpeg_path} to the output directory")
|
|
|
|
elseif(MSVC)
|
|
|
|
add_custom_command(TARGET ${the_module} POST_BUILD
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy "${ffmpeg_path}" "${EXECUTABLE_OUTPUT_PATH}/${CMAKE_BUILD_TYPE}/${ffmpeg_bare_name}"
|
|
|
|
COMMENT "Copying ${ffmpeg_path} to the output directory")
|
|
|
|
else()
|
|
|
|
add_custom_command(TARGET ${the_module} POST_BUILD
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy "${ffmpeg_path}" "${EXECUTABLE_OUTPUT_PATH}/${ffmpeg_bare_name}"
|
|
|
|
COMMENT "Copying ${ffmpeg_path} to the output directory")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
install(FILES "${ffmpeg_path}" DESTINATION bin COMPONENT main)
|
|
|
|
endif()
|
|
|
|
|
2012-02-17 04:29:35 +08:00
|
|
|
ocv_add_accuracy_tests()
|
2012-02-03 19:26:49 +08:00
|
|
|
ocv_add_perf_tests()
|