From 87a66458751b5486eb40b7a54ab3214704a3666a Mon Sep 17 00:00:00 2001 From: Felix Kauselmann Date: Sun, 28 Apr 2019 16:03:17 +0200 Subject: [PATCH] Document version, build flags and patches for bundled pdfium.dll --- dependencies/pdfium/win/VERSION | 27 +++++++++ .../pdfium/win/pdfium_shared_library.patch | 56 +++++++++++++++++++ 2 files changed, 83 insertions(+) create mode 100644 dependencies/pdfium/win/VERSION create mode 100644 dependencies/pdfium/win/pdfium_shared_library.patch diff --git a/dependencies/pdfium/win/VERSION b/dependencies/pdfium/win/VERSION new file mode 100644 index 00000000..4dab8952 --- /dev/null +++ b/dependencies/pdfium/win/VERSION @@ -0,0 +1,27 @@ +YACReader for Windows uses a shared library version of pdfium. + +pdfium branch used for building: chromium/3729 + +Build parameters used (gn args): + +pdf_enable_v8 = false +pdf_enable_xfa = false +is_debug = false +symbol_level = 0 +use_jumbo_build = true + +For 32 bit builds: +target_cpu="x86" + +For 64 bit builds: +target_cpu="x64" + +Instructions on building pdfium can be found at https://pdfium.googlesource.com/pdfium + +To build a shared library, the source code has to be patched. A patch file with the +necessary modifications can be found in this directory (pdfium_shared_library.patch). + +It is recommended to always use the branch the current stable version of Chromium uses. +To get the pdfium branch corresponding to Chromium stable, look at +http://omahaproxy.appspot.com and search for the true_branch variable associated with +the current stable dev channel of Chromium. \ No newline at end of file diff --git a/dependencies/pdfium/win/pdfium_shared_library.patch b/dependencies/pdfium/win/pdfium_shared_library.patch new file mode 100644 index 00000000..d8f05d5a --- /dev/null +++ b/dependencies/pdfium/win/pdfium_shared_library.patch @@ -0,0 +1,56 @@ +From 0706085c41f645d68e29732f21da733e191abc34 Mon Sep 17 00:00:00 2001 +From: Felix Kauselmann +Date: Sat, 27 Apr 2019 16:57:01 +0200 +Subject: [PATCH] Build a shared library + +--- + BUILD.gn | 3 ++- + public/fpdfview.h | 9 +++++++-- + 2 files changed, 9 insertions(+), 3 deletions(-) + +diff --git a/BUILD.gn b/BUILD.gn +index 6885fc27d..06335fcd3 100644 +--- a/BUILD.gn ++++ b/BUILD.gn +@@ -22,6 +22,7 @@ config("pdfium_common_config") { + defines = [ + "PNG_PREFIX", + "PNG_USE_READ_MACROS", ++ "FPDFSDK_EXPORTS", + ] + + if (!use_system_libopenjpeg2) { +@@ -132,7 +133,7 @@ jumbo_source_set("pdfium_public_headers") { + public_configs = [ ":pdfium_public_config" ] + } + +-jumbo_static_library("pdfium") { ++shared_library("pdfium") { + sources = [ + "fpdfsdk/fpdf_annot.cpp", + "fpdfsdk/fpdf_attachment.cpp", +diff --git a/public/fpdfview.h b/public/fpdfview.h +index 8892da536..8453ee66e 100644 +--- a/public/fpdfview.h ++++ b/public/fpdfview.h +@@ -154,10 +154,15 @@ typedef int FPDF_ANNOT_APPEARANCEMODE; + // Dictionary value types. + typedef int FPDF_OBJECT_TYPE; + +-#if defined(_WIN32) && defined(FPDFSDK_EXPORTS) ++#if defined(_WIN32) ++#if defined(FPDFSDK_EXPORTS) + // On Windows system, functions are exported in a DLL + #define FPDF_EXPORT __declspec(dllexport) +-#define FPDF_CALLCONV __stdcall ++#define FPDF_CALLCONV __cdecl ++#else ++#define FPDF_EXPORT __declspec(dllimport) ++#define FPDF_CALLCONV __cdecl ++#endif + #else + #define FPDF_EXPORT + #define FPDF_CALLCONV +-- +2.20.1.windows.1 +