mirror of
https://github.com/JakubMelka/PDF4QT.git
synced 2025-02-11 01:00:35 +01:00
Issue #118: Adding CMAKE options for minimal builds
This commit is contained in:
parent
2d1e1dc479
commit
1a10401b91
@ -32,6 +32,8 @@ if(WIN32 AND MSVC)
|
|||||||
option(PDF4QT_INSTALL_PREPARE_WIX_INSTALLER "Prepare Wix installer for Windows" ON)
|
option(PDF4QT_INSTALL_PREPARE_WIX_INSTALLER "Prepare Wix installer for Windows" ON)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
option(PDF4QT_ENABLE_OPENGL "Enable OpenGL" ON)
|
||||||
|
|
||||||
set(PDF4QT_QT_ROOT "" CACHE PATH "Qt root directory")
|
set(PDF4QT_QT_ROOT "" CACHE PATH "Qt root directory")
|
||||||
|
|
||||||
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
||||||
@ -43,7 +45,13 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|||||||
|
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets Svg Xml PrintSupport TextToSpeech OpenGL OpenGLWidgets Multimedia Network Test)
|
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets Svg Xml PrintSupport TextToSpeech Multimedia Network Test)
|
||||||
|
|
||||||
|
if(PDF4QT_ENABLE_OPENGL)
|
||||||
|
add_compile_definitions(PDF4QT_ENABLE_OPENGL)
|
||||||
|
find_package(Qt6 REQUIRED COMPONENTS OpenGL OpenGLWidgets)
|
||||||
|
endif()
|
||||||
|
|
||||||
qt_standard_project_setup()
|
qt_standard_project_setup()
|
||||||
|
|
||||||
find_package(OpenSSL REQUIRED)
|
find_package(OpenSSL REQUIRED)
|
||||||
@ -80,7 +88,7 @@ if (LINUX_GCC)
|
|||||||
find_package(TBB REQUIRED)
|
find_package(TBB REQUIRED)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
option(PDF4QT_INSTALL_TO_USR "Install to usr directory" OFF)
|
option(PDF4QT_INSTALL_TO_USR "Install to usr directory" ON)
|
||||||
|
|
||||||
if(PDF4QT_LINUX)
|
if(PDF4QT_LINUX)
|
||||||
set(PDF4QT_INSTALL_LIB_DIR_IMPL lib)
|
set(PDF4QT_INSTALL_LIB_DIR_IMPL lib)
|
||||||
|
@ -30,7 +30,11 @@ add_executable(Pdf4QtDocDiff
|
|||||||
icon.rc
|
icon.rc
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(Pdf4QtDocDiff PRIVATE Pdf4QtLib Qt6::Core Qt6::Gui Qt6::Widgets Qt6::OpenGLWidgets)
|
if(PDF4QT_ENABLE_OPENGL)
|
||||||
|
target_link_libraries(Pdf4QtDocDiff PRIVATE Pdf4QtLib Qt6::OpenGLWidgets)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
target_link_libraries(Pdf4QtDocDiff PRIVATE Pdf4QtLib Qt6::Core Qt6::Gui Qt6::Widgets)
|
||||||
|
|
||||||
set_target_properties(Pdf4QtDocDiff PROPERTIES
|
set_target_properties(Pdf4QtDocDiff PROPERTIES
|
||||||
WIN32_EXECUTABLE ON
|
WIN32_EXECUTABLE ON
|
||||||
|
@ -114,7 +114,11 @@ GENERATE_EXPORT_HEADER(Pdf4QtLib
|
|||||||
PDF4QTLIBSHARED_EXPORT
|
PDF4QTLIBSHARED_EXPORT
|
||||||
EXPORT_FILE_NAME "${CMAKE_BINARY_DIR}/${INSTALL_INCLUDEDIR}/pdf4qtlib_export.h")
|
EXPORT_FILE_NAME "${CMAKE_BINARY_DIR}/${INSTALL_INCLUDEDIR}/pdf4qtlib_export.h")
|
||||||
|
|
||||||
target_link_libraries(Pdf4QtLib PRIVATE Qt6::Core Qt6::Gui Qt6::Widgets Qt6::Xml Qt6::Svg Qt6::OpenGLWidgets)
|
if(PDF4QT_ENABLE_OPENGL)
|
||||||
|
target_link_libraries(Pdf4QtLib PRIVATE Qt6::OpenGLWidgets)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
target_link_libraries(Pdf4QtLib PRIVATE Qt6::Core Qt6::Gui Qt6::Widgets Qt6::Xml Qt6::Svg)
|
||||||
target_link_libraries(Pdf4QtLib PRIVATE lcms2::lcms2)
|
target_link_libraries(Pdf4QtLib PRIVATE lcms2::lcms2)
|
||||||
target_link_libraries(Pdf4QtLib PRIVATE OpenSSL::SSL OpenSSL::Crypto)
|
target_link_libraries(Pdf4QtLib PRIVATE OpenSSL::SSL OpenSSL::Crypto)
|
||||||
target_link_libraries(Pdf4QtLib PRIVATE ZLIB::ZLIB)
|
target_link_libraries(Pdf4QtLib PRIVATE ZLIB::ZLIB)
|
||||||
|
@ -107,6 +107,7 @@ void PDFWidget::updateRenderer(RendererEngine engine, int samplesCount)
|
|||||||
setFocusProxy(m_drawWidget->getWidget());
|
setFocusProxy(m_drawWidget->getWidget());
|
||||||
connect(m_proxy, &PDFDrawWidgetProxy::repaintNeeded, m_drawWidget->getWidget(), QOverload<>::of(&QWidget::update));
|
connect(m_proxy, &PDFDrawWidgetProxy::repaintNeeded, m_drawWidget->getWidget(), QOverload<>::of(&QWidget::update));
|
||||||
}
|
}
|
||||||
|
#ifdef PDF4QT_ENABLE_OPENGL
|
||||||
else if (openglDrawWidget)
|
else if (openglDrawWidget)
|
||||||
{
|
{
|
||||||
// Just check the samples count
|
// Just check the samples count
|
||||||
@ -117,6 +118,8 @@ void PDFWidget::updateRenderer(RendererEngine engine, int samplesCount)
|
|||||||
openglDrawWidget->setFormat(format);
|
openglDrawWidget->setFormat(format);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
updateRendererImpl();
|
updateRendererImpl();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,8 +142,12 @@ int PDFWidget::getPageRenderingErrorCount() const
|
|||||||
|
|
||||||
void PDFWidget::updateRendererImpl()
|
void PDFWidget::updateRendererImpl()
|
||||||
{
|
{
|
||||||
|
#ifdef PDF4QT_ENABLE_OPENGL
|
||||||
PDFOpenGLDrawWidget* openglDrawWidget = qobject_cast<PDFOpenGLDrawWidget*>(m_drawWidget->getWidget());
|
PDFOpenGLDrawWidget* openglDrawWidget = qobject_cast<PDFOpenGLDrawWidget*>(m_drawWidget->getWidget());
|
||||||
m_proxy->updateRenderer(openglDrawWidget != nullptr, openglDrawWidget ? openglDrawWidget->format() : QSurfaceFormat::defaultFormat());
|
m_proxy->updateRenderer(openglDrawWidget != nullptr, openglDrawWidget ? openglDrawWidget->format() : QSurfaceFormat::defaultFormat());
|
||||||
|
#else
|
||||||
|
m_proxy->updateRenderer(false, QSurfaceFormat::defaultFormat());
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void PDFWidget::onRenderingError(PDFInteger pageIndex, const QList<PDFRenderError>& errors)
|
void PDFWidget::onRenderingError(PDFInteger pageIndex, const QList<PDFRenderError>& errors)
|
||||||
@ -181,7 +188,12 @@ IDrawWidget* PDFWidget::createDrawWidget(RendererEngine rendererEngine, int samp
|
|||||||
return new PDFDrawWidget(this, this);
|
return new PDFDrawWidget(this, this);
|
||||||
|
|
||||||
case RendererEngine::OpenGL:
|
case RendererEngine::OpenGL:
|
||||||
|
#ifdef PDF4QT_ENABLE_OPENGL
|
||||||
return new PDFOpenGLDrawWidget(this, samplesCount, this);
|
return new PDFOpenGLDrawWidget(this, samplesCount, this);
|
||||||
|
#else
|
||||||
|
Q_UNUSED(samplesCount);
|
||||||
|
return new PDFDrawWidget(this, this);
|
||||||
|
#endif
|
||||||
|
|
||||||
default:
|
default:
|
||||||
Q_ASSERT(false);
|
Q_ASSERT(false);
|
||||||
@ -573,6 +585,7 @@ void PDFDrawWidgetBase<BaseWidget>::wheelEvent(QWheelEvent* event)
|
|||||||
event->accept();
|
event->accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef PDF4QT_ENABLE_OPENGL
|
||||||
PDFOpenGLDrawWidget::PDFOpenGLDrawWidget(PDFWidget* widget, int samplesCount, QWidget* parent) :
|
PDFOpenGLDrawWidget::PDFOpenGLDrawWidget(PDFWidget* widget, int samplesCount, QWidget* parent) :
|
||||||
BaseClass(widget, parent)
|
BaseClass(widget, parent)
|
||||||
{
|
{
|
||||||
@ -609,6 +622,7 @@ void PDFOpenGLDrawWidget::paintGL()
|
|||||||
getPDFWidget()->getDrawWidgetProxy()->draw(&painter, this->rect());
|
getPDFWidget()->getDrawWidgetProxy()->draw(&painter, this->rect());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
PDFDrawWidget::PDFDrawWidget(PDFWidget* widget, QWidget* parent) :
|
PDFDrawWidget::PDFDrawWidget(PDFWidget* widget, QWidget* parent) :
|
||||||
BaseClass(widget, parent)
|
BaseClass(widget, parent)
|
||||||
@ -636,7 +650,9 @@ void PDFDrawWidget::resizeEvent(QResizeEvent* event)
|
|||||||
getPDFWidget()->getDrawWidgetProxy()->update();
|
getPDFWidget()->getDrawWidgetProxy()->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef PDF4QT_ENABLE_OPENGL
|
||||||
template class PDFDrawWidgetBase<QOpenGLWidget>;
|
template class PDFDrawWidgetBase<QOpenGLWidget>;
|
||||||
|
#endif
|
||||||
template class PDFDrawWidgetBase<QWidget>;
|
template class PDFDrawWidgetBase<QWidget>;
|
||||||
|
|
||||||
} // namespace pdf
|
} // namespace pdf
|
||||||
|
@ -23,7 +23,10 @@
|
|||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QScrollBar>
|
#include <QScrollBar>
|
||||||
|
|
||||||
|
#ifdef PDF4QT_ENABLE_OPENGL
|
||||||
#include <QOpenGLWidget>
|
#include <QOpenGLWidget>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace pdf
|
namespace pdf
|
||||||
{
|
{
|
||||||
@ -176,23 +179,6 @@ private:
|
|||||||
MouseOperation m_mouseOperation;
|
MouseOperation m_mouseOperation;
|
||||||
};
|
};
|
||||||
|
|
||||||
class PDFOpenGLDrawWidget : public PDFDrawWidgetBase<QOpenGLWidget>
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
private:
|
|
||||||
using BaseClass = PDFDrawWidgetBase<QOpenGLWidget>;
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit PDFOpenGLDrawWidget(PDFWidget* widget, int samplesCount, QWidget* parent);
|
|
||||||
virtual ~PDFOpenGLDrawWidget() override;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual void resizeGL(int w, int h) override;
|
|
||||||
virtual void initializeGL() override;
|
|
||||||
virtual void paintGL() override;
|
|
||||||
};
|
|
||||||
|
|
||||||
class PDFDrawWidget : public PDFDrawWidgetBase<QWidget>
|
class PDFDrawWidget : public PDFDrawWidgetBase<QWidget>
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -209,7 +195,30 @@ protected:
|
|||||||
virtual void resizeEvent(QResizeEvent* event) override;
|
virtual void resizeEvent(QResizeEvent* event) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef PDF4QT_ENABLE_OPENGL
|
||||||
|
class PDFOpenGLDrawWidget : public PDFDrawWidgetBase<QOpenGLWidget>
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
private:
|
||||||
|
using BaseClass = PDFDrawWidgetBase<QOpenGLWidget>;
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit PDFOpenGLDrawWidget(PDFWidget* widget, int samplesCount, QWidget* parent);
|
||||||
|
virtual ~PDFOpenGLDrawWidget() override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void resizeGL(int w, int h) override;
|
||||||
|
virtual void initializeGL() override;
|
||||||
|
virtual void paintGL() override;
|
||||||
|
};
|
||||||
|
#else
|
||||||
|
using PDFOpenGLDrawWidget = PDFDrawWidget;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PDF4QT_ENABLE_OPENGL
|
||||||
extern template class PDFDrawWidgetBase<QOpenGLWidget>;
|
extern template class PDFDrawWidgetBase<QOpenGLWidget>;
|
||||||
|
#endif
|
||||||
extern template class PDFDrawWidgetBase<QWidget>;
|
extern template class PDFDrawWidgetBase<QWidget>;
|
||||||
|
|
||||||
} // namespace pdf
|
} // namespace pdf
|
||||||
|
@ -25,11 +25,14 @@
|
|||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QElapsedTimer>
|
#include <QElapsedTimer>
|
||||||
|
|
||||||
|
#ifdef PDF4QT_ENABLE_OPENGL
|
||||||
#include <QOpenGLContext>
|
#include <QOpenGLContext>
|
||||||
#include <QOffscreenSurface>
|
#include <QOffscreenSurface>
|
||||||
#include <QOpenGLPaintDevice>
|
#include <QOpenGLPaintDevice>
|
||||||
#include <QOpenGLFramebufferObject>
|
#include <QOpenGLFramebufferObject>
|
||||||
#include <QOpenGLFunctions>
|
#include <QOpenGLFunctions>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace pdf
|
namespace pdf
|
||||||
{
|
{
|
||||||
@ -222,18 +225,24 @@ void PDFRenderer::compile(PDFPrecompiledPage* precompiledPage, size_t pageIndex)
|
|||||||
|
|
||||||
PDFRasterizer::PDFRasterizer(QObject* parent) :
|
PDFRasterizer::PDFRasterizer(QObject* parent) :
|
||||||
BaseClass(parent),
|
BaseClass(parent),
|
||||||
|
#ifdef PDF4QT_ENABLE_OPENGL
|
||||||
m_features(),
|
m_features(),
|
||||||
m_surfaceFormat(),
|
m_surfaceFormat(),
|
||||||
m_surface(nullptr),
|
m_surface(nullptr),
|
||||||
m_context(nullptr),
|
m_context(nullptr),
|
||||||
m_fbo(nullptr)
|
m_fbo(nullptr)
|
||||||
|
#else
|
||||||
|
m_features()
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PDFRasterizer::~PDFRasterizer()
|
PDFRasterizer::~PDFRasterizer()
|
||||||
{
|
{
|
||||||
|
#ifdef PDF4QT_ENABLE_OPENGL
|
||||||
releaseOpenGL();
|
releaseOpenGL();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void PDFRasterizer::reset(bool useOpenGL, const QSurfaceFormat& surfaceFormat)
|
void PDFRasterizer::reset(bool useOpenGL, const QSurfaceFormat& surfaceFormat)
|
||||||
@ -244,6 +253,7 @@ void PDFRasterizer::reset(bool useOpenGL, const QSurfaceFormat& surfaceFormat)
|
|||||||
m_features.setFlag(ValidOpenGL, false);
|
m_features.setFlag(ValidOpenGL, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef PDF4QT_ENABLE_OPENGL
|
||||||
if (useOpenGL != m_features.testFlag(UseOpenGL) || surfaceFormat != m_surfaceFormat)
|
if (useOpenGL != m_features.testFlag(UseOpenGL) || surfaceFormat != m_surfaceFormat)
|
||||||
{
|
{
|
||||||
// In either case, we must reset OpenGL
|
// In either case, we must reset OpenGL
|
||||||
@ -259,6 +269,10 @@ void PDFRasterizer::reset(bool useOpenGL, const QSurfaceFormat& surfaceFormat)
|
|||||||
initializeOpenGL();
|
initializeOpenGL();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
Q_UNUSED(surfaceFormat);
|
||||||
|
m_features.setFlag(UseOpenGL, useOpenGL);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QImage PDFRasterizer::render(PDFInteger pageIndex,
|
QImage PDFRasterizer::render(PDFInteger pageIndex,
|
||||||
@ -272,6 +286,8 @@ QImage PDFRasterizer::render(PDFInteger pageIndex,
|
|||||||
QImage image;
|
QImage image;
|
||||||
|
|
||||||
QTransform matrix = PDFRenderer::createPagePointToDevicePointMatrix(page, QRect(QPoint(0, 0), size), extraRotation);
|
QTransform matrix = PDFRenderer::createPagePointToDevicePointMatrix(page, QRect(QPoint(0, 0), size), extraRotation);
|
||||||
|
|
||||||
|
#ifdef PDF4QT_ENABLE_OPENGL
|
||||||
if (m_features.testFlag(UseOpenGL) && m_features.testFlag(ValidOpenGL))
|
if (m_features.testFlag(UseOpenGL) && m_features.testFlag(ValidOpenGL))
|
||||||
{
|
{
|
||||||
// We have valid OpenGL context, try to select it and possibly create framebuffer object
|
// We have valid OpenGL context, try to select it and possibly create framebuffer object
|
||||||
@ -324,6 +340,7 @@ QImage PDFRasterizer::render(PDFInteger pageIndex,
|
|||||||
m_context->doneCurrent();
|
m_context->doneCurrent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (image.isNull())
|
if (image.isNull())
|
||||||
{
|
{
|
||||||
@ -361,6 +378,7 @@ QImage PDFRasterizer::render(PDFInteger pageIndex,
|
|||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef PDF4QT_ENABLE_OPENGL
|
||||||
void PDFRasterizer::initializeOpenGL()
|
void PDFRasterizer::initializeOpenGL()
|
||||||
{
|
{
|
||||||
Q_ASSERT(!m_surface);
|
Q_ASSERT(!m_surface);
|
||||||
@ -408,7 +426,9 @@ void PDFRasterizer::initializeOpenGL()
|
|||||||
releaseOpenGL();
|
releaseOpenGL();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PDF4QT_ENABLE_OPENGL
|
||||||
void PDFRasterizer::releaseOpenGL()
|
void PDFRasterizer::releaseOpenGL()
|
||||||
{
|
{
|
||||||
if (m_surface)
|
if (m_surface)
|
||||||
@ -437,6 +457,7 @@ void PDFRasterizer::releaseOpenGL()
|
|||||||
m_features.setFlag(ValidOpenGL, false);
|
m_features.setFlag(ValidOpenGL, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
PDFRasterizer* PDFRasterizerPool::acquire()
|
PDFRasterizer* PDFRasterizerPool::acquire()
|
||||||
{
|
{
|
||||||
@ -983,6 +1004,7 @@ const PDFRendererInfo::Info& PDFRendererInfo::getHardwareAccelerationSupportedIn
|
|||||||
{
|
{
|
||||||
Info info;
|
Info info;
|
||||||
|
|
||||||
|
#ifdef PDF4QT_ENABLE_OPENGL
|
||||||
QOffscreenSurface surface;
|
QOffscreenSurface surface;
|
||||||
surface.create();
|
surface.create();
|
||||||
|
|
||||||
@ -1044,6 +1066,7 @@ const PDFRendererInfo::Info& PDFRendererInfo::getHardwareAccelerationSupportedIn
|
|||||||
info.majorOpenGLVersion = versionStrSplitted[0].toInt();
|
info.majorOpenGLVersion = versionStrSplitted[0].toInt();
|
||||||
info.minorOpenGLVersion = versionStrSplitted[1].toInt();
|
info.minorOpenGLVersion = versionStrSplitted[1].toInt();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return info;
|
return info;
|
||||||
};
|
};
|
||||||
@ -1053,8 +1076,12 @@ const PDFRendererInfo::Info& PDFRendererInfo::getHardwareAccelerationSupportedIn
|
|||||||
|
|
||||||
bool PDFRendererInfo::isHardwareAccelerationSupported()
|
bool PDFRendererInfo::isHardwareAccelerationSupported()
|
||||||
{
|
{
|
||||||
|
#ifdef PDF4QT_ENABLE_OPENGL
|
||||||
const Info& info = getHardwareAccelerationSupportedInfo();
|
const Info& info = getHardwareAccelerationSupportedInfo();
|
||||||
return std::make_pair(info.majorOpenGLVersion, info.minorOpenGLVersion) >= std::make_pair(REQUIRED_OPENGL_MAJOR_VERSION, REQUIRED_OPENGL_MINOR_VERSION);
|
return std::make_pair(info.majorOpenGLVersion, info.minorOpenGLVersion) >= std::make_pair(REQUIRED_OPENGL_MAJOR_VERSION, REQUIRED_OPENGL_MINOR_VERSION);
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace pdf
|
} // namespace pdf
|
||||||
|
@ -217,14 +217,18 @@ public:
|
|||||||
PageRotation extraRotation);
|
PageRotation extraRotation);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
#ifdef PDF4QT_ENABLE_OPENGL
|
||||||
void initializeOpenGL();
|
void initializeOpenGL();
|
||||||
void releaseOpenGL();
|
void releaseOpenGL();
|
||||||
|
#endif
|
||||||
|
|
||||||
Features m_features;
|
Features m_features;
|
||||||
|
#ifdef PDF4QT_ENABLE_OPENGL
|
||||||
QSurfaceFormat m_surfaceFormat;
|
QSurfaceFormat m_surfaceFormat;
|
||||||
QOffscreenSurface* m_surface;
|
QOffscreenSurface* m_surface;
|
||||||
QOpenGLContext* m_context;
|
QOpenGLContext* m_context;
|
||||||
QOpenGLFramebufferObject* m_fbo;
|
QOpenGLFramebufferObject* m_fbo;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Simple structure for storing rendered page images
|
/// Simple structure for storing rendered page images
|
||||||
|
@ -62,7 +62,11 @@ GENERATE_EXPORT_HEADER(Pdf4QtViewer
|
|||||||
PDF4QTVIEWERLIBSHARED_EXPORT
|
PDF4QTVIEWERLIBSHARED_EXPORT
|
||||||
EXPORT_FILE_NAME "${CMAKE_BINARY_DIR}/${INSTALL_INCLUDEDIR}/pdf4qtviewer_export.h")
|
EXPORT_FILE_NAME "${CMAKE_BINARY_DIR}/${INSTALL_INCLUDEDIR}/pdf4qtviewer_export.h")
|
||||||
|
|
||||||
target_link_libraries(Pdf4QtViewer PRIVATE Pdf4QtLib Qt6::Core Qt6::Gui Qt6::Widgets Qt6::PrintSupport Qt6::TextToSpeech Qt6::Xml Qt6::Svg Qt6::OpenGLWidgets)
|
if(PDF4QT_ENABLE_OPENGL)
|
||||||
|
target_link_libraries(Pdf4QtViewer PRIVATE Qt6::OpenGLWidgets)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
target_link_libraries(Pdf4QtViewer PRIVATE Pdf4QtLib Qt6::Core Qt6::Gui Qt6::Widgets Qt6::PrintSupport Qt6::TextToSpeech Qt6::Xml Qt6::Svg)
|
||||||
target_include_directories(Pdf4QtViewer INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
|
target_include_directories(Pdf4QtViewer INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
target_include_directories(Pdf4QtViewer PUBLIC ${CMAKE_BINARY_DIR}/${INSTALL_INCLUDEDIR})
|
target_include_directories(Pdf4QtViewer PUBLIC ${CMAKE_BINARY_DIR}/${INSTALL_INCLUDEDIR})
|
||||||
|
|
||||||
|
@ -56,6 +56,10 @@
|
|||||||
#include <QToolBar>
|
#include <QToolBar>
|
||||||
#include <QXmlStreamWriter>
|
#include <QXmlStreamWriter>
|
||||||
|
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
#include <windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(PDF4QT_USE_PRAGMA_LIB)
|
#if defined(PDF4QT_USE_PRAGMA_LIB)
|
||||||
#pragma comment(lib, "Shell32")
|
#pragma comment(lib, "Shell32")
|
||||||
#endif
|
#endif
|
||||||
@ -2184,12 +2188,16 @@ void PDFProgramController::checkHardwareOpenGLAvailability()
|
|||||||
if (m_settings->getRendererEngine() == pdf::RendererEngine::OpenGL &&
|
if (m_settings->getRendererEngine() == pdf::RendererEngine::OpenGL &&
|
||||||
!pdf::PDFRendererInfo::isHardwareAccelerationSupported())
|
!pdf::PDFRendererInfo::isHardwareAccelerationSupported())
|
||||||
{
|
{
|
||||||
|
#ifdef PDF4QT_ENABLE_OPENGL
|
||||||
pdf::PDFRendererInfo::Info info = pdf::PDFRendererInfo::getHardwareAccelerationSupportedInfo();
|
pdf::PDFRendererInfo::Info info = pdf::PDFRendererInfo::getHardwareAccelerationSupportedInfo();
|
||||||
QMessageBox::warning(m_mainWindow, tr("Warning"),
|
QMessageBox::warning(m_mainWindow, tr("Warning"),
|
||||||
tr("Hardware acceleration is not supported on this device. "
|
tr("Hardware acceleration is not supported on this device. "
|
||||||
"OpenGL version at least 3.2 is required. Software rendering is used instead. "
|
"OpenGL version at least 3.2 is required. Software rendering is used instead. "
|
||||||
"Available OpenGL is %1 using %2. You can turn off hardware acceleration "
|
"Available OpenGL is %1 using %2. You can turn off hardware acceleration "
|
||||||
"in 'Tools' menu using 'Options' item to stop displaying this message.").arg(info.version, info.renderer));
|
"in 'Tools' menu using 'Options' item to stop displaying this message.").arg(info.version, info.renderer));
|
||||||
|
#else
|
||||||
|
QMessageBox::warning(m_mainWindow, tr("Warning"), tr("Hardware acceleration is not enabled in this build."));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,11 @@ add_library(AudioBookPlugin SHARED
|
|||||||
icons.qrc
|
icons.qrc
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(AudioBookPlugin PRIVATE Pdf4QtLib Qt6::Core Qt6::Gui Qt6::Widgets Qt6::OpenGLWidgets)
|
if(PDF4QT_ENABLE_OPENGL)
|
||||||
|
target_link_libraries(AudioBookPlugin PRIVATE Qt6::OpenGLWidgets)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
target_link_libraries(AudioBookPlugin PRIVATE Pdf4QtLib Qt6::Core Qt6::Gui Qt6::Widgets)
|
||||||
|
|
||||||
if(MINGW)
|
if(MINGW)
|
||||||
target_link_libraries(AudioBookPlugin PRIVATE ole32 sapi)
|
target_link_libraries(AudioBookPlugin PRIVATE ole32 sapi)
|
||||||
|
@ -23,7 +23,11 @@ add_library(DimensionsPlugin SHARED
|
|||||||
icons.qrc
|
icons.qrc
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(DimensionsPlugin PRIVATE Pdf4QtLib Qt6::Core Qt6::Gui Qt6::Widgets Qt6::OpenGLWidgets)
|
if(PDF4QT_ENABLE_OPENGL)
|
||||||
|
target_link_libraries(DimensionsPlugin PRIVATE Qt6::OpenGLWidgets)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
target_link_libraries(DimensionsPlugin PRIVATE Pdf4QtLib Qt6::Core Qt6::Gui Qt6::Widgets)
|
||||||
|
|
||||||
set_target_properties(DimensionsPlugin PROPERTIES
|
set_target_properties(DimensionsPlugin PROPERTIES
|
||||||
VERSION ${PDF4QT_VERSION}
|
VERSION ${PDF4QT_VERSION}
|
||||||
|
@ -29,7 +29,11 @@ add_library(ObjectInspectorPlugin SHARED
|
|||||||
icons.qrc
|
icons.qrc
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(ObjectInspectorPlugin PRIVATE Pdf4QtLib Qt6::Core Qt6::Gui Qt6::Widgets Qt6::OpenGLWidgets)
|
if(PDF4QT_ENABLE_OPENGL)
|
||||||
|
target_link_libraries(ObjectInspectorPlugin PRIVATE Qt6::OpenGLWidgets)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
target_link_libraries(ObjectInspectorPlugin PRIVATE Pdf4QtLib Qt6::Core Qt6::Gui Qt6::Widgets)
|
||||||
|
|
||||||
set_target_properties(ObjectInspectorPlugin PROPERTIES
|
set_target_properties(ObjectInspectorPlugin PROPERTIES
|
||||||
VERSION ${PDF4QT_VERSION}
|
VERSION ${PDF4QT_VERSION}
|
||||||
|
@ -25,7 +25,11 @@ add_library(OutputPreviewPlugin SHARED
|
|||||||
icons.qrc
|
icons.qrc
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(OutputPreviewPlugin PRIVATE Pdf4QtLib Qt6::Core Qt6::Gui Qt6::Widgets Qt6::OpenGLWidgets)
|
if(PDF4QT_ENABLE_OPENGL)
|
||||||
|
target_link_libraries(OutputPreviewPlugin PRIVATE Qt6::OpenGLWidgets)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
target_link_libraries(OutputPreviewPlugin PRIVATE Pdf4QtLib Qt6::Core Qt6::Gui Qt6::Widgets)
|
||||||
|
|
||||||
set_target_properties(OutputPreviewPlugin PROPERTIES
|
set_target_properties(OutputPreviewPlugin PROPERTIES
|
||||||
VERSION ${PDF4QT_VERSION}
|
VERSION ${PDF4QT_VERSION}
|
||||||
|
@ -22,7 +22,11 @@ add_library(RedactPlugin SHARED
|
|||||||
icons.qrc
|
icons.qrc
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(RedactPlugin PRIVATE Pdf4QtLib Qt6::Core Qt6::Gui Qt6::Widgets Qt6::OpenGLWidgets)
|
if(PDF4QT_ENABLE_OPENGL)
|
||||||
|
target_link_libraries(RedactPlugin PRIVATE Qt6::OpenGLWidgets)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
target_link_libraries(RedactPlugin PRIVATE Pdf4QtLib Qt6::Core Qt6::Gui Qt6::Widgets)
|
||||||
|
|
||||||
set_target_properties(RedactPlugin PROPERTIES
|
set_target_properties(RedactPlugin PROPERTIES
|
||||||
VERSION ${PDF4QT_VERSION}
|
VERSION ${PDF4QT_VERSION}
|
||||||
|
@ -22,7 +22,11 @@ add_library(SignaturePlugin SHARED
|
|||||||
icons.qrc
|
icons.qrc
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(SignaturePlugin PRIVATE Pdf4QtLib Qt6::Core Qt6::Gui Qt6::Widgets Qt6::OpenGLWidgets)
|
if(PDF4QT_ENABLE_OPENGL)
|
||||||
|
target_link_libraries(SignaturePlugin PRIVATE Qt6::OpenGLWidgets)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
target_link_libraries(SignaturePlugin PRIVATE Pdf4QtLib Qt6::Core Qt6::Gui Qt6::Widgets)
|
||||||
target_link_libraries(SignaturePlugin PRIVATE OpenSSL::SSL OpenSSL::Crypto)
|
target_link_libraries(SignaturePlugin PRIVATE OpenSSL::SSL OpenSSL::Crypto)
|
||||||
|
|
||||||
set_target_properties(SignaturePlugin PROPERTIES
|
set_target_properties(SignaturePlugin PROPERTIES
|
||||||
|
@ -22,7 +22,11 @@ add_library(SoftProofingPlugin SHARED
|
|||||||
icons.qrc
|
icons.qrc
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(SoftProofingPlugin PRIVATE Pdf4QtLib Qt6::Core Qt6::Gui Qt6::Widgets Qt6::OpenGLWidgets)
|
if(PDF4QT_ENABLE_OPENGL)
|
||||||
|
target_link_libraries(SoftProofingPlugin PRIVATE Qt6::OpenGLWidgets)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
target_link_libraries(SoftProofingPlugin PRIVATE Pdf4QtLib Qt6::Core Qt6::Gui Qt6::Widgets)
|
||||||
|
|
||||||
set_target_properties(SoftProofingPlugin PROPERTIES
|
set_target_properties(SoftProofingPlugin PROPERTIES
|
||||||
VERSION ${PDF4QT_VERSION}
|
VERSION ${PDF4QT_VERSION}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user