@ -1,26 +1,5 @@
set ( the_description "High-level GUI" )
set ( ENABLE_PLUGINS_DEFAULT ON )
if ( EMSCRIPTEN OR IOS OR WINRT )
set ( ENABLE_PLUGINS_DEFAULT OFF )
endif ( )
set ( HIGHGUI_PLUGIN_LIST "" CACHE STRING "List of GUI backends to be compiled as plugins (gtk, gtk2/gtk3, qt, win32 or special value 'all')" )
set ( HIGHGUI_ENABLE_PLUGINS "${ENABLE_PLUGINS_DEFAULT}" CACHE BOOL "Allow building and using of GUI plugins" )
mark_as_advanced ( HIGHGUI_PLUGIN_LIST HIGHGUI_ENABLE_PLUGINS )
string ( REPLACE "," ";" HIGHGUI_PLUGIN_LIST "${HIGHGUI_PLUGIN_LIST}" ) # s u p p o r t c o m m a - s e p a r a t e d list ( , ) t o o
if ( NOT HIGHGUI_ENABLE_PLUGINS )
if ( HIGHGUI_PLUGIN_LIST )
message ( WARNING "HighGUI: plugins are disabled through HIGHGUI_ENABLE_PLUGINS, so HIGHGUI_PLUGIN_LIST='${HIGHGUI_PLUGIN_LIST}' is ignored" )
set ( HIGHGUI_PLUGIN_LIST "" )
endif ( )
else ( )
# M a k e v i r t u a l p l u g i n s t a r g e t
if ( NOT TARGET opencv_highgui_plugins )
add_custom_target ( opencv_highgui_plugins ALL )
endif ( )
endif ( )
if ( ANDROID )
ocv_add_module ( highgui opencv_imgproc opencv_imgcodecs OPTIONAL opencv_videoio WRAP python )
else ( )
@ -68,7 +47,10 @@ file(GLOB highgui_ext_hdrs
# R e m o v i n g W i n R T A P I h e a d e r s b y d e f a u l t
list ( REMOVE_ITEM highgui_ext_hdrs "${CMAKE_CURRENT_LIST_DIR}/include/opencv2/${name}/highgui_winrt.hpp" )
set ( OPENCV_HIGHGUI_BUILTIN_BACKEND "" )
if ( HAVE_QT5 )
set ( OPENCV_HIGHGUI_BUILTIN_BACKEND "QT5" )
add_definitions ( -DHAVE_QT )
# " A u t o m o c " d o e s n ' t w o r k p r o p e r l y w i t h o p e n c v _ w o r l d b u i l d , u s e QT5_WRAP_CPP ( ) d i r e c t l y
@ -96,8 +78,8 @@ if(HAVE_QT5)
include_directories ( ${ Qt5OpenGL_INCLUDE_DIRS } )
list ( APPEND HIGHGUI_LIBRARIES ${ Qt5OpenGL_LIBRARIES } )
endif ( )
elseif ( HAVE_QT )
set ( OPENCV_HIGHGUI_BUILTIN_BACKEND "QT4" )
add_definitions ( -DHAVE_QT )
if ( HAVE_QT_OPENGL )
add_definitions ( -DHAVE_QT_OPENGL )
@ -115,6 +97,7 @@ elseif(HAVE_QT)
set_source_files_properties ( ${ _RCC_OUTFILES } PROPERTIES COMPILE_FLAGS -Wno-missing-declarations )
endif ( )
elseif ( WINRT )
set ( OPENCV_HIGHGUI_BUILTIN_BACKEND "WINRT" )
if ( NOT WINRT_8_0 )
# D e p e n d e n c i e s u s e d b y t h e i m p l e m e n t a t i o n r e f e r e n c e d
# b e l o w a r e n o t a v a i l a b l e o n W i n R T 8 . 0 .
@ -149,11 +132,13 @@ elseif(WINRT)
message ( STATUS " ${name}: Leaving '${HIGHGUI_LIBRARIES}'" )
endif ( )
elseif ( HAVE_WIN32UI )
set ( OPENCV_HIGHGUI_BUILTIN_BACKEND "WIN32UI" )
list ( APPEND highgui_srcs ${ CMAKE_CURRENT_LIST_DIR } /src/window_w32.cpp )
if ( OpenCV_ARCH STREQUAL "ARM64" )
list ( APPEND HIGHGUI_LIBRARIES "comdlg32" "advapi32" )
endif ( )
elseif ( HAVE_COCOA )
set ( OPENCV_HIGHGUI_BUILTIN_BACKEND "COCOA" )
add_definitions ( -DHAVE_COCOA )
list ( APPEND highgui_srcs ${ CMAKE_CURRENT_LIST_DIR } /src/window_cocoa.mm )
list ( APPEND HIGHGUI_LIBRARIES "-framework Cocoa" )
@ -170,16 +155,31 @@ if(TARGET ocv.3rdparty.gtk3 OR TARGET ocv.3rdparty.gtk2)
A N D N O T " g t k " I N _ L I S T H I G H G U I _ P L U G I N _ L I S T
A N D N O T " g t k 2 " I N _ L I S T H I G H G U I _ P L U G I N _ L I S T
A N D N O T " g t k 3 " I N _ L I S T H I G H G U I _ P L U G I N _ L I S T
A N D N O T O P E N C V _ H I G H G U I _ B U I L T I N _ B A C K E N D
)
if ( __gtk_dependency STREQUAL "ocv.3rdparty.gtk3" )
set ( OPENCV_HIGHGUI_BUILTIN_BACKEND "GTK3" )
elseif ( __gtk_dependency STREQUAL "ocv.3rdparty.gtk2" )
set ( OPENCV_HIGHGUI_BUILTIN_BACKEND "GTK2" )
else ( )
set ( OPENCV_HIGHGUI_BUILTIN_BACKEND "GTK" )
endif ( )
list ( APPEND highgui_srcs ${ CMAKE_CURRENT_LIST_DIR } /src/window_gtk.cpp )
list ( APPEND tgts ${ __gtk_dependency } )
if ( TARGET ocv.3rdparty.gthread )
list ( APPEND tgts ocv.3rdparty.gthread )
endif ( )
if ( TARGET ocv.3rdparty.gtkglext
A N D _ _ g t k _ d e p e n d e n c y S T R E Q U A L " o c v . 3 r d p a r t y . g t k 2 "
A N D N O T O P E N C V _ G T K _ D I S A B L E _ G T K G L E X T
)
list ( APPEND tgts ocv.3rdparty.gtkglext )
if ( TARGET ocv.3rdparty.gtk_opengl
A N D _ _ g t k _ d e p e n d e n c y S T R E Q U A L " o c v . 3 r d p a r t y . g t k 2 "
A N D N O T O P E N C V _ G T K _ D I S A B L E _ O P E N G L
)
list ( APPEND tgts ocv.3rdparty.gtk_opengl )
endif ( )
endif ( )
elseif ( "gtk" IN_LIST HIGHGUI_PLUGIN_LIST )
ocv_create_builtin_highgui_plugin ( opencv_highgui_gtk ${ __gtk_dependency } "window_gtk.cpp" )
@ -211,6 +211,11 @@ if(TARGET ocv.3rdparty.gtk3 OR TARGET ocv.3rdparty.gtk2)
endif ( )
endif ( )
if ( NOT OPENCV_HIGHGUI_BUILTIN_BACKEND )
set ( OPENCV_HIGHGUI_BUILTIN_BACKEND "NONE" )
endif ( )
message ( STATUS "highgui: using builtin backend: ${OPENCV_HIGHGUI_BUILTIN_BACKEND}" ) # F I X I T : p r o p a g a t e t o r o o t C M a k e
if ( TRUE )
# t h e s e v a r i a b l e s a r e s e t b y ' ocv_append_build_options ( HIGHGUI ... ) '
foreach ( P ${ HIGHGUI_INCLUDE_DIRS } )
@ -271,3 +276,10 @@ if(HIGHGUI_ENABLE_PLUGINS)
endif ( )
ocv_target_link_libraries ( ${ the_module } LINK_PRIVATE ${ tgts } )
# g e n e r a t e m o d u l e c o n f i g u r a t i o n
set ( CONFIG_STR " // Auto-generated file
# d e f i n e O P E N C V _ H I G H G U I _ B U I L T I N _ B A C K E N D _ S T R \ " $ { O P E N C V _ H I G H G U I _ B U I L T I N _ B A C K E N D } \ "
" )
ocv_update_file ( "${CMAKE_CURRENT_BINARY_DIR}/opencv_highgui_config.hpp" "${CONFIG_STR}" )