Commit 16383412 authored by Tony's avatar Tony

Use GTK_VERSION_MAJOR to switch between GTK+ version two and three

specific code. As a result of this, HAVE_GTK3 no longer needs to be
exposed.

The use of HAVE_GTK, and HAVE_ GTK3 have been changed to mirror the
method used by HAVE_QT and HAVE_QT5.
 On branch gtk3
 Changes to be committed:
        modified:   CMakeLists.txt
        modified:   cmake/OpenCVFindLibsGUI.cmake
        modified:   cmake/templates/cvconfig.h.in
        modified:   modules/highgui/src/window.cpp
        modified:   modules/highgui/src/window_gtk.cpp
parent befdef96
......@@ -127,6 +127,7 @@ OCV_OPTION(WITH_FFMPEG "Include FFMPEG support" ON
OCV_OPTION(WITH_GSTREAMER "Include Gstreamer support" ON IF (UNIX AND NOT APPLE AND NOT ANDROID) )
OCV_OPTION(WITH_GSTREAMER_0_10 "Enable Gstreamer 0.10 support (instead of 1.x)" OFF )
OCV_OPTION(WITH_GTK "Include GTK support" ON IF (UNIX AND NOT APPLE AND NOT ANDROID) )
OCV_OPTION(WITH_GTK_2_X "Use GTK version 2" OFF IF (UNIX AND NOT APPLE AND NOT ANDROID) )
OCV_OPTION(WITH_IPP "Include Intel IPP support" ON IF (NOT IOS) )
OCV_OPTION(WITH_JASPER "Include JPEG2K support" ON IF (NOT IOS) )
OCV_OPTION(WITH_JPEG "Include JPEG support" ON)
......@@ -157,7 +158,7 @@ OCV_OPTION(WITH_OPENCLAMDFFT "Include AMD OpenCL FFT library support" ON
OCV_OPTION(WITH_OPENCLAMDBLAS "Include AMD OpenCL BLAS library support" ON IF (NOT ANDROID AND NOT IOS) )
OCV_OPTION(WITH_DIRECTX "Include DirectX support" ON IF WIN32 )
OCV_OPTION(WITH_INTELPERC "Include Intel Perceptual Computing support" OFF IF WIN32 )
OCV_OPTION(WITH_IPP_A "Include Intel IPP_A support" OFF IF (MSVC OR X86 OR X86_64) )
# OpenCV build components
# ===================================================
......@@ -748,6 +749,7 @@ else()
endif()
else()
status(" GTK+ 2.x:" HAVE_GTK THEN "YES (ver ${ALIASOF_gtk+-2.0_VERSION})" ELSE NO)
status(" GTK+ 3.x:" HAVE_GTK3 THEN "YES (ver ${ALIASOF_gtk+-3.0_VERSION})" ELSE NO)
status(" GThread :" HAVE_GTHREAD THEN "YES (ver ${ALIASOF_gthread-2.0_VERSION})" ELSE NO)
status(" GtkGlExt:" HAVE_GTKGLEXT THEN "YES (ver ${ALIASOF_gtkglext-1.0_VERSION})" ELSE NO)
endif()
......@@ -916,17 +918,13 @@ endif(DEFINED WITH_INTELPERC)
status("")
status(" Other third-party libraries:")
if(WITH_IPP AND HAVE_IPP)
status(" Use IPP:" "${IPP_VERSION_STR} [${IPP_VERSION_MAJOR}.${IPP_VERSION_MINOR}.${IPP_VERSION_BUILD}]")
if(WITH_IPP AND IPP_FOUND)
status(" Use IPP:" "${IPP_LATEST_VERSION_STR} [${IPP_LATEST_VERSION_MAJOR}.${IPP_LATEST_VERSION_MINOR}.${IPP_LATEST_VERSION_BUILD}]")
status(" at:" "${IPP_ROOT_DIR}")
else()
status(" Use IPP:" WITH_IPP AND NOT HAVE_IPP THEN "IPP not found" ELSE NO)
status(" Use IPP:" WITH_IPP AND NOT IPP_FOUND THEN "IPP not found" ELSE NO)
endif()
if(DEFINED WITH_IPP_A)
status(" Use IPP Async:" HAVE_IPP_A THEN "YES" ELSE NO)
endif(DEFINED WITH_IPP_A)
status(" Use Eigen:" HAVE_EIGEN THEN "YES (ver ${EIGEN_WORLD_VERSION}.${EIGEN_MAJOR_VERSION}.${EIGEN_MINOR_VERSION})" ELSE NO)
status(" Use TBB:" HAVE_TBB THEN "YES (ver ${TBB_VERSION_MAJOR}.${TBB_VERSION_MINOR} interface ${TBB_INTERFACE_VERSION})" ELSE NO)
status(" Use OpenMP:" HAVE_OPENMP THEN YES ELSE NO)
......
......@@ -44,17 +44,19 @@ if(WITH_GTK AND NOT HAVE_QT)
if(WITH_GTK_2_X)
CHECK_MODULE(gtk+-2.0 HAVE_GTK)
if(HAVE_GTK AND (ALIASOF_gtk+-2.0_VERSION VERSION_LESS MIN_VER_GTK))
message (FATAL_ERROR "Gtk support requires a minimum gtk+ version of ${MIN_VER_GTK} (${ALIASOF_gtk+-2.0_VERSION} found)")
message (FATAL_ERROR "GTK support requires a minimum version of ${MIN_VER_GTK} (${ALIASOF_gtk+-2.0_VERSION} found)")
endif()
else()
CHECK_MODULE(gtk+-3.0 HAVE_GTK3)
if(NOT HAVE_GTK3)
message(WARNING "Unable to locate Gtk3 development libraries")
if(HAVE_GTK3)
set(HAVE_GTK ON)
else()
message(WARNING "Unable to locate GTK3 development libraries")
endif()
endif()
CHECK_MODULE(gthread-2.0 HAVE_GTHREAD)
if(HAVE_GTK OR HAVE_GTK3 AND NOT HAVE_GTHREAD)
message(FATAL_ERROR "gthread not found. This library is required when building with Gtk support")
message(FATAL_ERROR "gthread not found. This library is required when building with GTK support")
endif()
if(WITH_OPENGL AND NOT HAVE_GTK3)
CHECK_MODULE(gtkglext-1.0 HAVE_GTKGLEXT)
......
......@@ -85,9 +85,6 @@
/* GTK+ 2.x toolkit */
#cmakedefine HAVE_GTK
/* GTK+ 3.x toolkit */
#cmakedefine HAVE_GTK3
/* Define to 1 if you have the <inttypes.h> header file. */
#cmakedefine HAVE_INTTYPES_H 1
......
......@@ -59,7 +59,7 @@ CV_IMPL void cvSetWindowProperty(const char* name, int prop_id, double prop_valu
cvSetModeWindow_QT(name,prop_value);
#elif defined(HAVE_WIN32UI)
cvSetModeWindow_W32(name,prop_value);
#elif defined (HAVE_GTK) | defined (HAVE_GTK3)
#elif defined (HAVE_GTK)
cvSetModeWindow_GTK(name,prop_value);
#elif defined (HAVE_CARBON)
cvSetModeWindow_CARBON(name,prop_value);
......@@ -98,7 +98,7 @@ CV_IMPL double cvGetWindowProperty(const char* name, int prop_id)
return cvGetModeWindow_QT(name);
#elif defined(HAVE_WIN32UI)
return cvGetModeWindow_W32(name);
#elif defined (HAVE_GTK) | defined(HAVE_GTK3)
#elif defined (HAVE_GTK)
return cvGetModeWindow_GTK(name);
#elif defined (HAVE_CARBON)
return cvGetModeWindow_CARBON(name);
......@@ -115,7 +115,7 @@ CV_IMPL double cvGetWindowProperty(const char* name, int prop_id)
return cvGetPropWindow_QT(name);
#elif defined(HAVE_WIN32UI)
return cvGetPropWindowAutoSize_W32(name);
#elif defined (HAVE_GTK) | defined(HAVE_GTK3)
#elif defined (HAVE_GTK)
return cvGetPropWindowAutoSize_GTK(name);
#else
return -1;
......@@ -128,7 +128,7 @@ CV_IMPL double cvGetWindowProperty(const char* name, int prop_id)
return cvGetRatioWindow_QT(name);
#elif defined(HAVE_WIN32UI)
return cvGetRatioWindow_W32(name);
#elif defined (HAVE_GTK) | defined(HAVE_GTK3)
#elif defined (HAVE_GTK)
return cvGetRatioWindow_GTK(name);
#else
return -1;
......@@ -141,7 +141,7 @@ CV_IMPL double cvGetWindowProperty(const char* name, int prop_id)
return cvGetOpenGlProp_QT(name);
#elif defined(HAVE_WIN32UI)
return cvGetOpenGlProp_W32(name);
#elif defined (HAVE_GTK) | defined(HAVE_GTK3)
#elif defined (HAVE_GTK)
return cvGetOpenGlProp_GTK(name);
#else
return -1;
......@@ -477,7 +477,6 @@ int cv::createButton(const String&, ButtonCallback, void*, int , bool )
#if defined(HAVE_WIN32UI) // see window_w32.cpp
#elif defined (HAVE_GTK) // see window_gtk.cpp
#elif defined (HAVE_GTK3) // see window_gtk.cpp
#elif defined (HAVE_COCOA) // see window_carbon.cpp
#elif defined (HAVE_CARBON)
#elif defined (HAVE_QT) //YV see window_QT.cpp
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment