CMake: Add GTK Printing support

See #22745
This commit is contained in:
Maarten Bent 2022-08-30 23:12:12 +02:00
parent 43aae40a11
commit 7f8cca9245
No known key found for this signature in database
GPG key ID: 58AAEE3F4A4FD070
3 changed files with 47 additions and 0 deletions

View file

@ -564,6 +564,19 @@ if(wxUSE_GUI)
set(wxUSE_LIBMSPACK OFF)
endif()
if(WXGTK AND wxUSE_PRINTING_ARCHITECTURE AND wxUSE_GTKPRINT)
find_package(GTKPRINT ${wxTOOLKIT_VERSION})
if(GTKPRINT_FOUND)
list(APPEND wxTOOLKIT_INCLUDE_DIRS ${GTKPRINT_INCLUDE_DIRS})
list(APPEND wxTOOLKIT_EXTRA "GTK+ printing")
else()
message(STATUS "GTK printing support not found (GTK+ >= 2.10), library will use GNOME printing support or standard PostScript printing")
wx_option_force_value(wxUSE_GTKPRINT OFF)
endif()
else()
set(wxUSE_GTKPRINT OFF)
endif()
if(WXGTK AND wxUSE_MIMETYPE AND wxUSE_LIBGNOMEVFS)
find_package(GNOMEVFS2)
if(GNOMEVFS2_FOUND)

View file

@ -0,0 +1,33 @@
# - Try to find GTK Print
# Provide the GTK version as argument
# Once done this will define
#
# GTKPRINT_FOUND - system has GTK Print
# GTKPRINT_INCLUDE_DIRS - The include directory to use for the GTK Print headers
if(NOT GTKPRINT_FIND_VERSION EQUAL GTKPRINT_FIND_VERSION_USED)
unset(GTKPRINT_FOUND CACHE)
unset(GTKPRINT_INCLUDE_DIRS CACHE)
unset(GTKPRINT_FIND_VERSION_USED CACHE)
endif()
set(GTKPRINT_FIND_VERSION_USED "${GTKPRINT_FIND_VERSION}" CACHE INTERNAL "")
if(GTKPRINT_FIND_VERSION VERSION_LESS 3.0)
set(GTKPRINT_LIB_NAME "gtk+-unix-print-2.0")
else()
set(GTKPRINT_LIB_NAME "gtk+-unix-print-3.0")
endif()
find_package(PkgConfig)
pkg_check_modules(PC_GTKPRINT QUIET ${GTKPRINT_LIB_NAME})
find_path(GTKPRINT_INCLUDE_DIRS
NAMES gtk/gtkunixprint.h
HINTS ${PC_GTKPRINT_INCLUDEDIR}
${PC_GTKPRINT_INCLUDE_DIRS}
)
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTKPRINT DEFAULT_MSG GTKPRINT_INCLUDE_DIRS)
mark_as_advanced(GTKPRINT_INCLUDE_DIRS)

View file

@ -127,6 +127,7 @@ if(UNIX)
wx_option(wxUSE_LIBNOTIFY "use libnotify for notifications")
wx_option(wxUSE_XTEST "use XTest extension")
wx_option(wxUSE_LIBMSPACK "use libmspack (CHM help files loading)")
wx_option(wxUSE_GTKPRINT "use GTK printing support")
wx_option(wxUSE_LIBGNOMEVFS "use GNOME VFS for associating MIME types")
wx_option(wxUSE_GLCANVAS_EGL "use EGL backend for wxGLCanvas")