2021-05-01 21:13:58 +08:00
|
|
|
# --- GTK ---
|
2021-06-05 01:15:07 +08:00
|
|
|
ocv_clear_vars(HAVE_GTK HAVE_GTK2 HAVE_GTK3 HAVE_GTHREAD HAVE_GTKGLEXT)
|
2021-05-28 09:41:20 +08:00
|
|
|
if(WITH_GTK)
|
2021-05-01 21:13:58 +08:00
|
|
|
if(NOT WITH_GTK_2_X)
|
|
|
|
ocv_check_modules(GTK3 gtk+-3.0)
|
|
|
|
if(HAVE_GTK3)
|
|
|
|
ocv_add_external_target(gtk3 "${GTK3_INCLUDE_DIRS}" "${GTK3_LIBRARIES}" "HAVE_GTK3;HAVE_GTK")
|
|
|
|
set(HAVE_GTK TRUE)
|
|
|
|
endif()
|
|
|
|
endif()
|
2021-05-28 09:41:20 +08:00
|
|
|
if((PROJECT_NAME STREQUAL "OpenCV" AND HIGHGUI_ENABLE_PLUGINS) OR NOT HAVE_GTK3)
|
2021-05-01 21:13:58 +08:00
|
|
|
ocv_check_modules(GTK2 gtk+-2.0)
|
|
|
|
if(HAVE_GTK2)
|
|
|
|
set(MIN_VER_GTK "2.18.0")
|
|
|
|
if(GTK2_VERSION VERSION_LESS MIN_VER_GTK)
|
|
|
|
message(FATAL_ERROR "GTK support requires a minimum version of ${MIN_VER_GTK} (${GTK2_VERSION} found)")
|
|
|
|
else()
|
|
|
|
ocv_add_external_target(gtk2 "${GTK2_INCLUDE_DIRS}" "${GTK2_LIBRARIES}" "HAVE_GTK2;HAVE_GTK")
|
|
|
|
set(HAVE_GTK TRUE)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
endif()
|
2023-02-14 20:28:42 +08:00
|
|
|
ocv_check_modules(GTHREAD gthread-2.0>=2.32)
|
2021-05-01 21:13:58 +08:00
|
|
|
if(HAVE_GTK AND NOT HAVE_GTHREAD)
|
|
|
|
message(FATAL_ERROR "gthread not found. This library is required when building with GTK support")
|
|
|
|
else()
|
|
|
|
ocv_add_external_target(gthread "${GTHREAD_INCLUDE_DIRS}" "${GTHREAD_LIBRARIES}" "HAVE_GTHREAD")
|
|
|
|
endif()
|
2024-07-15 22:06:30 +08:00
|
|
|
if((WITH_OPENGL OR HAVE_OPENGL) AND (HAVE_GTK2 OR HAVE_GTK3))
|
|
|
|
if(HAVE_GTK2)
|
|
|
|
ocv_check_modules(GTKGLEXT gtkglext-1.0)
|
|
|
|
if(HAVE_GTKGLEXT)
|
|
|
|
# HACK for https://github.com/opencv/opencv/issues/20850
|
|
|
|
# pkg-config reports some include directories that do not exist. Just filter them out.
|
|
|
|
set(GTKGLEXT_INCLUDE_DIRS_EXISTS "")
|
|
|
|
foreach(p ${GTKGLEXT_INCLUDE_DIRS})
|
|
|
|
if (EXISTS "${p}")
|
|
|
|
list(APPEND GTKGLEXT_INCLUDE_DIRS_EXISTS "${p}")
|
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
ocv_add_external_target(gtkglext "${GTKGLEXT_INCLUDE_DIRS}" "${GTKGLEXT_LIBRARIES}" "HAVE_GTKGLEXT")
|
|
|
|
endif()
|
2021-05-01 21:13:58 +08:00
|
|
|
endif()
|
|
|
|
endif()
|
2021-05-28 09:41:20 +08:00
|
|
|
elseif(HAVE_GTK)
|
|
|
|
ocv_add_external_target(gtk "${GTK_INCLUDE_DIRS}" "${GTK_LIBRARIES}" "${GTK_DEFINES};HAVE_GTK")
|
2021-05-01 21:13:58 +08:00
|
|
|
endif()
|
|
|
|
|
2024-07-15 22:06:30 +08:00
|
|
|
if(WITH_OPENGL)
|
2021-06-05 01:15:07 +08:00
|
|
|
find_package(OpenGL QUIET)
|
|
|
|
if(OPENGL_FOUND)
|
|
|
|
set(HAVE_OPENGL TRUE)
|
|
|
|
ocv_add_external_target(gtk_opengl "${OPENGL_INCLUDE_DIRS}" "${OPENGL_LIBRARIES}" "HAVE_OPENGL")
|
|
|
|
endif()
|
|
|
|
endif()
|