mprove Gtk2/3 options in cmake

Update to cmake files for to include minimum versions, and tidy up gtk operation.

Files updated:
CMakeLists.txt:
  WITH_GTK now uses Gtk3 by default. If not found then Gtk2 is used.
  WITH_GTK_2_X forces Gtk2.x use

cmake/OpenCVFindLibsGUI.cmake
  Updated selection logic to implement methodology described above.
  Implemented warning if Gtk3 not found (and not overridden)
  Implemented error if Gtk does not meet minimum required version

cmake/OpenCVMinDepVersions.cmake
  Added minimum Gtk version of 2.18.0
pull/1552/head
Tony 11 years ago
parent 5368f12b33
commit 69dc840583
  1. 2
      CMakeLists.txt
  2. 15
      cmake/OpenCVFindLibsGUI.cmake
  3. 1
      cmake/OpenCVMinDepVersions.cmake

@ -120,7 +120,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_1_X "Include Gstreamer 1.x support" OFF)
OCV_OPTION(WITH_GTK "Include GTK support" ON IF (UNIX AND NOT APPLE AND NOT ANDROID) )
OCV_OPTION(WITH_GTK3 "Include GTK3 support" ON IF (UNIX AND WITH_GTK 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" OFF IF (MSVC OR X86 OR X86_64) )
OCV_OPTION(WITH_JASPER "Include JPEG2K support" ON IF (NOT IOS) )
OCV_OPTION(WITH_JPEG "Include JPEG support" ON)

@ -41,12 +41,21 @@ endif()
# --- GTK ---
ocv_clear_vars(HAVE_GTK HAVE_GTK3 HAVE_GTHREAD HAVE_GTKGLEXT)
if(WITH_GTK AND NOT HAVE_QT)
if(WITH_GTK3)
CHECK_MODULE(gtk+-3.0 HAVE_GTK3)
else()
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)")
endif()
else()
CHECK_MODULE(gtk+-3.0 HAVE_GTK3)
if(NOT HAVE_GTK3)
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")
endif()
if(WITH_OPENGL AND NOT HAVE_GTK3)
CHECK_MODULE(gtkglext-1.0 HAVE_GTKGLEXT)
endif()

@ -1,3 +1,4 @@
set(MIN_VER_CMAKE 2.8.7)
set(MIN_VER_PYTHON 2.6)
set(MIN_VER_ZLIB 1.2.3)
set(MIN_VER_GTK 2.18.0)

Loading…
Cancel
Save