2017-06-20 20:19:43 +08:00
|
|
|
set(the_description "High-level GUI")
|
2021-05-01 21:13:58 +08:00
|
|
|
|
2017-06-03 20:28:53 +08:00
|
|
|
if(ANDROID)
|
2022-06-26 16:48:43 +08:00
|
|
|
ocv_add_module(highgui opencv_imgproc OPTIONAL opencv_imgcodecs opencv_videoio WRAP python)
|
2017-06-03 20:28:53 +08:00
|
|
|
else()
|
2022-06-26 16:48:43 +08:00
|
|
|
ocv_add_module(highgui opencv_imgproc OPTIONAL opencv_imgcodecs opencv_videoio WRAP python java)
|
2017-06-03 20:28:53 +08:00
|
|
|
endif()
|
2012-02-03 19:26:49 +08:00
|
|
|
|
2021-05-01 21:13:58 +08:00
|
|
|
include(${CMAKE_CURRENT_LIST_DIR}/cmake/plugin.cmake)
|
|
|
|
|
|
|
|
set(tgts "PRIVATE")
|
|
|
|
|
|
|
|
set(highgui_hdrs
|
|
|
|
${CMAKE_CURRENT_LIST_DIR}/src/precomp.hpp
|
|
|
|
)
|
|
|
|
|
|
|
|
set(highgui_srcs
|
|
|
|
${CMAKE_CURRENT_LIST_DIR}/src/backend.cpp
|
|
|
|
${CMAKE_CURRENT_LIST_DIR}/src/window.cpp
|
|
|
|
${CMAKE_CURRENT_LIST_DIR}/src/roiSelector.cpp
|
|
|
|
)
|
|
|
|
|
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
|
|
|
|
2015-12-31 21:31:26 +08:00
|
|
|
if(DEFINED WINRT AND NOT DEFINED ENABLE_WINRT_MODE_NATIVE)
|
Update cap_msmf.cpp
Add support for WinRT in the MF capture framework by removing the disallowed calls to enumerate devices and create a sample grabber sink and adding framework for the MediaCapture interface and a custom sink which interfaces with the sample grabber callback interface. The change requires discussion for making it completely functional as redundancy is required given that if the source is a video file, the old code pathways must be used. Otherwise all IMFMediaSession, IMFMediaSource, and IMFActivate code must use a MediaCapture code path and all sink code must use the CMediaSink custom sink.
Support for the custom sink is extended to non-WinRT not for compatibility as Windows Vista client is a minimum regardless, but because it offers more flexibility, could be faster and is able to be used as an optionally different code path during sink creation based on a future configuration parameter.
My discussion and proposal to finish this change:
Devices are so easily enumerated through WinRT Windows.Devices namespace that wrapping the calls in a library is quite a chore for little benefit though to get the various modes and formats could still be a worthwhile project. For now conditional compilation to remove videodevices and any offending non-video file related activity in videodevice. In my opinion, this is a different , far less fundamental and important change which can possibly be done as a future project and also much more easily implemented in C++/CX.
ImageGrabber has the IMFSampleGrabberSinkCallback replaced with a base class (SharedSampleGrabber) which also be is base class for ImageGrabberRT. This change is necessary as the custom sink does not require a thread to pump events which is done through MediaCapture already. IMFSampleGrabberSinkCallback is the common element between both models and that piece can be shared. Initializing the new ImageGrabberRT is as simple as passing an already initialized MediaCapture object and any video format/encoding parameters.
The concurrency event is necessary to wait for completion and is the way the underlying, IAsyncAction wrappers in the task library work as well. Native WIN32 event objects would be an option if HAVE_CONCURRENCY is not defined. I could even imagine doing it with sleep/thread yield and InterlockedCompareExchange yet I am not enthusiastic about that approach either. Since there is a specific compiler HAVE_ for concurrency, I do not like pulling it in though I think for WinRT it is safe to say we will always have it available though should probably conditionally compile with the Interlocked option as WIN32 events would require HAVE_WIN32.
It looks like C++/CX cannot be used for the IMediaExtension sink (which should not be a problem) as using COM objects requires WRL and though deriving from IMediaExtension can be done, there is little purpose without COM. Objects from C++/CX can be swapped to interact with objects from native C++ as Inspectable* can reinterpret_cast to the ref object IInspectable^ and vice-versa. A solution to the COM class with C++/CX would be great so we could have dual support. Also without #define for every WRL object in use, the code will get quite muddy given that the */^ would need to be ifdef'd everywhere.
Update cap_msmf.cpp
Fixed bugs and completed the change. I believe the new classes need to be moved to a header file as the file has become to large and more classes need to be added for handling all the asynchronous problems (one wrapping IAsyncAction in a task and another for making a task out of IAsyncAction). Unfortunately, blocking on the UI thread is not an option in WinRT so a synchronous architecture is considered "illegal" by Microsoft's standards even if implementable (C++/CX ppltasks library throws errors if you try it). Worse, either by design or a bug in the MF MediaCapture class with Custom Sinks causes a crash if stop/start previewing without reinitializing (spPreferredPreviewMediaType is fatally nulled). After decompiling Windows.Media.dll, I worked around this in my own projects by using an activate-able custom sink ID which strangely assigns 1 to this pointer allowing it to be reinitialized in what can only be described as a hack by Microsoft. This would add additional overhead to the project to implement especially for static libraries as it requires IDL/DLL exporting followed by manifest declaration. Better to document that it is not supported.
Furthermore, an additional class for IMFAttributes should be implemented to make clean architecture for passing around attributes as opposed to directly calling non-COM interface calls on the objects and making use of SetProperties which would also be a set up for an object that uses the RuntimeClass activation ID.
The remaining changes are not difficult and will be complete soon along with debug tracing messages.
Update cap_msmf.cpp
Create cap_msmf.h
Update cap_msmf.cpp
Update cap_msmf.h
Update cap_msmf.cpp
Update cap_msmf.h
Update and rename cap_msmf.h to cap_msmf.hpp
Update cap_msmf.cpp
Update CMakeLists.txt
Update cap_msmf.hpp
Update cap_msmf.cpp
Update cap_msmf.cpp
Update cap_msmf.cpp
Update cap_msmf.hpp
Update cap_msmf.hpp
Update cap_msmf.cpp
Successful test - samples are grabbed
Update cap_msmf.cpp
Update cap_msmf.hpp
Update cap_msmf.cpp
Update cap_msmf.hpp
Update cap_msmf.hpp
Update cap_msmf.cpp
Update cap_msmf.hpp
Update cap_msmf.cpp
Update cap_msmf.hpp
Update cap_msmf.cpp
Update cap_msmf.hpp
Create ppltasks_winrt.h
Update cap_msmf.hpp
Update cap_msmf.hpp
Update cap_msmf.cpp
Update ppltasks_winrt.h
Library updated and cleaned up with comments, marshaling, exceptions and linker settings
Update ppltasks_winrt.h
Fixed trailing whitespace
2013-12-14 16:53:30 +08:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /ZW")
|
|
|
|
endif()
|
|
|
|
|
2014-07-04 22:48:15 +08:00
|
|
|
if(APPLE)
|
2013-08-22 22:04:50 +08:00
|
|
|
ocv_include_directories(${ZLIB_INCLUDE_DIRS})
|
2014-07-04 22:48:15 +08:00
|
|
|
list(APPEND HIGHGUI_LIBRARIES ${ZLIB_LIBRARIES})
|
2010-05-12 01:44:00 +08:00
|
|
|
endif()
|
|
|
|
|
2018-02-02 19:19:29 +08:00
|
|
|
if(HAVE_WEBP)
|
|
|
|
add_definitions(-DHAVE_WEBP)
|
|
|
|
endif()
|
|
|
|
|
2014-08-01 22:11:20 +08:00
|
|
|
file(GLOB highgui_ext_hdrs
|
|
|
|
"${CMAKE_CURRENT_LIST_DIR}/include/opencv2/*.hpp"
|
|
|
|
"${CMAKE_CURRENT_LIST_DIR}/include/opencv2/${name}/*.hpp"
|
|
|
|
"${CMAKE_CURRENT_LIST_DIR}/include/opencv2/${name}/*.h")
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2015-06-27 04:41:25 +08:00
|
|
|
# Removing WinRT API headers by default
|
|
|
|
list(REMOVE_ITEM highgui_ext_hdrs "${CMAKE_CURRENT_LIST_DIR}/include/opencv2/${name}/highgui_winrt.hpp")
|
|
|
|
|
2021-06-05 01:15:07 +08:00
|
|
|
set(OPENCV_HIGHGUI_BUILTIN_BACKEND "")
|
|
|
|
|
2024-06-26 20:31:19 +08:00
|
|
|
if(WITH_FRAMEBUFFER AND HAVE_FRAMEBUFFER)
|
|
|
|
set(OPENCV_HIGHGUI_BUILTIN_BACKEND "FB")
|
|
|
|
add_definitions(-DHAVE_FRAMEBUFFER)
|
|
|
|
list(APPEND highgui_srcs ${CMAKE_CURRENT_LIST_DIR}/src/window_framebuffer.cpp)
|
|
|
|
list(APPEND highgui_hdrs ${CMAKE_CURRENT_LIST_DIR}/src/window_framebuffer.hpp)
|
|
|
|
if(HAVE_FRAMEBUFFER_XVFB)
|
|
|
|
add_definitions(-DHAVE_FRAMEBUFFER_XVFB)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2022-06-15 06:16:51 +08:00
|
|
|
if(WITH_WAYLAND AND HAVE_WAYLAND)
|
|
|
|
set(OPENCV_HIGHGUI_BUILTIN_BACKEND "Wayland")
|
|
|
|
add_definitions(-DHAVE_WAYLAND)
|
|
|
|
|
|
|
|
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
|
|
|
|
|
|
|
if (HAVE_WAYLAND_PROTOCOLS)
|
|
|
|
ocv_wayland_generate(
|
|
|
|
${WAYLAND_PROTOCOLS_BASE}/stable/xdg-shell/xdg-shell.xml
|
|
|
|
xdg-shell-client-protocol)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
list(APPEND highgui_srcs
|
|
|
|
${CMAKE_CURRENT_LIST_DIR}/src/window_wayland.cpp
|
|
|
|
${WAYLAND_PROTOCOL_SOURCES}
|
|
|
|
)
|
|
|
|
list(APPEND HIGHGUI_LIBRARIES "${WAYLAND_CLIENT_LINK_LIBRARIES};${WAYLAND_CURSOR_LINK_LIBRARIES};${XKBCOMMON_LINK_LIBRARIES}")
|
|
|
|
|
|
|
|
if(HAVE_WAYLAND_EGL)
|
|
|
|
if(WAYLAND_EGL_LIBRARIES)
|
|
|
|
list(APPEND HIGHGUI_LIBRARIES "${WAYLAND_EGL_LIBRARIES}")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2024-12-04 22:20:15 +08:00
|
|
|
ocv_module_include_directories(${WAYLAND_CLIENT_INCLUDE_DIRS} ${XKBCOMMON_INCLUDE_DIRS})
|
2022-06-15 06:16:51 +08:00
|
|
|
elseif(HAVE_QT)
|
2021-10-05 03:41:00 +08:00
|
|
|
set(OPENCV_HIGHGUI_BUILTIN_BACKEND "QT${QT_VERSION_MAJOR}")
|
2021-10-07 03:09:22 +08:00
|
|
|
add_definitions(-DHAVE_QT)
|
|
|
|
|
2021-10-05 00:44:57 +08:00
|
|
|
if(QT_VERSION_MAJOR GREATER 4)
|
|
|
|
# "Automoc" doesn't work properly with opencv_world build, use QT<ver>_WRAP_CPP() directly
|
|
|
|
#set(CMAKE_AUTOMOC ON)
|
|
|
|
|
|
|
|
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
|
|
|
|
|
|
|
if(QT_VERSION_MAJOR EQUAL 6)
|
2021-12-03 03:10:30 +08:00
|
|
|
add_definitions(-DHAVE_QT6) # QGLWidget deprecated for QT6, use this preprocessor to adjust window_QT.[h,cpp]
|
2021-10-05 00:44:57 +08:00
|
|
|
QT6_ADD_RESOURCES(_RCC_OUTFILES ${CMAKE_CURRENT_LIST_DIR}/src/window_QT.qrc)
|
|
|
|
QT6_WRAP_CPP(_MOC_OUTFILES ${CMAKE_CURRENT_LIST_DIR}/src/window_QT.h)
|
|
|
|
elseif(QT_VERSION_MAJOR EQUAL 5)
|
|
|
|
QT5_ADD_RESOURCES(_RCC_OUTFILES ${CMAKE_CURRENT_LIST_DIR}/src/window_QT.qrc)
|
|
|
|
QT5_WRAP_CPP(_MOC_OUTFILES ${CMAKE_CURRENT_LIST_DIR}/src/window_QT.h)
|
|
|
|
else()
|
2021-11-26 19:29:56 +08:00
|
|
|
message(FATAL_ERROR "Unsupported QT version: ${QT_VERSION_MAJOR}")
|
2021-10-05 00:44:57 +08:00
|
|
|
endif()
|
2012-04-14 05:50:59 +08:00
|
|
|
|
2021-10-05 00:44:57 +08:00
|
|
|
list(APPEND highgui_srcs
|
|
|
|
${CMAKE_CURRENT_LIST_DIR}/src/window_QT.cpp
|
|
|
|
${CMAKE_CURRENT_LIST_DIR}/src/window_QT.h
|
|
|
|
${_MOC_OUTFILES}
|
|
|
|
${_RCC_OUTFILES})
|
|
|
|
|
|
|
|
set(qt_deps Core Gui Widgets Test Concurrent)
|
|
|
|
if(HAVE_QT_OPENGL)
|
2021-10-07 03:09:22 +08:00
|
|
|
add_definitions(-DHAVE_QT_OPENGL)
|
2021-12-03 03:10:30 +08:00
|
|
|
# QOpenGLWidget requires Qt6 package component OpenGLWidgets
|
|
|
|
if(QT_VERSION_MAJOR GREATER 5)
|
|
|
|
list(APPEND qt_deps OpenGLWidgets)
|
|
|
|
endif()
|
2021-10-05 00:44:57 +08:00
|
|
|
list(APPEND qt_deps OpenGL)
|
2022-01-20 10:27:57 +08:00
|
|
|
if(OPENGL_LIBRARIES)
|
|
|
|
list(APPEND HIGHGUI_LIBRARIES "${OPENGL_LIBRARIES}")
|
|
|
|
endif()
|
2021-10-05 00:44:57 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
foreach(dt_dep ${qt_deps})
|
|
|
|
add_definitions(${Qt${QT_VERSION_MAJOR}${dt_dep}_DEFINITIONS})
|
|
|
|
include_directories(${Qt${QT_VERSION_MAJOR}${dt_dep}_INCLUDE_DIRS})
|
|
|
|
list(APPEND HIGHGUI_LIBRARIES ${Qt${QT_VERSION_MAJOR}${dt_dep}_LIBRARIES})
|
|
|
|
endforeach()
|
|
|
|
else()
|
|
|
|
ocv_assert(QT_VERSION_MAJOR EQUAL 4)
|
2022-01-20 10:27:57 +08:00
|
|
|
if(HAVE_QT_OPENGL)
|
2021-10-05 00:44:57 +08:00
|
|
|
set(QT_USE_QTOPENGL TRUE)
|
2022-01-20 10:27:57 +08:00
|
|
|
if(OPENGL_LIBRARIES)
|
|
|
|
list(APPEND HIGHGUI_LIBRARIES "${OPENGL_LIBRARIES}")
|
|
|
|
endif()
|
2021-10-05 00:44:57 +08:00
|
|
|
endif()
|
|
|
|
include(${QT_USE_FILE})
|
|
|
|
|
|
|
|
QT4_ADD_RESOURCES(_RCC_OUTFILES ${CMAKE_CURRENT_LIST_DIR}/src/window_QT.qrc)
|
|
|
|
QT4_WRAP_CPP(_MOC_OUTFILES ${CMAKE_CURRENT_LIST_DIR}/src/window_QT.h)
|
|
|
|
|
|
|
|
list(APPEND HIGHGUI_LIBRARIES ${QT_LIBRARIES})
|
|
|
|
list(APPEND highgui_srcs ${CMAKE_CURRENT_LIST_DIR}/src/window_QT.cpp ${_MOC_OUTFILES} ${_RCC_OUTFILES})
|
|
|
|
ocv_check_flag_support(CXX -Wno-missing-declarations _have_flag "")
|
|
|
|
if(${_have_flag})
|
|
|
|
set_source_files_properties(${_RCC_OUTFILES} PROPERTIES COMPILE_FLAGS -Wno-missing-declarations)
|
|
|
|
endif()
|
2012-06-08 01:21:29 +08:00
|
|
|
endif()
|
2015-06-27 04:41:25 +08:00
|
|
|
elseif(WINRT)
|
2021-06-05 01:15:07 +08:00
|
|
|
set(OPENCV_HIGHGUI_BUILTIN_BACKEND "WINRT")
|
2015-06-27 04:41:25 +08:00
|
|
|
if(NOT WINRT_8_0)
|
|
|
|
# Dependencies used by the implementation referenced
|
|
|
|
# below are not available on WinRT 8.0.
|
|
|
|
# Enabling it for WiRT 8.1+ only.
|
|
|
|
|
|
|
|
# WinRT 8.1+ detected. Adding WinRT API header.
|
2015-07-11 00:18:07 +08:00
|
|
|
message(STATUS " ${name}: WinRT detected. Adding WinRT API header")
|
2015-06-27 04:41:25 +08:00
|
|
|
list(APPEND highgui_ext_hdrs "${CMAKE_CURRENT_LIST_DIR}/include/opencv2/${name}/highgui_winrt.hpp")
|
|
|
|
|
|
|
|
|
|
|
|
list(APPEND highgui_srcs
|
|
|
|
${CMAKE_CURRENT_LIST_DIR}/src/window_winrt.cpp
|
|
|
|
${CMAKE_CURRENT_LIST_DIR}/src/window_winrt_bridge.cpp)
|
|
|
|
list(APPEND highgui_hdrs
|
|
|
|
${CMAKE_CURRENT_LIST_DIR}/src/window_winrt_bridge.hpp)
|
|
|
|
endif()
|
2015-06-02 23:33:21 +08:00
|
|
|
|
|
|
|
# libraries below are neither available nor required
|
|
|
|
# on ARM devices and/or Windows Phone
|
|
|
|
if(WINRT_PHONE OR (OpenCV_ARCH STREQUAL "ARM"))
|
|
|
|
list(REMOVE_ITEM HIGHGUI_LIBRARIES "comctl32" "gdi32" "ole32" "setupapi")
|
|
|
|
if(WINRT_PHONE)
|
2015-07-11 00:18:07 +08:00
|
|
|
message(STATUS " ${name}: Windows Phone detected")
|
2015-06-02 23:33:21 +08:00
|
|
|
elseif(OpenCV_ARCH STREQUAL "ARM")
|
2015-07-11 00:18:07 +08:00
|
|
|
message(STATUS " ${name}: ARM detected")
|
2015-06-27 04:41:25 +08:00
|
|
|
if(WINRT_STORE)
|
|
|
|
list(REMOVE_ITEM HIGHGUI_LIBRARIES "ws2_32")
|
2015-07-11 00:18:07 +08:00
|
|
|
message(STATUS " ${name}: Removing 'ws2_32.lib'")
|
2015-06-27 04:41:25 +08:00
|
|
|
endif()
|
2015-06-02 23:33:21 +08:00
|
|
|
endif()
|
2015-07-11 00:18:07 +08:00
|
|
|
message(STATUS " ${name}: Removing 'comctl32.lib, gdi32.lib, ole32.lib, setupapi.lib'")
|
|
|
|
message(STATUS " ${name}: Leaving '${HIGHGUI_LIBRARIES}'")
|
2015-06-02 23:33:21 +08:00
|
|
|
endif()
|
2013-07-10 22:20:34 +08:00
|
|
|
elseif(HAVE_COCOA)
|
2021-06-05 01:15:07 +08:00
|
|
|
set(OPENCV_HIGHGUI_BUILTIN_BACKEND "COCOA")
|
2021-05-01 21:13:58 +08:00
|
|
|
add_definitions(-DHAVE_COCOA)
|
2014-08-01 22:11:20 +08:00
|
|
|
list(APPEND highgui_srcs ${CMAKE_CURRENT_LIST_DIR}/src/window_cocoa.mm)
|
2013-07-10 22:20:34 +08:00
|
|
|
list(APPEND HIGHGUI_LIBRARIES "-framework Cocoa")
|
2010-07-12 23:29:31 +08:00
|
|
|
endif()
|
2012-05-25 04:10:13 +08:00
|
|
|
|
2021-06-19 17:16:23 +08:00
|
|
|
if(TARGET ocv.3rdparty.win32ui)
|
|
|
|
if("win32ui" IN_LIST HIGHGUI_PLUGIN_LIST OR HIGHGUI_PLUGIN_LIST STREQUAL "all")
|
|
|
|
ocv_create_builtin_highgui_plugin(opencv_highgui_win32 ocv.3rdparty.win32ui "window_w32.cpp")
|
2021-07-03 19:36:29 +08:00
|
|
|
elseif(NOT OPENCV_HIGHGUI_BUILTIN_BACKEND)
|
2021-06-19 17:16:23 +08:00
|
|
|
set(OPENCV_HIGHGUI_BUILTIN_BACKEND "WIN32UI")
|
|
|
|
list(APPEND highgui_srcs ${CMAKE_CURRENT_LIST_DIR}/src/window_w32.cpp)
|
|
|
|
list(APPEND tgts ocv.3rdparty.win32ui)
|
2022-01-31 20:53:45 +08:00
|
|
|
if(HAVE_OPENGL AND OPENGL_LIBRARIES)
|
|
|
|
list(APPEND tgts "${OPENGL_LIBRARIES}")
|
|
|
|
endif()
|
2021-06-19 17:16:23 +08:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2021-05-01 21:13:58 +08:00
|
|
|
if(TARGET ocv.3rdparty.gtk3 OR TARGET ocv.3rdparty.gtk2)
|
|
|
|
if(TARGET ocv.3rdparty.gtk3 AND NOT WITH_GTK_2_X)
|
|
|
|
set(__gtk_dependency "ocv.3rdparty.gtk3")
|
|
|
|
else()
|
|
|
|
set(__gtk_dependency "ocv.3rdparty.gtk2")
|
|
|
|
endif()
|
|
|
|
if(
|
|
|
|
NOT HIGHGUI_PLUGIN_LIST STREQUAL "all"
|
|
|
|
AND NOT "gtk" IN_LIST HIGHGUI_PLUGIN_LIST
|
|
|
|
AND NOT "gtk2" IN_LIST HIGHGUI_PLUGIN_LIST
|
|
|
|
AND NOT "gtk3" IN_LIST HIGHGUI_PLUGIN_LIST
|
2021-06-05 01:15:07 +08:00
|
|
|
AND NOT OPENCV_HIGHGUI_BUILTIN_BACKEND
|
2021-05-01 21:13:58 +08:00
|
|
|
)
|
2021-06-05 01:15:07 +08:00
|
|
|
if(__gtk_dependency STREQUAL "ocv.3rdparty.gtk3")
|
|
|
|
set(OPENCV_HIGHGUI_BUILTIN_BACKEND "GTK3")
|
2024-07-15 22:06:30 +08:00
|
|
|
if(OPENGL_LIBRARIES)
|
|
|
|
list(APPEND HIGHGUI_LIBRARIES "${OPENGL_LIBRARIES}")
|
|
|
|
endif()
|
2021-06-05 01:15:07 +08:00
|
|
|
elseif(__gtk_dependency STREQUAL "ocv.3rdparty.gtk2")
|
|
|
|
set(OPENCV_HIGHGUI_BUILTIN_BACKEND "GTK2")
|
|
|
|
else()
|
|
|
|
set(OPENCV_HIGHGUI_BUILTIN_BACKEND "GTK")
|
|
|
|
endif()
|
2021-05-01 21:13:58 +08:00
|
|
|
list(APPEND highgui_srcs ${CMAKE_CURRENT_LIST_DIR}/src/window_gtk.cpp)
|
|
|
|
list(APPEND tgts ${__gtk_dependency})
|
|
|
|
if(TARGET ocv.3rdparty.gtkglext
|
2021-06-05 01:15:07 +08:00
|
|
|
AND __gtk_dependency STREQUAL "ocv.3rdparty.gtk2"
|
2021-05-01 21:13:58 +08:00
|
|
|
AND NOT OPENCV_GTK_DISABLE_GTKGLEXT
|
|
|
|
)
|
|
|
|
list(APPEND tgts ocv.3rdparty.gtkglext)
|
2021-06-05 01:15:07 +08:00
|
|
|
if(TARGET ocv.3rdparty.gtk_opengl
|
|
|
|
AND __gtk_dependency STREQUAL "ocv.3rdparty.gtk2"
|
|
|
|
AND NOT OPENCV_GTK_DISABLE_OPENGL
|
|
|
|
)
|
|
|
|
list(APPEND tgts ocv.3rdparty.gtk_opengl)
|
|
|
|
endif()
|
2021-05-01 21:13:58 +08:00
|
|
|
endif()
|
|
|
|
elseif("gtk" IN_LIST HIGHGUI_PLUGIN_LIST)
|
|
|
|
ocv_create_builtin_highgui_plugin(opencv_highgui_gtk ${__gtk_dependency} "window_gtk.cpp")
|
|
|
|
if(TARGET ocv.3rdparty.gtkglext)
|
|
|
|
ocv_target_link_libraries(opencv_highgui_gtk ocv.3rdparty.gtkglext)
|
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
if(TARGET ocv.3rdparty.gtk3 AND ("gtk3" IN_LIST HIGHGUI_PLUGIN_LIST OR HIGHGUI_PLUGIN_LIST STREQUAL "all"))
|
|
|
|
ocv_create_builtin_highgui_plugin(opencv_highgui_gtk3 ocv.3rdparty.gtk3 "window_gtk.cpp")
|
|
|
|
if(TARGET ocv.3rdparty.gtkglext)
|
|
|
|
ocv_target_link_libraries(opencv_highgui_gtk3 ocv.3rdparty.gtkglext)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
if(TARGET ocv.3rdparty.gtk2 AND ("gtk2" IN_LIST HIGHGUI_PLUGIN_LIST OR HIGHGUI_PLUGIN_LIST STREQUAL "all"))
|
|
|
|
ocv_create_builtin_highgui_plugin(opencv_highgui_gtk2 ocv.3rdparty.gtk2 "window_gtk.cpp")
|
|
|
|
if(TARGET ocv.3rdparty.gtkglext)
|
|
|
|
ocv_target_link_libraries(opencv_highgui_gtk2 ocv.3rdparty.gtkglext)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2021-06-05 01:15:07 +08:00
|
|
|
if(NOT OPENCV_HIGHGUI_BUILTIN_BACKEND)
|
|
|
|
set(OPENCV_HIGHGUI_BUILTIN_BACKEND "NONE")
|
|
|
|
endif()
|
2021-07-21 12:06:31 +08:00
|
|
|
message(STATUS "highgui: using builtin backend: ${OPENCV_HIGHGUI_BUILTIN_BACKEND}")
|
|
|
|
set(OPENCV_HIGHGUI_BUILTIN_BACKEND "${OPENCV_HIGHGUI_BUILTIN_BACKEND}" PARENT_SCOPE) # informational
|
2021-06-05 01:15:07 +08:00
|
|
|
|
2019-04-16 05:29:17 +08:00
|
|
|
if(TRUE)
|
|
|
|
# these variables are set by 'ocv_append_build_options(HIGHGUI ...)'
|
2012-05-21 16:53:38 +08:00
|
|
|
foreach(P ${HIGHGUI_INCLUDE_DIRS})
|
|
|
|
ocv_include_directories(${P})
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
foreach(P ${HIGHGUI_LIBRARY_DIRS})
|
|
|
|
link_directories(${P})
|
|
|
|
endforeach()
|
|
|
|
endif()
|
|
|
|
|
2021-05-01 21:13:58 +08:00
|
|
|
if(tgts STREQUAL "PRIVATE")
|
|
|
|
set(tgts "")
|
|
|
|
endif()
|
|
|
|
|
2023-02-19 00:21:07 +08:00
|
|
|
ocv_install_used_external_targets(${tgts})
|
2021-05-01 21:13:58 +08:00
|
|
|
|
2010-05-12 01:44:00 +08:00
|
|
|
source_group("Src" FILES ${highgui_srcs} ${highgui_hdrs})
|
|
|
|
source_group("Include" FILES ${highgui_ext_hdrs})
|
2014-07-04 22:48:15 +08:00
|
|
|
ocv_set_module_sources(HEADERS ${highgui_ext_hdrs} SOURCES ${highgui_srcs} ${highgui_hdrs})
|
2012-02-03 19:26:49 +08:00
|
|
|
ocv_module_include_directories()
|
2011-04-27 00:10:26 +08:00
|
|
|
|
2014-07-04 22:48:15 +08:00
|
|
|
ocv_create_module(${HIGHGUI_LIBRARIES})
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2014-08-01 22:11:20 +08:00
|
|
|
macro(ocv_highgui_configure_target)
|
2013-01-29 21:08:26 +08:00
|
|
|
if(APPLE)
|
2021-02-13 08:35:18 +08:00
|
|
|
add_apple_compiler_options(${the_module})
|
2013-01-29 21:08:26 +08:00
|
|
|
endif()
|
|
|
|
|
2021-10-04 20:42:51 +08:00
|
|
|
if(MSVC AND NOT BUILD_SHARED_LIBS AND BUILD_WITH_STATIC_CRT)
|
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-06-08 14:19:17 +08:00
|
|
|
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wno-deprecated-declarations)
|
2014-08-01 22:11:20 +08:00
|
|
|
endmacro()
|
|
|
|
|
|
|
|
if(NOT BUILD_opencv_world)
|
|
|
|
ocv_highgui_configure_target()
|
|
|
|
endif()
|
2012-03-19 19:21:01 +08:00
|
|
|
|
2021-05-01 21:13:58 +08:00
|
|
|
ocv_add_accuracy_tests(${tgts})
|
|
|
|
#ocv_add_perf_tests(${tgts})
|
|
|
|
|
|
|
|
if(HIGHGUI_ENABLE_PLUGINS)
|
|
|
|
ocv_target_compile_definitions(${the_module} PRIVATE ENABLE_PLUGINS)
|
|
|
|
if(TARGET opencv_test_highgui)
|
|
|
|
ocv_target_compile_definitions(opencv_test_highgui PRIVATE ENABLE_PLUGINS)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
ocv_target_link_libraries(${the_module} LINK_PRIVATE ${tgts})
|
2021-06-05 01:15:07 +08:00
|
|
|
|
|
|
|
# generate module configuration
|
|
|
|
set(CONFIG_STR "// Auto-generated file
|
|
|
|
#define OPENCV_HIGHGUI_BUILTIN_BACKEND_STR \"${OPENCV_HIGHGUI_BUILTIN_BACKEND}\"
|
|
|
|
")
|
2021-06-09 16:36:32 +08:00
|
|
|
if(OPENCV_HIGHGUI_BUILTIN_BACKEND STREQUAL "NONE")
|
|
|
|
set(CONFIG_STR "${CONFIG_STR}
|
|
|
|
#define OPENCV_HIGHGUI_WITHOUT_BUILTIN_BACKEND 1
|
|
|
|
")
|
|
|
|
endif()
|
2021-06-05 01:15:07 +08:00
|
|
|
|
|
|
|
ocv_update_file("${CMAKE_CURRENT_BINARY_DIR}/opencv_highgui_config.hpp" "${CONFIG_STR}")
|