2012-02-03 12:26:49 +01:00
|
|
|
set(the_description "High-level GUI and Media I/O")
|
|
|
|
ocv_add_module(highgui opencv_imgproc OPTIONAL opencv_androidcamera)
|
|
|
|
|
2010-05-11 19:44:00 +02: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-24 17:55:47 +01:00
|
|
|
|
2012-05-30 10:04:37 +02:00
|
|
|
ocv_clear_vars(GRFMT_LIBS)
|
2011-04-26 17:46:15 +02:00
|
|
|
|
|
|
|
if(WITH_PNG OR WITH_TIFF OR WITH_OPENEXR)
|
2012-03-03 16:49:23 +01:00
|
|
|
ocv_include_directories(${ZLIB_INCLUDE_DIR})
|
2012-05-30 10:04:37 +02:00
|
|
|
list(APPEND GRFMT_LIBS ${ZLIB_LIBRARIES})
|
2011-04-26 17:46:15 +02:00
|
|
|
endif()
|
|
|
|
|
2010-05-11 19:44:00 +02:00
|
|
|
if(WITH_JPEG)
|
2012-02-24 14:53:22 +01:00
|
|
|
add_definitions(-DHAVE_JPEG)
|
2012-03-03 16:49:23 +01:00
|
|
|
ocv_include_directories(${JPEG_INCLUDE_DIR})
|
2012-05-30 10:04:37 +02:00
|
|
|
list(APPEND GRFMT_LIBS ${JPEG_LIBRARIES})
|
2010-05-11 19:44:00 +02:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(WITH_PNG)
|
2012-02-24 14:53:22 +01:00
|
|
|
add_definitions(-DHAVE_PNG)
|
|
|
|
add_definitions(${PNG_DEFINITIONS})
|
2012-03-03 16:49:23 +01:00
|
|
|
ocv_include_directories(${PNG_INCLUDE_DIR})
|
2012-05-30 10:04:37 +02:00
|
|
|
list(APPEND GRFMT_LIBS ${PNG_LIBRARIES})
|
2010-05-11 19:44:00 +02:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(WITH_TIFF)
|
2012-02-24 14:53:22 +01:00
|
|
|
add_definitions(-DHAVE_TIFF)
|
2012-03-03 16:49:23 +01:00
|
|
|
ocv_include_directories(${TIFF_INCLUDE_DIR})
|
2012-05-30 10:04:37 +02:00
|
|
|
list(APPEND GRFMT_LIBS ${TIFF_LIBRARIES})
|
2010-05-11 19:44:00 +02:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(WITH_JASPER)
|
2012-02-24 14:53:22 +01:00
|
|
|
add_definitions(-DHAVE_JASPER)
|
2012-03-03 16:49:23 +01:00
|
|
|
ocv_include_directories(${JASPER_INCLUDE_DIR})
|
2012-05-30 10:04:37 +02:00
|
|
|
list(APPEND GRFMT_LIBS ${JASPER_LIBRARIES})
|
2010-05-11 19:44:00 +02:00
|
|
|
endif()
|
|
|
|
|
2010-07-04 14:32:31 +02:00
|
|
|
if(WITH_OPENEXR AND OPENEXR_FOUND)
|
2012-02-24 14:53:22 +01:00
|
|
|
add_definitions(-DHAVE_OPENEXR)
|
2012-03-03 16:49:23 +01:00
|
|
|
ocv_include_directories(${OPENEXR_INCLUDE_PATHS})
|
2012-05-30 10:04:37 +02:00
|
|
|
list(APPEND GRFMT_LIBS ${OPENEXR_LIBRARIES})
|
2010-05-11 19:44:00 +02:00
|
|
|
endif()
|
|
|
|
|
|
|
|
file(GLOB grfmt_hdrs src/grfmt*.hpp)
|
|
|
|
file(GLOB grfmt_srcs src/grfmt*.cpp)
|
2012-05-30 10:04:37 +02:00
|
|
|
list(APPEND grfmt_hdrs src/bitstrm.hpp)
|
|
|
|
list(APPEND grfmt_srcs src/bitstrm.cpp)
|
2010-05-11 19:44:00 +02:00
|
|
|
|
|
|
|
source_group("Src\\grfmts" FILES ${grfmt_hdrs} ${grfmt_srcs})
|
|
|
|
|
2012-05-30 10:04:37 +02:00
|
|
|
set(highgui_hdrs
|
|
|
|
src/precomp.hpp
|
|
|
|
src/utils.hpp
|
|
|
|
src/cap_ffmpeg_impl.hpp
|
|
|
|
)
|
2012-04-09 19:38:46 +02:00
|
|
|
|
2010-05-11 19:44:00 +02:00
|
|
|
set(highgui_srcs
|
|
|
|
src/cap.cpp
|
|
|
|
src/cap_images.cpp
|
2011-07-04 18:18:12 +02:00
|
|
|
src/cap_ffmpeg.cpp
|
2010-05-11 19:44:00 +02:00
|
|
|
src/loadsave.cpp
|
|
|
|
src/precomp.cpp
|
|
|
|
src/utils.cpp
|
|
|
|
src/window.cpp
|
|
|
|
)
|
2012-03-12 18:07:54 +01:00
|
|
|
|
2012-02-03 12:26:49 +01:00
|
|
|
file(GLOB highgui_ext_hdrs "include/opencv2/${name}/*.hpp" "include/opencv2/${name}/*.h")
|
2010-05-11 19:44:00 +02:00
|
|
|
|
2012-05-30 10:04:37 +02:00
|
|
|
if(HAVE_QT)
|
2012-04-11 14:05:53 +02:00
|
|
|
if (HAVE_QT_OPENGL)
|
|
|
|
set(QT_USE_QTOPENGL TRUE)
|
|
|
|
endif()
|
2012-05-30 10:04:37 +02:00
|
|
|
include(${QT_USE_FILE})
|
2012-04-11 14:05:53 +02:00
|
|
|
|
2012-05-30 10:04:37 +02:00
|
|
|
QT4_ADD_RESOURCES(_RCC_OUTFILES src/window_QT.qrc)
|
|
|
|
QT4_WRAP_CPP(_MOC_OUTFILES src/window_QT.h)
|
2012-04-11 14:05:53 +02:00
|
|
|
|
2012-05-30 10:04:37 +02:00
|
|
|
list(APPEND HIGHGUI_LIBRARIES ${QT_LIBRARIES} ${QT_QTTEST_LIBRARY})
|
|
|
|
list(APPEND highgui_srcs src/window_QT.cpp ${_MOC_OUTFILES} ${_RCC_OUTFILES} )
|
|
|
|
elseif(WIN32)
|
|
|
|
list(APPEND highgui_srcs src/window_w32.cpp)
|
|
|
|
elseif(HAVE_GTK)
|
|
|
|
list(APPEND highgui_srcs src/window_gtk.cpp)
|
|
|
|
elseif(APPLE)
|
|
|
|
if(WITH_CARBON)
|
|
|
|
add_definitions(-DHAVE_CARBON=1)
|
|
|
|
list(APPEND highgui_srcs src/window_carbon.cpp)
|
|
|
|
list(APPEND HIGHGUI_LIBRARIES "-framework Carbon" "-framework QuickTime")
|
|
|
|
elseif(NOT IOS)
|
|
|
|
add_definitions(-DHAVE_COCOA=1)
|
|
|
|
list(APPEND highgui_srcs src/window_cocoa.mm)
|
|
|
|
list(APPEND HIGHGUI_LIBRARIES "-framework Cocoa")
|
|
|
|
endif()
|
2010-07-12 17:29:31 +02:00
|
|
|
endif()
|
|
|
|
|
2010-05-11 19:44:00 +02:00
|
|
|
if(WIN32)
|
2012-05-30 10:04:37 +02:00
|
|
|
list(APPEND highgui_srcs src/cap_vfw.cpp src/cap_cmu.cpp src/cap_dshow.cpp)
|
|
|
|
endif(WIN32)
|
2010-05-11 19:44:00 +02:00
|
|
|
|
2012-05-30 10:04:37 +02:00
|
|
|
if(HAVE_XINE)
|
|
|
|
list(APPEND highgui_srcs src/cap_xine.cpp)
|
|
|
|
endif(HAVE_XINE)
|
2010-05-11 19:44:00 +02:00
|
|
|
|
2012-05-30 10:04:37 +02:00
|
|
|
if(HAVE_DC1394_2)
|
|
|
|
list(APPEND highgui_srcs src/cap_dc1394_v2.cpp)
|
|
|
|
endif(HAVE_DC1394_2)
|
2010-05-11 19:44:00 +02:00
|
|
|
|
2012-05-30 10:04:37 +02:00
|
|
|
if(HAVE_DC1394)
|
|
|
|
list(APPEND highgui_srcs src/cap_dc1394.cpp)
|
|
|
|
endif(HAVE_DC1394)
|
2010-05-11 19:44:00 +02:00
|
|
|
|
2012-05-30 10:04:37 +02:00
|
|
|
if(HAVE_GSTREAMER)
|
|
|
|
list(APPEND highgui_srcs src/cap_gstreamer.cpp)
|
|
|
|
endif(HAVE_GSTREAMER)
|
2010-05-11 19:44:00 +02:00
|
|
|
|
2012-05-30 10:04:37 +02:00
|
|
|
if(HAVE_UNICAP)
|
|
|
|
list(APPEND highgui_srcs src/cap_unicap.cpp)
|
|
|
|
endif(HAVE_UNICAP)
|
2010-05-11 19:44:00 +02:00
|
|
|
|
2012-05-30 10:04:37 +02:00
|
|
|
if(HAVE_LIBV4L)
|
|
|
|
list(APPEND highgui_srcs src/cap_libv4l.cpp)
|
|
|
|
elseif(HAVE_CAMV4L OR HAVE_CAMV4L2)
|
|
|
|
list(APPEND highgui_srcs src/cap_v4l.cpp)
|
2010-05-11 19:44:00 +02:00
|
|
|
endif()
|
|
|
|
|
2012-05-30 10:04:37 +02:00
|
|
|
if(HAVE_OPENNI)
|
|
|
|
list(APPEND highgui_srcs src/cap_openni.cpp)
|
2012-04-11 14:05:53 +02:00
|
|
|
ocv_include_directories(${OPENNI_INCLUDE_DIR})
|
2012-05-30 10:04:37 +02:00
|
|
|
list(APPEND HIGHGUI_LIBRARIES ${OPENNI_LIBRARY})
|
|
|
|
endif(HAVE_OPENNI)
|
2011-08-23 13:19:58 +02:00
|
|
|
|
2012-02-09 21:22:36 +01:00
|
|
|
if(HAVE_opencv_androidcamera)
|
2012-05-30 10:04:37 +02:00
|
|
|
list(APPEND highgui_srcs src/cap_android.cpp)
|
2012-02-03 12:26:49 +01:00
|
|
|
add_definitions(-DHAVE_ANDROID_NATIVE_CAMERA)#TODO: remove this line
|
2012-05-30 10:04:37 +02:00
|
|
|
endif(HAVE_opencv_androidcamera)
|
2011-04-06 16:31:03 +02:00
|
|
|
|
2012-05-30 10:04:37 +02:00
|
|
|
if(HAVE_XIMEA)
|
|
|
|
list(APPEND highgui_srcs src/cap_ximea.cpp)
|
2012-03-03 16:49:23 +01:00
|
|
|
ocv_include_directories(${XIMEA_PATH})
|
2012-02-06 14:29:48 +01:00
|
|
|
link_directories(${XIMEA_LIBRARY_DIR})
|
2012-05-30 10:04:37 +02:00
|
|
|
list(APPEND HIGHGUI_LIBRARIES m3api)
|
|
|
|
endif(HAVE_XIMEA)
|
|
|
|
|
|
|
|
if(HAVE_FFMPEG)
|
|
|
|
if(UNIX AND BZIP2_LIBRARIES)
|
|
|
|
list(APPEND HIGHGUI_LIBRARIES ${BZIP2_LIBRARIES})
|
|
|
|
endif()
|
|
|
|
if(APPLE)
|
|
|
|
list(APPEND HIGHGUI_LIBRARIES "-framework VideoDecodeAcceleration")
|
|
|
|
endif()
|
|
|
|
endif(HAVE_FFMPEG)
|
|
|
|
|
|
|
|
if(HAVE_PVAPI)
|
|
|
|
add_definitions(-DHAVE_PVAPI)
|
|
|
|
ocv_include_directories(${PVAPI_INCLUDE_PATH})
|
|
|
|
if(X86)
|
|
|
|
set(PVAPI_SDK_SUBDIR x86)
|
|
|
|
elseif(X86_64)
|
|
|
|
set(PVAPI_SDK_SUBDIR x64)
|
|
|
|
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES arm)
|
|
|
|
set(PVAPI_SDK_SUBDIR arm)
|
|
|
|
endif()
|
|
|
|
if(PVAPI_SDK_SUBDIR AND CMAKE_COMPILER_IS_GNUCXX)
|
|
|
|
get_filename_component(PVAPI_EXPECTED_LIB_PATH "${PVAPI_INCLUDE_PATH}/../lib-pc/${PVAPI_SDK_SUBDIR}/${CMAKE_OPENCV_GCC_VERSION_MAJOR}.${CMAKE_OPENCV_GCC_VERSION_MINOR}" ABSOLUTE)
|
|
|
|
link_directories(${PVAPI_EXPECTED_LIB_PATH})
|
|
|
|
endif()
|
|
|
|
set(highgui_srcs src/cap_pvapi.cpp ${highgui_srcs})
|
|
|
|
set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} PvAPI)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(WITH_IMAGEIO)
|
|
|
|
add_definitions(-DHAVE_IMAGEIO=1)
|
|
|
|
if(IOS)
|
|
|
|
list(APPEND HIGHGUI_LIBRARIES "-framework ImageIO")
|
|
|
|
endif()
|
|
|
|
#TODO: check if need to link with some framework on OS X: -framework ApplicationServices ??
|
|
|
|
endif(WITH_IMAGEIO)
|
|
|
|
|
|
|
|
if(WITH_AVFOUNDATION)
|
|
|
|
add_definitions(-DHAVE_AVFOUNDATION=1)
|
|
|
|
list(APPEND highgui_srcs src/cap_avfoundation.mm)
|
|
|
|
list(APPEND HIGHGUI_LIBRARIES "-framework AVFoundation" "-framework QuartzCore")
|
|
|
|
elseif(APPLE)
|
|
|
|
add_definitions(-DHAVE_QUICKTIME=1)
|
|
|
|
if(WITH_QUICKTIME)
|
|
|
|
list(APPEND highgui_srcs src/cap_qt.cpp)
|
|
|
|
list(APPEND HIGHGUI_LIBRARIES "-framework Carbon" "-framework QuickTime" "-framework CoreFoundation" "-framework QuartzCore")
|
|
|
|
else()
|
|
|
|
list(APPEND highgui_srcs src/cap_qtkit.mm)
|
|
|
|
list(APPEND HIGHGUI_LIBRARIES "-framework QTKit" "-framework QuartzCore")
|
2012-02-06 14:29:48 +01:00
|
|
|
endif()
|
2012-01-25 10:04:49 +01:00
|
|
|
endif()
|
|
|
|
|
2012-05-30 10:04:37 +02:00
|
|
|
if(WIN32)
|
|
|
|
link_directories("${OpenCV_SOURCE_DIR}/3rdparty/lib") # for ffmpeg wrapper only
|
|
|
|
include_directories(AFTER "${OpenCV_SOURCE_DIR}/3rdparty/include") # for directshow in VS2005 and multi-monitor support on MinGW
|
2012-02-06 14:29:48 +01:00
|
|
|
endif()
|
|
|
|
|
2012-05-30 10:04:37 +02:00
|
|
|
if(UNIX)
|
|
|
|
#these variables are set by CHECK_MODULE macro
|
|
|
|
foreach(P ${HIGHGUI_INCLUDE_DIRS})
|
|
|
|
ocv_include_directories(${P})
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
foreach(P ${HIGHGUI_LIBRARY_DIRS})
|
|
|
|
link_directories(${P})
|
|
|
|
endforeach()
|
2012-01-25 10:04:49 +01:00
|
|
|
endif()
|
|
|
|
|
2010-05-11 19:44:00 +02:00
|
|
|
source_group("Src" FILES ${highgui_srcs} ${highgui_hdrs})
|
|
|
|
source_group("Include" FILES ${highgui_ext_hdrs})
|
2012-02-03 12:26:49 +01:00
|
|
|
ocv_set_module_sources(HEADERS ${highgui_ext_hdrs} SOURCES ${highgui_srcs} ${highgui_hdrs} ${grfmt_srcs} ${grfmt_hdrs})
|
|
|
|
ocv_module_include_directories()
|
2011-04-26 18:10:26 +02:00
|
|
|
|
2012-05-30 10:04:37 +02:00
|
|
|
ocv_list_unique(HIGHGUI_LIBRARIES)
|
2012-02-03 12:26:49 +01:00
|
|
|
ocv_create_module(${GRFMT_LIBS} ${HIGHGUI_LIBRARIES})
|
2010-05-11 19:44:00 +02:00
|
|
|
|
2012-01-25 10:04:49 +01:00
|
|
|
if(BUILD_SHARED_LIBS)
|
2012-02-06 14:29:48 +01:00
|
|
|
add_definitions(-DHIGHGUI_EXPORTS)
|
2011-06-03 14:01:55 +02:00
|
|
|
endif()
|
|
|
|
|
2010-05-11 19:44:00 +02:00
|
|
|
if(MSVC)
|
2012-02-06 14:29:48 +01:00
|
|
|
set_target_properties(${the_module} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:atlthunk.lib /NODEFAULTLIB:atlsd.lib /NODEFAULTLIB:libcmt.lib /DEBUG")
|
2011-06-16 20:00:41 +02:00
|
|
|
endif()
|
|
|
|
|
2012-02-04 19:57:41 +01:00
|
|
|
#stop automatic dependencies propagation for this module
|
|
|
|
set_target_properties(${the_module} PROPERTIES LINK_INTERFACE_LIBRARIES "")
|
|
|
|
|
2012-02-03 12:26:49 +01:00
|
|
|
ocv_add_precompiled_headers(${the_module})
|
|
|
|
|
2012-04-08 23:49:19 +02:00
|
|
|
if(CMAKE_COMPILER_IS_GNUCXX AND NOT ENABLE_NOISY_WARNINGS)
|
2012-03-19 12:21:01 +01:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations")
|
|
|
|
endif()
|
|
|
|
|
2012-04-09 20:31:52 +02:00
|
|
|
if(WIN32 AND WITH_FFMPEG)
|
2012-03-03 16:49:23 +01:00
|
|
|
#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")
|
2012-04-26 15:32:27 +02:00
|
|
|
set(ffmpeg_bare_name_ver "opencv_ffmpeg${OPENCV_DLLVERSION}${FFMPEG_SUFFIX}.dll")
|
2012-03-03 16:49:23 +01:00
|
|
|
set(ffmpeg_path "${OpenCV_SOURCE_DIR}/3rdparty/ffmpeg/${ffmpeg_bare_name}")
|
|
|
|
|
2012-04-26 15:32:27 +02:00
|
|
|
#if(MSVC AND 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_ver}"
|
|
|
|
# COMMENT "Copying ${ffmpeg_path} to the output directory")
|
|
|
|
#else
|
|
|
|
if(MSVC_IDE)
|
2012-03-03 16:49:23 +01:00
|
|
|
add_custom_command(TARGET ${the_module} POST_BUILD
|
2012-04-26 15:32:27 +02:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy "${ffmpeg_path}" "${EXECUTABLE_OUTPUT_PATH}/Release/${ffmpeg_bare_name_ver}"
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy "${ffmpeg_path}" "${EXECUTABLE_OUTPUT_PATH}/Debug/${ffmpeg_bare_name_ver}"
|
2012-03-03 16:49:23 +01:00
|
|
|
COMMENT "Copying ${ffmpeg_path} to the output directory")
|
|
|
|
elseif(MSVC)
|
|
|
|
add_custom_command(TARGET ${the_module} POST_BUILD
|
2012-04-26 15:32:27 +02:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy "${ffmpeg_path}" "${EXECUTABLE_OUTPUT_PATH}/${CMAKE_BUILD_TYPE}/${ffmpeg_bare_name_ver}"
|
2012-03-03 16:49:23 +01:00
|
|
|
COMMENT "Copying ${ffmpeg_path} to the output directory")
|
|
|
|
else()
|
|
|
|
add_custom_command(TARGET ${the_module} POST_BUILD
|
2012-04-26 15:32:27 +02:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy "${ffmpeg_path}" "${EXECUTABLE_OUTPUT_PATH}/${ffmpeg_bare_name_ver}"
|
2012-03-03 16:49:23 +01:00
|
|
|
COMMENT "Copying ${ffmpeg_path} to the output directory")
|
|
|
|
endif()
|
|
|
|
|
2012-04-26 15:32:27 +02:00
|
|
|
install(FILES "${ffmpeg_path}" DESTINATION bin COMPONENT main RENAME "${ffmpeg_bare_name_ver}")
|
2012-03-03 16:49:23 +01:00
|
|
|
endif()
|
|
|
|
|
2012-02-16 21:29:35 +01:00
|
|
|
ocv_add_accuracy_tests()
|
2012-02-03 12:26:49 +01:00
|
|
|
ocv_add_perf_tests()
|