2006-09-25 14:19:41 +00:00
|
|
|
# - Try to find the poppler PDF library
|
|
|
|
# Once done this will define
|
|
|
|
#
|
|
|
|
# POPPLER_FOUND - system has poppler
|
|
|
|
# POPPLER_INCLUDE_DIR - the poppler include directory
|
|
|
|
# POPPLER_LIBRARY - Link this to use poppler
|
|
|
|
#
|
|
|
|
|
2010-01-03 19:11:24 +00:00
|
|
|
# Copyright (c) 2006-2010, Pino Toscano, <pino@kde.org>
|
2007-04-04 18:15:48 +00:00
|
|
|
#
|
|
|
|
# Redistribution and use is allowed according to the terms of the BSD license.
|
|
|
|
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
|
|
|
|
|
|
|
if(POPPLER_INCLUDE_DIR AND POPPLER_LIBRARY)
|
|
|
|
|
|
|
|
# in cache already
|
2007-05-26 23:15:42 +00:00
|
|
|
set(POPPLER_FOUND TRUE)
|
2007-04-04 18:15:48 +00:00
|
|
|
|
|
|
|
else(POPPLER_INCLUDE_DIR AND POPPLER_LIBRARY)
|
|
|
|
|
2011-06-06 22:07:49 +00:00
|
|
|
set(_poppler_version_bad FALSE)
|
|
|
|
|
2010-01-03 19:11:24 +00:00
|
|
|
if(NOT WIN32)
|
2011-06-06 22:07:49 +00:00
|
|
|
# use pkg-config to get the directories and then use these values
|
|
|
|
# in the FIND_PATH() and FIND_LIBRARY() calls
|
2010-01-03 19:11:24 +00:00
|
|
|
include(FindPkgConfig)
|
|
|
|
pkg_check_modules(_pc_poppler poppler-qt4)
|
2011-06-06 22:07:49 +00:00
|
|
|
if(_pc_poppler_FOUND)
|
|
|
|
if(NOT "${_pc_poppler_VERSION}" VERSION_GREATER 0.5.3)
|
|
|
|
set(_poppler_version_bad TRUE)
|
|
|
|
endif(NOT "${_pc_poppler_VERSION}" VERSION_GREATER 0.5.3)
|
|
|
|
endif(_pc_poppler_FOUND)
|
2010-01-03 19:11:24 +00:00
|
|
|
endif(NOT WIN32)
|
|
|
|
|
2011-06-06 22:07:49 +00:00
|
|
|
if(NOT _poppler_version_bad)
|
2010-01-03 19:11:24 +00:00
|
|
|
set(POPPLER_FOUND FALSE)
|
|
|
|
|
|
|
|
find_library(POPPLER_LIBRARY poppler-qt4
|
|
|
|
HINTS ${_pc_poppler_LIBRARY_DIRS}
|
|
|
|
)
|
|
|
|
|
|
|
|
find_path(POPPLER_INCLUDE_DIR poppler-qt4.h
|
|
|
|
HINTS ${_pc_poppler_INCLUDE_DIRS}
|
|
|
|
PATH_SUFFIXES poppler/qt4
|
|
|
|
)
|
|
|
|
find_path(POPPLER_INCLUDE_DIR_core qt4/poppler-qt4.h
|
|
|
|
HINTS ${_pc_poppler_INCLUDE_DIRS}
|
|
|
|
PATH_SUFFIXES poppler
|
|
|
|
)
|
|
|
|
|
|
|
|
if(POPPLER_LIBRARY AND POPPLER_INCLUDE_DIR AND POPPLER_INCLUDE_DIR_core)
|
|
|
|
list(APPEND POPPLER_INCLUDE_DIR "${POPPLER_INCLUDE_DIR_core}")
|
|
|
|
set(POPPLER_FOUND TRUE)
|
|
|
|
endif(POPPLER_LIBRARY AND POPPLER_INCLUDE_DIR AND POPPLER_INCLUDE_DIR_core)
|
2011-06-06 22:07:49 +00:00
|
|
|
endif(NOT _poppler_version_bad)
|
2006-09-25 14:19:41 +00:00
|
|
|
|
|
|
|
if (POPPLER_FOUND)
|
2011-06-06 22:07:49 +00:00
|
|
|
include(CheckCXXSourceCompiles)
|
2009-09-16 17:21:52 +00:00
|
|
|
|
2007-05-25 23:57:03 +00:00
|
|
|
# check whether we're using poppler 0.6
|
2007-05-26 23:15:42 +00:00
|
|
|
set(CMAKE_REQUIRED_INCLUDES ${POPPLER_INCLUDE_DIR} ${QT_INCLUDE_DIR})
|
2006-10-09 17:54:24 +00:00
|
|
|
set(CMAKE_REQUIRED_LIBRARIES ${POPPLER_LIBRARY} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTXML_LIBRARY})
|
2011-06-06 22:07:49 +00:00
|
|
|
|
2009-10-08 21:55:51 +00:00
|
|
|
check_cxx_source_compiles("
|
|
|
|
#include <poppler-qt4.h>
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
Poppler::Document::RenderHint hint = Poppler::Document::TextHinting;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
" HAVE_POPPLER_0_12_1)
|
2011-06-06 22:07:49 +00:00
|
|
|
|
2010-12-28 00:11:34 +00:00
|
|
|
check_cxx_source_compiles("
|
|
|
|
#include <poppler-qt4.h>
|
|
|
|
|
|
|
|
void debugFunction(const QString &message, const QVariant &closure)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
Poppler::setDebugErrorFunction(debugFunction, QVariant());
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
" HAVE_POPPLER_0_16)
|
2011-06-06 22:07:49 +00:00
|
|
|
|
2012-03-22 17:35:33 +00:00
|
|
|
check_cxx_source_compiles("
|
|
|
|
#include <poppler-qt4.h>
|
|
|
|
#include <poppler-media.h>
|
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
Poppler::ScreenAnnotation *annot = 0;
|
|
|
|
Poppler::LinkRendition *link = 0;
|
2012-04-03 12:18:10 +00:00
|
|
|
const Poppler::LinkMovie::Operation operation = Poppler::LinkMovie::Play;
|
2012-03-22 17:35:33 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
" HAVE_POPPLER_0_20)
|
|
|
|
|
2012-06-29 09:16:28 +00:00
|
|
|
check_cxx_source_compiles("
|
|
|
|
#include <poppler-qt4.h>
|
2012-08-16 09:53:58 +00:00
|
|
|
#include <poppler-annotation.h>
|
2012-10-28 16:38:21 +00:00
|
|
|
#include <poppler-link.h>
|
2012-06-29 09:16:28 +00:00
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
Poppler::MovieObject *movie = 0;
|
2012-11-03 17:19:14 +00:00
|
|
|
Poppler::Document *doc = 0;
|
2012-06-29 09:16:28 +00:00
|
|
|
movie->showPosterImage();
|
2012-08-16 09:53:58 +00:00
|
|
|
|
|
|
|
const Poppler::Annotation::AdditionalActionType type = Poppler::Annotation::PageOpeningAction;
|
2012-10-28 16:38:21 +00:00
|
|
|
const Poppler::LinkRendition::RenditionAction action = Poppler::LinkRendition::NoRendition;
|
2012-11-03 17:19:14 +00:00
|
|
|
const Poppler::Document::FormType formType = doc->formType();
|
2012-08-16 09:53:58 +00:00
|
|
|
|
2012-06-29 09:16:28 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
" HAVE_POPPLER_0_22)
|
|
|
|
|
2013-02-23 23:37:11 +00:00
|
|
|
check_cxx_source_compiles("
|
|
|
|
#include <poppler-qt4.h>
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
Poppler::Document::RenderHint hint = Poppler::Document::ThinLineSolid;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
" HAVE_POPPLER_0_24)
|
|
|
|
|
2014-05-11 16:43:50 +00:00
|
|
|
check_cxx_source_compiles("
|
|
|
|
#include <poppler-qt4.h>
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
Poppler::Page *p = 0;
|
|
|
|
p->annotations( QSet<Poppler::Annotation::SubType>() << Poppler::Annotation::ASound );
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
" HAVE_POPPLER_0_28)
|
|
|
|
|
2015-10-14 22:16:55 +00:00
|
|
|
check_cxx_source_compiles("
|
|
|
|
#include <poppler-qt4.h>
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
Poppler::PageTransition *p = 0;
|
|
|
|
return p->durationReal();
|
|
|
|
}
|
|
|
|
" HAVE_POPPLER_0_37)
|
|
|
|
|
2006-10-09 17:54:24 +00:00
|
|
|
set(CMAKE_REQUIRED_INCLUDES)
|
|
|
|
set(CMAKE_REQUIRED_LIBRARIES)
|
2015-10-14 22:16:55 +00:00
|
|
|
if (HAVE_POPPLER_0_37)
|
|
|
|
set(popplerVersionMessage "0.37")
|
|
|
|
elseif (HAVE_POPPLER_0_28)
|
2014-05-11 16:43:50 +00:00
|
|
|
set(popplerVersionMessage "0.28")
|
|
|
|
elseif (HAVE_POPPLER_0_24)
|
2013-02-23 23:37:11 +00:00
|
|
|
set(popplerVersionMessage "0.24")
|
|
|
|
elseif (HAVE_POPPLER_0_22)
|
2012-06-29 09:16:28 +00:00
|
|
|
set(popplerVersionMessage "0.22")
|
|
|
|
elseif (HAVE_POPPLER_0_20)
|
2012-03-22 17:35:33 +00:00
|
|
|
set(popplerVersionMessage "0.20")
|
|
|
|
elseif (HAVE_POPPLER_0_16)
|
2010-12-28 00:11:34 +00:00
|
|
|
set(popplerVersionMessage "0.16")
|
|
|
|
elseif (HAVE_POPPLER_0_12_1)
|
2009-10-08 21:55:51 +00:00
|
|
|
set(popplerVersionMessage "0.12.1")
|
2014-05-11 16:43:50 +00:00
|
|
|
else (HAVE_POPPLER_0_28)
|
2009-03-18 14:27:23 +00:00
|
|
|
set(popplerVersionMessage "0.5.4")
|
2014-05-11 16:43:50 +00:00
|
|
|
endif (HAVE_POPPLER_0_28)
|
2007-03-14 15:12:10 +00:00
|
|
|
if (NOT Poppler_FIND_QUIETLY)
|
2009-03-18 14:27:23 +00:00
|
|
|
message(STATUS "Found Poppler-Qt4: ${POPPLER_LIBRARY}, (>= ${popplerVersionMessage})")
|
2007-03-14 15:12:10 +00:00
|
|
|
endif (NOT Poppler_FIND_QUIETLY)
|
2006-09-25 14:19:41 +00:00
|
|
|
else (POPPLER_FOUND)
|
2007-03-14 15:12:10 +00:00
|
|
|
if (Poppler_FIND_REQUIRED)
|
2007-05-25 23:57:03 +00:00
|
|
|
message(FATAL_ERROR "Could NOT find Poppler-Qt4")
|
2007-03-14 15:12:10 +00:00
|
|
|
endif (Poppler_FIND_REQUIRED)
|
2007-12-20 02:34:26 +00:00
|
|
|
message(STATUS "Could not find OPTIONAL package Poppler-Qt4")
|
2006-09-25 14:19:41 +00:00
|
|
|
endif (POPPLER_FOUND)
|
|
|
|
|
2007-05-26 23:15:42 +00:00
|
|
|
# ensure that they are cached
|
|
|
|
set(POPPLER_INCLUDE_DIR ${POPPLER_INCLUDE_DIR} CACHE INTERNAL "The Poppler-Qt4 include path")
|
|
|
|
set(POPPLER_LIBRARY ${POPPLER_LIBRARY} CACHE INTERNAL "The Poppler-Qt4 library")
|
2009-10-08 21:55:51 +00:00
|
|
|
set(HAVE_POPPLER_0_12_1 ${HAVE_POPPLER_0_12_1} CACHE INTERNAL "Whether the version of Poppler-Qt4 is >= 0.12.1")
|
2007-04-04 18:15:48 +00:00
|
|
|
|
|
|
|
endif(POPPLER_INCLUDE_DIR AND POPPLER_LIBRARY)
|