summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--configure.json4
-rw-r--r--examples/examples.pro2
-rw-r--r--examples/pdfwidgets/pdfviewer/pdfviewer.pro2
-rw-r--r--mkspecs/features/gn_generator.prf9
-rw-r--r--src/buildtools/config/common.pri23
-rw-r--r--src/buildtools/config/linux.pri18
-rw-r--r--src/buildtools/config/mac_osx.pri2
-rw-r--r--src/buildtools/configure.json20
-rw-r--r--src/core/configure.json7
-rw-r--r--src/core/core_gn_config.pri1
-rw-r--r--src/pdf/api/qpdfbookmarkmodel.h (renamed from src/pdf/qpdfbookmarkmodel.h)3
-rw-r--r--src/pdf/api/qpdfdocument.h (renamed from src/pdf/qpdfdocument.h)5
-rw-r--r--src/pdf/api/qpdfdocument_p.h (renamed from src/pdf/qpdfdocument_p.h)4
-rw-r--r--src/pdf/api/qpdfdocumentrenderoptions.h (renamed from src/pdf/qpdfdocumentrenderoptions.h)3
-rw-r--r--src/pdf/api/qpdfnamespace.h (renamed from src/pdf/qpdfnamespace.h)3
-rw-r--r--src/pdf/api/qpdfpagenavigation.h (renamed from src/pdf/qpdfpagenavigation.h)3
-rw-r--r--src/pdf/api/qpdfpagerenderer.h (renamed from src/pdf/qpdfpagerenderer.h)5
-rw-r--r--src/pdf/api/qtpdfglobal.h (renamed from src/pdf/qtpdfglobal.h)0
-rw-r--r--src/pdf/configure.json27
-rw-r--r--src/pdf/gn_run.pro68
-rw-r--r--src/pdf/pdf.pro46
-rw-r--r--src/pdf/pdfcore.pro79
-rw-r--r--src/pdf/pdfcore_generator.pro14
-rw-r--r--src/pdf/qpdfbookmarkmodel.cpp6
-rw-r--r--src/pdf/qpdfdocument.cpp4
-rw-r--r--src/pdf/qtpdf.gni7
-rw-r--r--src/pdfwidgets/configure.json28
-rw-r--r--src/src.pro15
-rw-r--r--sync.profile3
-rw-r--r--tests/auto/auto.pro5
-rw-r--r--tests/auto/pdf/qpdfdocument/BLACKLIST6
31 files changed, 332 insertions, 90 deletions
diff --git a/configure.json b/configure.json
index 8caad24f0..a5dbad35b 100644
--- a/configure.json
+++ b/configure.json
@@ -3,6 +3,8 @@
"src/buildtools",
"src/core",
"src/webengine",
- "src/webenginewidgets"
+ "src/webenginewidgets",
+ "src/pdf",
+ "src/pdfwidgets"
]
}
diff --git a/examples/examples.pro b/examples/examples.pro
index 3dac9b0b7..825cacaae 100644
--- a/examples/examples.pro
+++ b/examples/examples.pro
@@ -3,3 +3,5 @@ TEMPLATE=subdirs
qtHaveModule(webengine): SUBDIRS += webengine
qtHaveModule(webenginewidgets): SUBDIRS += webenginewidgets
+
+qtHaveModule(pdfwidgets): SUBDIRS += pdfwidgets
diff --git a/examples/pdfwidgets/pdfviewer/pdfviewer.pro b/examples/pdfwidgets/pdfviewer/pdfviewer.pro
index d3e768892..ad0607ea5 100644
--- a/examples/pdfwidgets/pdfviewer/pdfviewer.pro
+++ b/examples/pdfwidgets/pdfviewer/pdfviewer.pro
@@ -19,5 +19,5 @@ FORMS += \
RESOURCES += \
resources.qrc
-target.path = $$[QT_INSTALL_EXAMPLES]/pdf/pdfviewer
+target.path = $$[QT_INSTALL_EXAMPLES]/pdfwidgets/pdfviewer
INSTALLS += target
diff --git a/mkspecs/features/gn_generator.prf b/mkspecs/features/gn_generator.prf
index 863169c4d..358084e59 100644
--- a/mkspecs/features/gn_generator.prf
+++ b/mkspecs/features/gn_generator.prf
@@ -183,7 +183,7 @@ GN_CONTENTS += "$${TARGET_TYPE}(\"$$TARGET\") {"
}
GN_CONTENTS += " configs += [ \":$${TARGET}_config\" ]"
-GN_CONTENTS += " configs += [ \"//build/config:precompiled_headers\" ]"
+!isEmpty(GN_PRECOMPILED_HEADERS): GN_CONTENTS += " configs += [ \"//build/config:precompiled_headers\" ]"
# Source files to compile
GN_CONTENTS += " sources = ["
@@ -239,11 +239,10 @@ GN_CONTENTS += " \":generate_cpp_mocs\","
GN_CONTENTS += " ]"
GN_CONTENTS += " }"
GN_CONTENTS += "}"
-GN_CONTENTS += ""
-GN_CONTENTS += "if (!defined(core_include_dirs)) {"\
- " core_include_dirs = []"\
- "}"
!isEmpty(GN_CORE_INCLUDE_DIRS) {
+ GN_CONTENTS += " if (!defined(core_include_dirs)) {"\
+ " core_include_dirs = []"\
+ " }"
GN_CONTENTS += "core_include_dirs += ["
for (inc, GN_CORE_INCLUDE_DIRS): GN_CONTENTS += " \"$$inc\","
GN_CONTENTS += "]"
diff --git a/src/buildtools/config/common.pri b/src/buildtools/config/common.pri
index 97d39535c..b5617cdfb 100644
--- a/src/buildtools/config/common.pri
+++ b/src/buildtools/config/common.pri
@@ -1,7 +1,8 @@
# Shared configuration for all our supported platforms
include($$QTWEBENGINE_OUT_ROOT/src/buildtools/qtbuildtools-config.pri)
include($$QTWEBENGINE_OUT_ROOT/src/core/qtwebenginecore-config.pri)
-QT_FOR_CONFIG += buildtools-private webenginecore webenginecore-private
+include($$QTWEBENGINE_OUT_ROOT/src/pdf/qtpdf-config.pri)
+QT_FOR_CONFIG += buildtools-private webenginecore webenginecore-private pdf-private
gn_args += \
use_qt=true \
@@ -39,7 +40,7 @@ greaterThan(QMAKE_JUMBO_MERGE_LIMIT,0) {
gn_args += jumbo_build_excluded="[\"browser\"]"
}
-qtConfig(webengine-printing-and-pdf) {
+qtConfig(build-qtwebengine-core):qtConfig(webengine-printing-and-pdf) {
gn_args += enable_basic_printing=true enable_print_preview=true
gn_args += enable_pdf=true
} else {
@@ -47,27 +48,31 @@ qtConfig(webengine-printing-and-pdf) {
gn_args += enable_pdf=false
}
-qtConfig(webengine-pepper-plugins) {
+qtConfig(build-qtwebengine-core):qtConfig(webengine-pepper-plugins) {
gn_args += enable_plugins=true
} else {
gn_args += enable_plugins=false
}
-qtConfig(webengine-spellchecker) {
+qtConfig(build-qtwebengine-core):qtConfig(webengine-spellchecker) {
gn_args += enable_spellcheck=true
} else {
gn_args += enable_spellcheck=false
}
-qtConfig(webengine-webrtc) {
+qtConfig(build-qtwebengine-core):qtConfig(webengine-webrtc) {
gn_args += enable_webrtc=true
} else {
gn_args += enable_webrtc=false audio_processing_in_audio_service_supported=false
}
-qtConfig(webengine-proprietary-codecs): gn_args += proprietary_codecs=true ffmpeg_branding=\"Chrome\"
+qtConfig(build-qtwebengine-core):qtConfig(webengine-proprietary-codecs) {
+ gn_args += proprietary_codecs=true ffmpeg_branding=\"Chrome\"
+} else {
+ gn_args += proprietary_codecs=false
+}
-qtConfig(webengine-extensions) {
+qtConfig(build-qtwebengine-core):qtConfig(webengine-extensions) {
gn_args += enable_extensions=true
} else {
gn_args += enable_extensions=false
@@ -122,13 +127,13 @@ optimize_size: gn_args += optimize_for_size=true
sanitize_undefined: gn_args += is_ubsan=true is_ubsan_vptr=true
}
-qtConfig(webengine-v8-snapshot):qtConfig(webengine-v8-snapshot-support) {
+qtConfig(build-qtwebengine-core):qtConfig(webengine-v8-snapshot):qtConfig(webengine-v8-snapshot-support) {
gn_args += v8_use_snapshot=true
} else {
gn_args += v8_use_snapshot=false
}
-qtConfig(webengine-kerberos) {
+qtConfig(build-qtwebengine-core):qtConfig(webengine-kerberos) {
gn_args += use_kerberos=true
} else {
gn_args += use_kerberos=false
diff --git a/src/buildtools/config/linux.pri b/src/buildtools/config/linux.pri
index f3c4fc953..fc8dbe84f 100644
--- a/src/buildtools/config/linux.pri
+++ b/src/buildtools/config/linux.pri
@@ -5,7 +5,7 @@ defineReplace(extractCFlag) {
return($$qtwebengine_extractCFlag($$1))
}
-QT_FOR_CONFIG += gui-private webenginecore-private
+QT_FOR_CONFIG += gui-private webenginecore-private pdf-private
gn_args += \
use_cups=false \
@@ -26,7 +26,7 @@ gn_args += \
ozone_platform=\"qt\" \
ozone_extra_path=\"$$QTWEBENGINE_ROOT/src/core/ozone/ozone_extra.gni\"
-qtConfig(webengine-embedded-build) {
+qtConfig(build-qtwebengine-core):qtConfig(webengine-embedded-build) {
gn_args += is_desktop_linux=false
}
@@ -92,7 +92,7 @@ contains(QT_ARCH, "arm") {
}
}
- qtConfig(webengine-arm-thumb) {
+ qtConfig(build-qtwebengine-core):qtConfig(webengine-arm-thumb) {
gn_args += arm_use_thumb=true # this adds -mthumb
} else {
gn_args += arm_use_thumb=false
@@ -158,11 +158,15 @@ host_build {
qtConfig(webengine-system-zlib) {
qtConfig(webengine-system-minizip): gn_args += use_system_zlib=true use_system_minizip=true
- qtConfig(webengine-printing-and-pdf): gn_args += pdfium_use_system_zlib=true
+ qtConfig(build-qtpdf) || qtConfig(webengine-printing-and-pdf) {
+ gn_args += pdfium_use_system_zlib=true
+ }
}
qtConfig(webengine-system-png) {
gn_args += use_system_libpng=true
- qtConfig(webengine-printing-and-pdf): gn_args += pdfium_use_system_libpng=true
+ qtConfig(build-qtpdf) || qtConfig(webengine-printing-and-pdf) {
+ gn_args += pdfium_use_system_libpng=true
+ }
}
qtConfig(webengine-system-jpeg) {
gn_args += use_system_libjpeg=true
@@ -180,12 +184,12 @@ host_build {
gn_args += use_system_harfbuzz=false
}
gn_args += use_glib=false
- qtConfig(webengine-pulseaudio) {
+ qtConfig(build-qtwebengine-core):qtConfig(webengine-pulseaudio) {
gn_args += use_pulseaudio=true
} else {
gn_args += use_pulseaudio=false
}
- qtConfig(webengine-alsa) {
+ qtConfig(build-qtwebengine-core):qtConfig(webengine-alsa) {
gn_args += use_alsa=true
} else {
gn_args += use_alsa=false
diff --git a/src/buildtools/config/mac_osx.pri b/src/buildtools/config/mac_osx.pri
index 3f2fe9c0a..a7ed61214 100644
--- a/src/buildtools/config/mac_osx.pri
+++ b/src/buildtools/config/mac_osx.pri
@@ -31,7 +31,7 @@ gn_args += \
mac_sdk_min=\"$${QMAKE_MAC_SDK_VERSION}\" \
use_external_popup_menu=false
-qtConfig(webengine-spellchecker) {
+qtConfig(build-qtwebengine-core):qtConfig(webengine-spellchecker) {
qtConfig(webengine-native-spellchecker): gn_args += use_browser_spellchecker=true
else: gn_args += use_browser_spellchecker=false
} else {
diff --git a/src/buildtools/configure.json b/src/buildtools/configure.json
index a36d05320..564da1137 100644
--- a/src/buildtools/configure.json
+++ b/src/buildtools/configure.json
@@ -8,6 +8,7 @@
"commandline": {
"options": {
"build-qtwebengine-core": "boolean",
+ "build-qtpdf": "boolean",
"webengine-jumbo-build": { "type": "optionalString", "name": "merge_limit"}
}
},
@@ -391,6 +392,7 @@
"build-qtwebengine-core": {
"label": "Build Qt WebEngine Core",
"purpose": "Provides WebEngine Core support.",
+ "autoDetect": "false",
"output": [ "privateFeature" ]
},
"build-qtpdf": {
@@ -404,6 +406,22 @@
"autoDetect": "features.private_tests",
"output": [ "privateFeature" ]
},
+ "build-qtpdf": {
+ "label": "Support Qt PDF rendering module",
+ "purpose": "Enables building the Qt PDF rendering module.",
+ "condition": "module.gui
+ && features.webengine-python2
+ && features.webengine-gperf
+ && features.webengine-bison
+ && features.webengine-flex",
+ "output": [ "privateFeature" ]
+ },
+ "webengine-developer-build": {
+ "label": "Developer build",
+ "purpose": "Enables the developer build configuration.",
+ "autoDetect": "features.private_tests",
+ "output": [ "privateFeature" ]
+ },
"webengine-python2": {
"label": "python2",
"condition": "tests.webengine-python2",
@@ -710,7 +728,7 @@
"entries": [
"webengine-system-ninja",
"webengine-system-gn",
- {
+ {
"message": "Jumbo Build Merge Limit",
"type": "jumboBuild"
},
diff --git a/src/core/configure.json b/src/core/configure.json
index d7f5a92f1..b33b10fda 100644
--- a/src/core/configure.json
+++ b/src/core/configure.json
@@ -104,7 +104,6 @@
"webengine-embedded-build": {
"label": "Embedded build",
"purpose": "Enables the embedded build configuration.",
- "section": "WebEngine",
"condition": "config.unix",
"autoDetect": "tests.webengine-embedded-build",
"output": [ "privateFeature" ]
@@ -139,14 +138,12 @@
"webengine-pepper-plugins": {
"label": "Pepper Plugins",
"purpose": "Enables use of Pepper Flash plugins.",
- "section": "WebEngine",
"autoDetect": "!features.webengine-embedded-build",
"output": [ "privateFeature" ]
},
"webengine-printing-and-pdf": {
"label": "Printing and PDF",
"purpose": "Provides printing and output to PDF.",
- "section": "WebEngine",
"condition": "module.printsupport && features.printer",
"autoDetect": "!features.webengine-embedded-build",
"output": [ "privateFeature" ]
@@ -161,7 +158,6 @@
"webengine-proprietary-codecs": {
"label": "Proprietary Codecs",
"purpose": "Enables the use of proprietary codecs such as h.264/h.265 and MP3.",
- "section": "WebEngine",
"autoDetect": false,
"output": [ "privateFeature" ]
},
@@ -175,13 +171,11 @@
"webengine-spellchecker": {
"label": "Spellchecker",
"purpose": "Provides a spellchecker.",
- "section": "WebEngine",
"output": [ "publicFeature" ]
},
"webengine-native-spellchecker": {
"label": "Native Spellchecker",
"purpose": "Use the system's native spellchecking engine.",
- "section": "WebEngine",
"autoDetect": false,
"condition": "config.macos && features.webengine-spellchecker",
"output": [ "publicFeature" ]
@@ -197,7 +191,6 @@
"webengine-webrtc": {
"label": "WebRTC",
"purpose": "Provides WebRTC support.",
- "section": "WebEngine",
"autoDetect": "!features.webengine-embedded-build",
"output": [ "privateFeature" ]
},
diff --git a/src/core/core_gn_config.pri b/src/core/core_gn_config.pri
index a089eecd0..2b8f2e18f 100644
--- a/src/core/core_gn_config.pri
+++ b/src/core/core_gn_config.pri
@@ -11,6 +11,7 @@ qtConfig (webengine-extensions) {
}
GN_CORE_INCLUDE_DIRS = $$PWD/service
GN_CREATE_PRI = true
+GN_PRECOMPILED_HEADERS = true
QMAKE_INTERNAL_INCLUDED_FILES = $$GN_IMPORTS $$GN_INCLUDES $$GN_FILE
diff --git a/src/pdf/qpdfbookmarkmodel.h b/src/pdf/api/qpdfbookmarkmodel.h
index 166cd8cca..503a29100 100644
--- a/src/pdf/qpdfbookmarkmodel.h
+++ b/src/pdf/api/qpdfbookmarkmodel.h
@@ -37,8 +37,7 @@
#ifndef QPDFBOOKMARKMODEL_H
#define QPDFBOOKMARKMODEL_H
-#include "qtpdfglobal.h"
-
+#include <QtPdf/qtpdfglobal.h>
#include <QAbstractItemModel>
QT_BEGIN_NAMESPACE
diff --git a/src/pdf/qpdfdocument.h b/src/pdf/api/qpdfdocument.h
index 63532b3d5..50525eb9d 100644
--- a/src/pdf/qpdfdocument.h
+++ b/src/pdf/api/qpdfdocument.h
@@ -37,11 +37,10 @@
#ifndef QPDFDOCUMENT_H
#define QPDFDOCUMENT_H
-#include "qtpdfglobal.h"
-
+#include <QtPdf/qtpdfglobal.h>
#include <QImage>
#include <QObject>
-#include <QPdfDocumentRenderOptions>
+#include <QtPdf/QPdfDocumentRenderOptions>
QT_BEGIN_NAMESPACE
diff --git a/src/pdf/qpdfdocument_p.h b/src/pdf/api/qpdfdocument_p.h
index 56b15cdc5..d8d950b3c 100644
--- a/src/pdf/qpdfdocument_p.h
+++ b/src/pdf/api/qpdfdocument_p.h
@@ -39,8 +39,8 @@
#include "qpdfdocument.h"
-#include "public/fpdfview.h"
-#include "public/fpdf_dataavail.h"
+#include "third_party/pdfium/public/fpdfview.h"
+#include "third_party/pdfium/public/fpdf_dataavail.h"
#include <qbuffer.h>
#include <qmutex.h>
diff --git a/src/pdf/qpdfdocumentrenderoptions.h b/src/pdf/api/qpdfdocumentrenderoptions.h
index 1d316b91f..99a5db2e3 100644
--- a/src/pdf/qpdfdocumentrenderoptions.h
+++ b/src/pdf/api/qpdfdocumentrenderoptions.h
@@ -37,8 +37,7 @@
#ifndef QPDFDOCUMENTRENDEROPTIONS_H
#define QPDFDOCUMENTRENDEROPTIONS_H
-#include "qpdfnamespace.h"
-
+#include <QtPdf/qpdfnamespace.h>
#include <QtCore/QObject>
QT_BEGIN_NAMESPACE
diff --git a/src/pdf/qpdfnamespace.h b/src/pdf/api/qpdfnamespace.h
index a8e7dc0e5..c8fd8a580 100644
--- a/src/pdf/qpdfnamespace.h
+++ b/src/pdf/api/qpdfnamespace.h
@@ -39,6 +39,8 @@
#include <QObject>
+QT_BEGIN_NAMESPACE
+
namespace QPdf {
Q_NAMESPACE
@@ -66,4 +68,5 @@ namespace QPdf {
Q_DECLARE_OPERATORS_FOR_FLAGS(QPdf::RenderFlags)
+QT_END_NAMESPACE
#endif
diff --git a/src/pdf/qpdfpagenavigation.h b/src/pdf/api/qpdfpagenavigation.h
index b3649fac6..8da809646 100644
--- a/src/pdf/qpdfpagenavigation.h
+++ b/src/pdf/api/qpdfpagenavigation.h
@@ -37,8 +37,7 @@
#ifndef QPDFPAGENAVIGATION_H
#define QPDFPAGENAVIGATION_H
-#include "qtpdfglobal.h"
-
+#include <QtPdf/qtpdfglobal.h>
#include <QObject>
QT_BEGIN_NAMESPACE
diff --git a/src/pdf/qpdfpagerenderer.h b/src/pdf/api/qpdfpagerenderer.h
index 80565798d..de6704480 100644
--- a/src/pdf/qpdfpagerenderer.h
+++ b/src/pdf/api/qpdfpagerenderer.h
@@ -37,10 +37,9 @@
#ifndef QPDFPAGERENDERER_H
#define QPDFPAGERENDERER_H
-#include "qtpdfglobal.h"
-
+#include <QtPdf/qtpdfglobal.h>
#include <QObject>
-#include <QPdfDocumentRenderOptions>
+#include <QtPdf/QPdfDocumentRenderOptions>
#include <QSize>
QT_BEGIN_NAMESPACE
diff --git a/src/pdf/qtpdfglobal.h b/src/pdf/api/qtpdfglobal.h
index 34cfc46d9..34cfc46d9 100644
--- a/src/pdf/qtpdfglobal.h
+++ b/src/pdf/api/qtpdfglobal.h
diff --git a/src/pdf/configure.json b/src/pdf/configure.json
new file mode 100644
index 000000000..a7376b578
--- /dev/null
+++ b/src/pdf/configure.json
@@ -0,0 +1,27 @@
+{
+ "module": "pdf",
+ "depends" : [ "buildtools-private" ],
+ "testDir": "../../config.tests",
+ "condition": "features.build-qtpdf",
+ "libraries": {
+ },
+ "tests": {
+ },
+ "features": {
+ "pdf-info": {
+ "label": "Support Qt PDF rendering module",
+ "purpose": "Enables building the Qt PDF rendering module.",
+ "output": ["privateFeature" ]
+ }
+ },
+ "report": [
+ ],
+ "summary": [
+ {
+ "section": "Qt PDF",
+ "entries": [
+ "pdf-info"
+ ]
+ }
+ ]
+}
diff --git a/src/pdf/gn_run.pro b/src/pdf/gn_run.pro
new file mode 100644
index 000000000..fe35f8eb4
--- /dev/null
+++ b/src/pdf/gn_run.pro
@@ -0,0 +1,68 @@
+include($$QTWEBENGINE_OUT_ROOT/src/buildtools/qtbuildtools-config.pri)
+QT_FOR_CONFIG += buildtools-private
+
+TEMPLATE = aux
+
+qtConfig(debug_and_release): CONFIG += debug_and_release build_all
+
+qtConfig(webengine-system-ninja) {
+ QT_TOOL.ninja.binary = ninja
+} else {
+ QT_TOOL.ninja.binary = $$shell_quote($$shell_path($$ninjaPath()))
+}
+
+win32 {
+ # Add the gnuwin32/bin subdir of qt5.git to PATH. Needed for calling bison and friends.
+ gnuwin32path.name = PATH
+ gnuwin32path.value = $$shell_path($$clean_path($$QTWEBENGINE_ROOT/../gnuwin32/bin))
+ gnuwin32path.CONFIG += prepend
+ exists($$gnuwin32path.value): QT_TOOL_ENV = gnuwin32path
+}
+
+qtPrepareTool(NINJA, ninja)
+QT_TOOL_ENV =
+
+build_pass|!debug_and_release {
+ gn_binary = gn
+
+ runninja.target = run_ninja
+
+ # fixme: refine args
+ gn_args = $$gnArgs()
+
+ # fixme: qtwebengine_target
+ gn_args += "qtwebengine_target=\"$$system_path($$OUT_PWD/$$getConfigDir()):QtPdf\""
+
+ # fixme:
+ !qtConfig(webengine-system-gn) {
+ gn_binary = $$system_quote($$system_path($$gnPath()))
+ }
+
+ gn_args = $$system_quote($$gn_args)
+ gn_src_root = $$system_quote($$system_path($$QTWEBENGINE_ROOT/$$getChromiumSrcDir()))
+ gn_build_root = $$system_quote($$system_path($$OUT_PWD/$$getConfigDir()))
+ gn_python = "--script-executable=$$pythonPathForSystem()"
+ gn_run = $$gn_binary gen $$gn_build_root $$gn_python --args=$$gn_args --root=$$gn_src_root
+
+ message("Running: $$gn_run ")
+ !system($$gn_run) {
+ error("GN run error!")
+ }
+
+ ninjaflags = $$(NINJAFLAGS)
+ isEmpty(ninjaflags):!silent: ninjaflags = "-v"
+
+ runninja.commands = $$NINJA $$ninjaflags -C $$gn_build_root QtPdf
+ QMAKE_EXTRA_TARGETS += runninja
+
+ build_pass:build_all: default_target.target = all
+ else: default_target.target = first
+ default_target.depends = runninja
+ QMAKE_EXTRA_TARGETS += default_target
+}
+
+!build_pass:debug_and_release {
+ # Special GNU make target for the meta Makefile that ensures that our debug and release Makefiles won't both run ninja in parallel.
+ notParallel.target = .NOTPARALLEL
+ QMAKE_EXTRA_TARGETS += notParallel
+}
diff --git a/src/pdf/pdf.pro b/src/pdf/pdf.pro
index e872eb5a1..251b10a1b 100644
--- a/src/pdf/pdf.pro
+++ b/src/pdf/pdf.pro
@@ -1,40 +1,14 @@
-TARGET = QtPdf
-QT += gui core core-private
-QT_PRIVATE += network
-TEMPLATE = lib
-CONFIG += c++11
-CONFIG -= precompile_header # Not supported by upstream header files
-win32: DEFINES += NOMINMAX
-INCLUDEPATH += $$QTPDF_ROOT/src/3rdparty/pdfium/fpdfsdk/include
-INCLUDEPATH += $$QTPDF_ROOT/src/3rdparty/pdfium
-INCLUDEPATH += $$QTPDF_ROOT/src/3rdparty/pdfium/third_party/freetype/include
-load(qt_module)
+TEMPLATE = subdirs
+pdfcore.file = pdfcore.pro
+pdfcore_generator.file = pdfcore_generator.pro
+gn_run.file = gn_run.pro
-LIBS_PRIVATE += -L$$MODULE_BASE_OUTDIR/lib -lqtpdfium$$qtPlatformTargetSuffix()
+gn_run.depends = pdfcore_generator
+pdfcore.depends = gn_run
-QMAKE_DOCS = $$PWD/doc/qtpdf.qdocconf
+SUBDIRS += \
+ pdfcore_generator \
+ gn_run \
+ pdfcore
-gcc {
- QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-parameter
-}
-msvc {
- QMAKE_CXXFLAGS_WARN_ON += -wd"4100"
-}
-
-SOURCES += \
- jsbridge.cpp \
- qpdfbookmarkmodel.cpp \
- qpdfdocument.cpp \
- qpdfpagenavigation.cpp \
- qpdfpagerenderer.cpp
-
-HEADERS += \
- qpdfbookmarkmodel.h \
- qpdfdocument.h \
- qpdfdocument_p.h \
- qpdfdocumentrenderoptions.h \
- qpdfnamespace.h \
- qpdfpagenavigation.h \
- qpdfpagerenderer.h \
- qtpdfglobal.h
diff --git a/src/pdf/pdfcore.pro b/src/pdf/pdfcore.pro
new file mode 100644
index 000000000..752ae4468
--- /dev/null
+++ b/src/pdf/pdfcore.pro
@@ -0,0 +1,79 @@
+TARGET = QtPdf
+MODULE = pdf
+
+QT += gui core core-private
+QT_PRIVATE += network
+
+TEMPLATE = lib
+
+CONFIG += c++11
+CONFIG -= precompile_header # Not supported by upstream header files
+
+INCLUDEPATH += $$QTWEBENGINE_ROOT/src/pdf
+CHROMIUM_SRC_DIR = $$QTWEBENGINE_ROOT/$$getChromiumSrcDir()
+CHROMIUM_GEN_DIR = $$OUT_PWD/../$$getConfigDir()/gen
+INCLUDEPATH += $$QTWEBENGINE_ROOT/src/pdf \
+ $$CHROMIUM_GEN_DIR \
+ $$CHROMIUM_SRC_DIR \
+ api
+
+DEFINES += QT_BUILD_PDF_LIB
+win32: DEFINES += NOMINMAX
+
+linking_pri = $$OUT_PWD/$$getConfigDir()/$${TARGET}.pri
+!include($$linking_pri) {
+ error("Could not find the linking information that gn should have generated.")
+}
+
+isEmpty(NINJA_OBJECTS): error("Missing object files from QtPdf linking pri.")
+isEmpty(NINJA_LFLAGS): error("Missing linker flags from QtPdf linking pri")
+isEmpty(NINJA_ARCHIVES): error("Missing archive files from QtPdf linking pri")
+isEmpty(NINJA_LIBS): error("Missing library files from QtPdf linking pri")
+
+NINJA_OBJECTS = $$eval($$list($$NINJA_OBJECTS))
+RSP_FILE = $$OUT_PWD/$$getConfigDir()/$${TARGET}.rsp
+for(object, NINJA_OBJECTS): RSP_CONTENT += $$object
+write_file($$RSP_FILE, RSP_CONTENT)
+
+macos:LIBS_PRIVATE += -Wl,-filelist,$$shell_quote($$RSP_FILE)
+linux:LIBS_PRIVATE += @$$RSP_FILE
+
+# QTBUG-58710 add main rsp file on windows
+win32:QMAKE_LFLAGS += @$$RSP_FILE
+
+linux: LIBS_PRIVATE += -Wl,--start-group $$NINJA_ARCHIVES -Wl,--end-group
+else: LIBS_PRIVATE += $$NINJA_ARCHIVES
+
+LIBS_PRIVATE += $$NINJA_LIB_DIRS $$NINJA_LIBS
+
+QMAKE_DOCS = $$PWD/doc/qtpdf.qdocconf
+
+gcc {
+ QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-parameter
+}
+
+msvc {
+ QMAKE_CXXFLAGS_WARN_ON += -wd"4100"
+}
+
+SOURCES += \
+ qpdfbookmarkmodel.cpp \
+ qpdfdocument.cpp \
+ qpdfpagenavigation.cpp \
+ qpdfpagerenderer.cpp
+
+# all "public" headers must be in "api" for sync script and to hide auto generated headers
+# by Chromium in case of in-source build
+
+HEADERS += \
+ api/qpdfbookmarkmodel.h \
+ api/qpdfdocument.h \
+ api/qpdfdocument_p.h \
+ api/qpdfdocumentrenderoptions.h \
+ api/qpdfnamespace.h \
+ api/qpdfpagenavigation.h \
+ api/qpdfpagerenderer.h \
+ api/qtpdfglobal.h \
+ api/qpdfdocument_p.h
+
+load(qt_module)
diff --git a/src/pdf/pdfcore_generator.pro b/src/pdf/pdfcore_generator.pro
new file mode 100644
index 000000000..dc978988b
--- /dev/null
+++ b/src/pdf/pdfcore_generator.pro
@@ -0,0 +1,14 @@
+qtConfig(debug_and_release): CONFIG += debug_and_release
+
+TARGET = QtPdf
+TEMPLATE = lib
+CONFIG = gn_generator $$CONFIG
+GN_SRC_DIR = $$PWD
+GN_FILE = $$OUT_PWD/$$getConfigDir()/BUILD.gn
+GN_FIND_MOCABLES_SCRIPT = $$shell_path($$QTWEBENGINE_ROOT/tools/scripts/gn_find_mocables.py)
+GN_RUN_BINARY_SCRIPT = $$shell_path($$QTWEBENGINE_ROOT/tools/scripts/gn_run_binary.py)
+GN_IMPORTS = $$PWD/qtpdf.gni
+GN_CREATE_PRI = true
+QMAKE_INTERNAL_INCLUDED_FILES = $$GN_IMPORTS $$GN_INCLUDES $$GN_FILE
+
+
diff --git a/src/pdf/qpdfbookmarkmodel.cpp b/src/pdf/qpdfbookmarkmodel.cpp
index 241d9fd05..becca9e8f 100644
--- a/src/pdf/qpdfbookmarkmodel.cpp
+++ b/src/pdf/qpdfbookmarkmodel.cpp
@@ -39,8 +39,8 @@
#include "qpdfdocument.h"
#include "qpdfdocument_p.h"
-#include "public/fpdf_doc.h"
-#include "public/fpdfview.h"
+#include "third_party/pdfium/public/fpdf_doc.h"
+#include "third_party/pdfium/public/fpdfview.h"
#include <QPointer>
#include <QScopedPointer>
@@ -193,7 +193,7 @@ public:
FPDFBookmark_GetTitle(bookmark, titleBuffer.data(), titleBuffer.length());
const FPDF_DEST dest = FPDFBookmark_GetDest(document, bookmark);
- const int pageNumber = FPDFDest_GetPageIndex(document, dest);
+ const int pageNumber = FPDFDest_GetDestPageIndex(document, dest);
childBookmarkNode->setTitle(QString::fromUtf16(titleBuffer.data()));
childBookmarkNode->setLevel(level);
diff --git a/src/pdf/qpdfdocument.cpp b/src/pdf/qpdfdocument.cpp
index f30aeb600..5c6a9e078 100644
--- a/src/pdf/qpdfdocument.cpp
+++ b/src/pdf/qpdfdocument.cpp
@@ -37,10 +37,8 @@
#include "qpdfdocument.h"
#include "qpdfdocument_p.h"
-#include "public/fpdf_doc.h"
+#include "third_party/pdfium/public/fpdf_doc.h"
-#include <QDateTime>
-#include <QDebug>
#include <QFile>
#include <QMutex>
diff --git a/src/pdf/qtpdf.gni b/src/pdf/qtpdf.gni
new file mode 100644
index 000000000..c31f3e9a0
--- /dev/null
+++ b/src/pdf/qtpdf.gni
@@ -0,0 +1,7 @@
+include_dirs = [
+]
+
+deps = [
+ "//third_party/pdfium"
+]
+
diff --git a/src/pdfwidgets/configure.json b/src/pdfwidgets/configure.json
new file mode 100644
index 000000000..b33f08555
--- /dev/null
+++ b/src/pdfwidgets/configure.json
@@ -0,0 +1,28 @@
+{
+ "module": "pdfwidgets",
+ "condition": "module.pdf && features.pdf-widgets",
+ "depends": [
+ "pdf-private"
+ ],
+ "commandline": {
+ "options": {
+ "pdf-widgets": "boolean"
+ }
+ },
+ "features": {
+ "pdf-widgets": {
+ "label": "Support Qt PDF Widgets",
+ "purpose": "Provides Qt PDF Widgets support.",
+ "condition": "module.widgets",
+ "output": [ "privateFeature" ]
+ }
+ },
+ "summary": [
+ {
+ "section": "Qt PDF Widgets",
+ "entries": [
+ "pdf-widgets"
+ ]
+ }
+ ]
+}
diff --git a/src/src.pro b/src/src.pro
index de88878a6..97b6e5419 100644
--- a/src/src.pro
+++ b/src/src.pro
@@ -4,9 +4,11 @@ include($$QTWEBENGINE_OUT_ROOT/src/buildtools/qtbuildtools-config.pri)
include($$QTWEBENGINE_OUT_ROOT/src/core/qtwebenginecore-config.pri)
include($$QTWEBENGINE_OUT_ROOT/src/webengine/qtwebengine-config.pri)
include($$QTWEBENGINE_OUT_ROOT/src/webenginewidgets/qtwebenginewidgets-config.pri)
+include($$QTWEBENGINE_OUT_ROOT/src/pdf/qtpdf-config.pri)
+include($$QTWEBENGINE_OUT_ROOT/src/pdfwidgets/qtpdfwidgets-config.pri)
QT_FOR_CONFIG += buildtools-private webenginecore webenginecore-private webengine-private \
- webenginewidgets-private
+ webenginewidgets-private pdf-private pdfwidgets-private
TEMPLATE = subdirs
@@ -38,7 +40,16 @@ qtConfig(build-qtwebengine-core):qtConfig(webengine-core-support) {
}
}
-!qtConfig(webengine-core-support): qtConfig(build-qtwebengine-core) {
+qtConfig(build-qtpdf):qtConfig(webengine-core-support) {
+ pdf.depends = buildtools
+ SUBDIRS += buildtools pdf
+ qtConfig(pdf-widgets) {
+ pdfwidgets.depends = pdf
+ SUBDIRS += pdfwidgets
+ }
+}
+
+!qtConfig(webengine-core-support):if(qtConfig(build-qtwebengine-core)|qtConfig(build-qtpdf)) {
!qtwebengine_makeCheckError():!isEmpty(skipBuildReason):!build_pass {
errorbuild.commands = @echo Modules will not be built. $${skipBuildReason}
errorbuild.CONFIG = phony
diff --git a/sync.profile b/sync.profile
index 4cc549106..a1e3c8ded 100644
--- a/sync.profile
+++ b/sync.profile
@@ -2,11 +2,14 @@
"QtWebEngine" => "$basedir/src/webengine",
"QtWebEngineWidgets" => "$basedir/src/webenginewidgets",
"QtWebEngineCore" => "$basedir/src/core",
+ "QtPdf" => "$basedir/src/pdf",
+ "QtPdfWidgets" => "$basedir/src/pdfwidgets",
);
%moduleheaders = ( # restrict the module headers to those found in relative path
"QtWebEngine" => "api",
"QtWebEngineWidgets" => "api",
"QtWebEngineCore" => "api",
+ "QtPdf" => "api"
);
%classnames = (
);
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro
index 59bcd5aef..9b71e1183 100644
--- a/tests/auto/auto.pro
+++ b/tests/auto/auto.pro
@@ -7,3 +7,8 @@ qtHaveModule(webengine) {
qtHaveModule(webenginewidgets) {
SUBDIRS += core widgets
}
+
+qtHaveModule(pdf) {
+ SUBDIRS += pdf
+}
+
diff --git a/tests/auto/pdf/qpdfdocument/BLACKLIST b/tests/auto/pdf/qpdfdocument/BLACKLIST
new file mode 100644
index 000000000..b8db556d6
--- /dev/null
+++ b/tests/auto/pdf/qpdfdocument/BLACKLIST
@@ -0,0 +1,6 @@
+[password]
+*
+
+[passwordClearedOnClose]
+*
+