[poppler] 10 commits - CMakeLists.txt cmake/modules glib/CMakeLists.txt glib/poppler-features.h.cmake poppler-glib.pc.cmake

Pino Toscano pino at kemper.freedesktop.org
Sun Mar 7 08:35:48 PST 2010


 CMakeLists.txt                |   42 +++++++++++++++++++--------
 cmake/modules/FindCairo.cmake |   64 ++++++++++++++++++++++++++----------------
 cmake/modules/FindGTK.cmake   |    7 +---
 glib/CMakeLists.txt           |   10 +++---
 glib/poppler-features.h.cmake |    2 -
 poppler-glib.pc.cmake         |    2 -
 6 files changed, 80 insertions(+), 47 deletions(-)

New commits:
commit bbcbb34fec10c90edd5960bdbcc6849bc8f39526
Author: Pino Toscano <pino at kde.org>
Date:   Sun Mar 7 17:34:40 2010 +0100

    [CMake] set POPPLER_GLIB_DISABLE_DEPRECATED and POPPLER_GLIB_DISABLE_SINGLE_INCLUDES as done with autotools

diff --git a/CMakeLists.txt b/CMakeLists.txt
index e1aaf3e..0a2b539 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -85,14 +85,20 @@ if(CAIRO_FOUND)
   set(HAVE_CAIRO ${CAIRO_FOUND})
   set(CAIRO_FEATURE "#define POPPLER_HAS_CAIRO 1")
   set(CAIRO_REQ "cairo")
+  set(POPPLER_GLIB_DISABLE_DEPRECATED "")
+  set(POPPLER_GLIB_DISABLE_SINGLE_INCLUDES "")
   macro_optional_find_package(GTK)
   if(GLIB_FOUND)
     set(ENABLE_GLIB ON)
     set(GLIB_REQ "glib-2.0 >= ${GLIB_VERSION} gobject-2.0 >= ${GLIB_VERSION} cairo >= ${CAIRO_VERSION}")
+    set(POPPLER_GLIB_DISABLE_DEPRECATED "${POPPLER_GLIB_DISABLE_DEPRECATED} -DG_DISABLE_DEPRECATED")
+    set(POPPLER_GLIB_DISABLE_SINGLE_INCLUDES "${POPPLER_GLIB_DISABLE_SINGLE_INCLUDES} -DG_DISABLE_SINGLE_INCLUDES")
     if(GDK_FOUND)
       set(GDK_REQ "gdk-2.0 gdk-pixbuf-2.0")
       set(POPPLER_WITH_GDK ${GDK_FOUND})
       set(GDK_FEATURE "#define POPPLER_WITH_GDK 1")
+      set(POPPLER_GLIB_DISABLE_DEPRECATED "${POPPLER_GLIB_DISABLE_DEPRECATED} -DGDK_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED")
+      set(POPPLER_GLIB_DISABLE_SINGLE_INCLUDES "${POPPLER_GLIB_DISABLE_SINGLE_INCLUDES} -DGTK_DISABLE_SINGLE_INCLUDES")
     endif(GDK_FOUND)
   endif(GLIB_FOUND)
 else(CAIRO_FOUND)
diff --git a/glib/CMakeLists.txt b/glib/CMakeLists.txt
index 8fa9ba2..c789cab 100644
--- a/glib/CMakeLists.txt
+++ b/glib/CMakeLists.txt
@@ -5,7 +5,11 @@ include_directories(
   ${CMAKE_CURRENT_BINARY_DIR}
   ${CAIRO_INCLUDE_DIRS}
 )
-add_definitions(${CAIRO_CFLAGS})
+add_definitions(
+  ${CAIRO_CFLAGS}
+  ${POPPLER_GLIB_DISABLE_DEPRECATED}
+  ${POPPLER_GLIB_DISABLE_SINGLE_INCLUDES}
+)
 
 if (GDK_FOUND)
   add_definitions(${GDK2_CFLAGS})
commit 190fa971c12ca1b3007f6ba349a77a7c15c47490
Author: Pino Toscano <pino at kde.org>
Date:   Sun Mar 7 17:24:25 2010 +0100

    reorder to match what's in the correspondent .in

diff --git a/glib/poppler-features.h.cmake b/glib/poppler-features.h.cmake
index ed5569c..99c7ed8 100644
--- a/glib/poppler-features.h.cmake
+++ b/glib/poppler-features.h.cmake
@@ -19,8 +19,8 @@
 #ifndef __POPPLER_FEATURES_H__
 #define __POPPLER_FEATURES_H__
 
- at GDK_FEATURE@
 @CAIRO_FEATURE@
+ at GDK_FEATURE@
 
 #define POPPLER_MAJOR_VERSION (@POPPLER_MAJOR_VERSION@)
 #define POPPLER_MINOR_VERSION (@POPPLER_MINOR_VERSION@)
commit ff46def8b178420a86a974ec2ce767a538bba8be
Author: Pino Toscano <pino at kde.org>
Date:   Sun Mar 7 17:23:16 2010 +0100

    [CMake] GDK_FEATURE is no more needed here

diff --git a/glib/CMakeLists.txt b/glib/CMakeLists.txt
index 39fbbaf..8fa9ba2 100644
--- a/glib/CMakeLists.txt
+++ b/glib/CMakeLists.txt
@@ -8,7 +8,6 @@ include_directories(
 add_definitions(${CAIRO_CFLAGS})
 
 if (GDK_FOUND)
-  set (GDK_FEATURE "#define POPPLER_WITH_GDK 1")
   add_definitions(${GDK2_CFLAGS})
 endif (GDK_FOUND)
 
commit 1eb8026a3060ef61a88c535177510f7ac7e7fc25
Author: Pino Toscano <pino at kde.org>
Date:   Sun Mar 7 17:19:58 2010 +0100

    [CMake] set in one place whether to build the glib frontend

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 680caa8..e1aaf3e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -87,6 +87,7 @@ if(CAIRO_FOUND)
   set(CAIRO_REQ "cairo")
   macro_optional_find_package(GTK)
   if(GLIB_FOUND)
+    set(ENABLE_GLIB ON)
     set(GLIB_REQ "glib-2.0 >= ${GLIB_VERSION} gobject-2.0 >= ${GLIB_VERSION} cairo >= ${CAIRO_VERSION}")
     if(GDK_FOUND)
       set(GDK_REQ "gdk-2.0 gdk-pixbuf-2.0")
@@ -467,9 +468,9 @@ endif(ENABLE_XPDF_HEADERS)
 if(ENABLE_UTILS)
   add_subdirectory(utils)
 endif(ENABLE_UTILS)
-if(GLIB_FOUND AND CAIRO_FOUND)
+if(ENABLE_GLIB)
   add_subdirectory(glib)
-endif(GLIB_FOUND AND CAIRO_FOUND)
+endif(ENABLE_GLIB)
 if(QT3_FOUND)
   add_subdirectory(qt)
 endif(QT3_FOUND)
@@ -504,9 +505,9 @@ endif(QT3_FOUND)
 if(QT4_FOUND)
   poppler_create_install_pkgconfig(poppler-qt4.pc lib${LIB_SUFFIX}/pkgconfig)
 endif(QT4_FOUND)
-if(GLIB_FOUND)
+if(ENABLE_GLIB)
   poppler_create_install_pkgconfig(poppler-glib.pc lib${LIB_SUFFIX}/pkgconfig)
-endif(GLIB_FOUND)
+endif(ENABLE_GLIB)
 if(CAIRO_FOUND)
   poppler_create_install_pkgconfig(poppler-cairo.pc lib${LIB_SUFFIX}/pkgconfig)
 endif(CAIRO_FOUND)
@@ -522,7 +523,7 @@ show_end_message_yesno("cairo output" CAIRO_FOUND)
 show_end_message_yesno("abiword output" ENABLE_ABIWORD)
 show_end_message_yesno("qt wrapper" QT3_FOUND)
 show_end_message_yesno("qt4 wrapper" QT4_FOUND)
-show_end_message_yesno("glib wrapper" GLIB_FOUND)
+show_end_message_yesno("glib wrapper" ENABLE_GLIB)
 show_end_message_yesno("  use GDK" POPPLER_WITH_GDK)
 # message("  use gtk-doc:        $enable_gtk_doc") # TODO
 show_end_message_yesno("cpp wrapper" ENABLE_CPP)
commit a1a6f23e2345814e147a72211ce9139555385223
Author: Pino Toscano <pino at kde.org>
Date:   Sun Mar 7 17:09:58 2010 +0100

    [CMake] correctly set the GLIB_REQ stuff

diff --git a/CMakeLists.txt b/CMakeLists.txt
index eff75de..680caa8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -87,6 +87,7 @@ if(CAIRO_FOUND)
   set(CAIRO_REQ "cairo")
   macro_optional_find_package(GTK)
   if(GLIB_FOUND)
+    set(GLIB_REQ "glib-2.0 >= ${GLIB_VERSION} gobject-2.0 >= ${GLIB_VERSION} cairo >= ${CAIRO_VERSION}")
     if(GDK_FOUND)
       set(GDK_REQ "gdk-2.0 gdk-pixbuf-2.0")
       set(POPPLER_WITH_GDK ${GDK_FOUND})
diff --git a/poppler-glib.pc.cmake b/poppler-glib.pc.cmake
index b6659fa..2a8bc66 100644
--- a/poppler-glib.pc.cmake
+++ b/poppler-glib.pc.cmake
@@ -6,7 +6,7 @@ includedir=${prefix}/include
 Name: poppler-glib
 Description: GLib wrapper for poppler
 Version: @POPPLER_VERSION@
-Requires: poppler-cairo = @POPPLER_VERSION@ gobject-2.0 @GDK_REQ@
+Requires: poppler-cairo = @POPPLER_VERSION@ @GLIB_REQ@ @GDK_REQ@
 @PC_REQUIRES_PRIVATE@
 
 Libs: -L${libdir} -lpoppler-glib
commit 0f2e5d6925c5938281d9bafc297a43867c4a915b
Author: Pino Toscano <pino at kde.org>
Date:   Sun Mar 7 17:03:21 2010 +0100

    [CMake] move the minimum GLib version to the main CMakeLists.txt

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2ab141a..eff75de 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -66,6 +66,7 @@ set(TEXTOUT_WORD_LIST ON)
 set(QT3_MIN_VERSION "3.3.0")
 set(QT4_MIN_VERSION "4.4.0")
 set(CAIRO_VERSION "1.8.4")
+set(GLIB_VERSION "2.18")
 
 macro_bool_to_01(ENABLE_SPLASH HAVE_SPLASH)
 find_package(Freetype REQUIRED)
diff --git a/cmake/modules/FindGTK.cmake b/cmake/modules/FindGTK.cmake
index 6d614ea..5dd7ea5 100644
--- a/cmake/modules/FindGTK.cmake
+++ b/cmake/modules/FindGTK.cmake
@@ -20,7 +20,7 @@ if (NOT WIN32)
   set (GLIB_FOUND FALSE)
   if (_LibGLIB2IncDir)
 
-    exec_program(${PKGCONFIG_EXECUTABLE} ARGS --atleast-version=2.18 glib-2.0 RETURN_VALUE _return_VALUE OUTPUT_VARIABLE _pkgconfigDevNull)
+    exec_program(${PKGCONFIG_EXECUTABLE} ARGS --atleast-version=${GLIB_VERSION} glib-2.0 RETURN_VALUE _return_VALUE OUTPUT_VARIABLE _pkgconfigDevNull)
     if(_return_VALUE STREQUAL "0")
       set(_glib_FOUND TRUE)
     endif(_return_VALUE STREQUAL "0")
commit efdffba45d15b538dbfb294403e99f3a6470b4d9
Author: Pino Toscano <pino at kde.org>
Date:   Sun Mar 7 16:58:27 2010 +0100

    [CMake] align the GDK stuff (GDK_{FEATURE,REQ}) to what done with autotools

diff --git a/CMakeLists.txt b/CMakeLists.txt
index d76d31c..2ab141a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -86,7 +86,11 @@ if(CAIRO_FOUND)
   set(CAIRO_REQ "cairo")
   macro_optional_find_package(GTK)
   if(GLIB_FOUND)
-    set(POPPLER_WITH_GDK ${GDK_FOUND})
+    if(GDK_FOUND)
+      set(GDK_REQ "gdk-2.0 gdk-pixbuf-2.0")
+      set(POPPLER_WITH_GDK ${GDK_FOUND})
+      set(GDK_FEATURE "#define POPPLER_WITH_GDK 1")
+    endif(GDK_FOUND)
   endif(GLIB_FOUND)
 else(CAIRO_FOUND)
   set(CAIRO_FEATURE "#undef POPPLER_HAS_CAIRO")
diff --git a/poppler-glib.pc.cmake b/poppler-glib.pc.cmake
index 90c8dea..b6659fa 100644
--- a/poppler-glib.pc.cmake
+++ b/poppler-glib.pc.cmake
@@ -6,7 +6,7 @@ includedir=${prefix}/include
 Name: poppler-glib
 Description: GLib wrapper for poppler
 Version: @POPPLER_VERSION@
-Requires: poppler-cairo = @POPPLER_VERSION@ gobject-2.0 gdk-2.0 gdk-pixbuf-2.0
+Requires: poppler-cairo = @POPPLER_VERSION@ gobject-2.0 @GDK_REQ@
 @PC_REQUIRES_PRIVATE@
 
 Libs: -L${libdir} -lpoppler-glib
commit cfecc69b7f05920f543ee7e9aafeafaa4c3506fb
Author: Pino Toscano <pino at kde.org>
Date:   Sun Mar 7 16:49:14 2010 +0100

    [CMake] apparently there's not a minimum version requirement for GDK, so drop the check

diff --git a/cmake/modules/FindGTK.cmake b/cmake/modules/FindGTK.cmake
index 0ec29f0..6d614ea 100644
--- a/cmake/modules/FindGTK.cmake
+++ b/cmake/modules/FindGTK.cmake
@@ -27,10 +27,7 @@ if (NOT WIN32)
   endif (_LibGLIB2IncDir)
 
   if (_LibGDK2IncDir)
-    exec_program(${PKGCONFIG_EXECUTABLE} ARGS --atleast-version=2.14 gdk-2.0 RETURN_VALUE _return_VALUE OUTPUT_VARIABLE _pkgconfigDevNull)
-    if(_return_VALUE STREQUAL "0")
-      set(_gdk_FOUND TRUE)
-    endif(_return_VALUE STREQUAL "0")
+    set(_gdk_FOUND TRUE)
   endif (_LibGDK2IncDir)
 
   if (_glib_FOUND)
commit 8ff1cf03d2607b0f13bbbbf272f2b03d8927bd24
Author: Pino Toscano <pino at kde.org>
Date:   Sun Mar 7 16:47:21 2010 +0100

    [CMake] first look for Cairo, then for GLib/GDK/GTK
    
    this starts to align to the searches done with autotools
    also, move the CAIRO_FEATURE to the main CMakeLists.txt

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9a96484..d76d31c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -79,15 +79,18 @@ if(JPEG_FOUND)
 endif(JPEG_FOUND)
 macro_optional_find_package(Qt3)
 macro_optional_find_package(Qt4)
-macro_optional_find_package(GTK)
-if(GLIB_FOUND)
-  macro_optional_find_package(Cairo ${CAIRO_VERSION})
+macro_optional_find_package(Cairo ${CAIRO_VERSION})
+if(CAIRO_FOUND)
   set(HAVE_CAIRO ${CAIRO_FOUND})
-  set(POPPLER_WITH_GDK ${GDK_FOUND})
-  if(CAIRO_FOUND)
-    set(CAIRO_REQ "cairo")
-  endif(CAIRO_FOUND)
-endif(GLIB_FOUND)
+  set(CAIRO_FEATURE "#define POPPLER_HAS_CAIRO 1")
+  set(CAIRO_REQ "cairo")
+  macro_optional_find_package(GTK)
+  if(GLIB_FOUND)
+    set(POPPLER_WITH_GDK ${GDK_FOUND})
+  endif(GLIB_FOUND)
+else(CAIRO_FOUND)
+  set(CAIRO_FEATURE "#undef POPPLER_HAS_CAIRO")
+endif(CAIRO_FOUND)
 if(ENABLE_CPP)
   macro_optional_find_package(Iconv)
   set(ENABLE_CPP ${ICONV_FOUND})
diff --git a/glib/CMakeLists.txt b/glib/CMakeLists.txt
index 3761c6f..39fbbaf 100644
--- a/glib/CMakeLists.txt
+++ b/glib/CMakeLists.txt
@@ -5,7 +5,6 @@ include_directories(
   ${CMAKE_CURRENT_BINARY_DIR}
   ${CAIRO_INCLUDE_DIRS}
 )
-set (CAIRO_FEATURE "#define POPPLER_HAS_CAIRO 1")
 add_definitions(${CAIRO_CFLAGS})
 
 if (GDK_FOUND)
commit bcaf62b8e252594530d3050761ba563cf3b1fb6e
Author: Pino Toscano <pino at kde.org>
Date:   Sun Mar 7 16:00:03 2010 +0100

    [CMake] enhance/rewrite a bit the FindCairo module
    
    make use of some features of CMake 2.6 (as we require it):
    - newer pkg-config handling (aka pkg_check_modules())
    - version checking for modules (PACKAGE_FIND_VERSION*)
    - find_package_handle_standard_args()
    also, after the pkg-config search to win32, search for cairo again (double-check plus real search for win32)
    furthermore, introduce CAIRO_INCLUDE_DIRS with the include paths requires (kind of "obsoletes" CAIRO_CFLAGS, left there in case it is used again)
    
    apply the changes to the rest of the build system (specify the version needed, use the correct variable for includes)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 18366a6..9a96484 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -81,7 +81,7 @@ macro_optional_find_package(Qt3)
 macro_optional_find_package(Qt4)
 macro_optional_find_package(GTK)
 if(GLIB_FOUND)
-  macro_optional_find_package(Cairo)
+  macro_optional_find_package(Cairo ${CAIRO_VERSION})
   set(HAVE_CAIRO ${CAIRO_FOUND})
   set(POPPLER_WITH_GDK ${GDK_FOUND})
   if(CAIRO_FOUND)
diff --git a/cmake/modules/FindCairo.cmake b/cmake/modules/FindCairo.cmake
index a0a8400..e3b65ec 100644
--- a/cmake/modules/FindCairo.cmake
+++ b/cmake/modules/FindCairo.cmake
@@ -3,42 +3,60 @@
 #
 #  CAIRO_FOUND - system has Cairo
 #  CAIRO_CFLAGS - the Cairo CFlags
+#  CAIRO_INCLUDE_DIRS - the Cairo include directories
 #  CAIRO_LIBRARIES - Link these to use Cairo
 #
-# Copyright (c) 2007, Pino Toscano, <pino at kde.org>
+# Copyright (C) 2007, 2010, Pino Toscano, <pino at kde.org>
 #
 # Redistribution and use is allowed according to the terms of the BSD license.
 # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
 
-if (NOT WIN32)
-  include(UsePkgConfig)
-
-  pkgconfig(cairo _LibCairoIncDir _LibCairoLinkDir _CairoLinkFlags _CairoCflags)
-  set (CAIRO_FOUND FALSE)
-  if (_LibCairoIncDir)
+if(CAIRO_INCLUDE_DIRS AND CAIRO_LIBRARIES)
+
+  # in cache already
+  set(CAIRO_FOUND TRUE)
+
+else(CAIRO_INCLUDE_DIRS AND CAIRO_LIBRARIES)
+
+if(NOT WIN32)
+  # use pkg-config to get the directories and then use these values
+  # in the FIND_PATH() and FIND_LIBRARY() calls
+  include(FindPkgConfig)
+  if(PACKAGE_FIND_VERSION_COUNT GREATER 0)
+    set(_cairo_version_cmp ">=${PACKAGE_FIND_VERSION}")
+  endif(PACKAGE_FIND_VERSION_COUNT GREATER 0)
+  pkg_check_modules(_pc_cairo cairo${_cairo_version_cmp})
+  if(_pc_cairo_FOUND)
+    set(CAIRO_FOUND TRUE)
+  endif(_pc_cairo_FOUND)
+else(NOT WIN32)
+  # assume so, for now
+  set(CAIRO_FOUND TRUE)
+endif(NOT WIN32)
 
-    if (CAIRO_VERSION)
+if(CAIRO_FOUND)
+  # set it back as false
+  set(CAIRO_FOUND FALSE)
 
-      exec_program(${PKGCONFIG_EXECUTABLE} ARGS --atleast-version=${CAIRO_VERSION} cairo RETURN_VALUE _return_VALUE OUTPUT_VARIABLE _pkgconfigDevNull)
-      if(_return_VALUE STREQUAL "0")
-        set (CAIRO_CFLAGS ${_CairoCflags})
-        set (CAIRO_LIBRARIES ${_CairoLinkFlags})
-      endif(_return_VALUE STREQUAL "0")
+  find_library(CAIRO_LIBRARY cairo
+               HINTS ${_pc_cairo_LIBRARY_DIRS}
+  )
+  set(CAIRO_LIBRARIES "${CAIRO_LIBRARY}")
 
-    else (CAIRO_VERSION)
-      set (CAIRO_CFLAGS ${_CairoCflags})
-      set (CAIRO_LIBRARIES ${_CairoLinkFlags})
-    endif (CAIRO_VERSION)
+  find_path(CAIRO_INCLUDE_DIR cairo.h
+            HINTS ${_pc_cairo_INCLUDE_DIRS}
+            PATH_SUFFIXES cairo
+  )
+  set(CAIRO_INCLUDE_DIRS "${CAIRO_INCLUDE_DIR}")
 
-    include(FindPackageHandleStandardArgs)
-    find_package_handle_standard_args(Cairo DEFAULT_MSG CAIRO_LIBRARIES CAIRO_CFLAGS)
+  include(FindPackageHandleStandardArgs)
+  find_package_handle_standard_args(Cairo DEFAULT_MSG CAIRO_LIBRARIES CAIRO_INCLUDE_DIRS)
+endif(CAIRO_FOUND)
 
-  endif (_LibCairoIncDir)
-
-endif(NOT WIN32)
+endif(CAIRO_INCLUDE_DIRS AND CAIRO_LIBRARIES)
 
 mark_as_advanced(
   CAIRO_CFLAGS
+  CAIRO_INCLUDE_DIRS
   CAIRO_LIBRARIES
 )
-
diff --git a/glib/CMakeLists.txt b/glib/CMakeLists.txt
index 3290377..3761c6f 100644
--- a/glib/CMakeLists.txt
+++ b/glib/CMakeLists.txt
@@ -3,8 +3,8 @@ add_definitions(-DG_LOG_DOMAIN=\"Poppler\" ${GLIB2_CFLAGS})
 include_directories(
   ${CMAKE_CURRENT_SOURCE_DIR}
   ${CMAKE_CURRENT_BINARY_DIR}
+  ${CAIRO_INCLUDE_DIRS}
 )
-include_directories(${CAIRO_INCLUDES})
 set (CAIRO_FEATURE "#define POPPLER_HAS_CAIRO 1")
 add_definitions(${CAIRO_CFLAGS})
 


More information about the poppler mailing list