diff options
| author | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
|---|---|---|
| committer | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
| commit | 54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch) | |
| tree | d915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/ports/poppler | |
Diffstat (limited to 'vcpkg/ports/poppler')
| -rw-r--r-- | vcpkg/ports/poppler/cmake-project-include.cmake | 16 | ||||
| -rw-r--r-- | vcpkg/ports/poppler/export-unofficial-poppler.patch | 93 | ||||
| -rw-r--r-- | vcpkg/ports/poppler/portfile.cmake | 111 | ||||
| -rw-r--r-- | vcpkg/ports/poppler/private-namespace.patch | 50 | ||||
| -rw-r--r-- | vcpkg/ports/poppler/unofficial-poppler-config.cmake | 28 | ||||
| -rw-r--r-- | vcpkg/ports/poppler/usage | 6 | ||||
| -rw-r--r-- | vcpkg/ports/poppler/vcpkg.json | 113 |
7 files changed, 417 insertions, 0 deletions
diff --git a/vcpkg/ports/poppler/cmake-project-include.cmake b/vcpkg/ports/poppler/cmake-project-include.cmake new file mode 100644 index 0000000..2dbefb2 --- /dev/null +++ b/vcpkg/ports/poppler/cmake-project-include.cmake @@ -0,0 +1,16 @@ +# Create helper file for iconv usage requirement +find_package(Iconv REQUIRED) +set(poppler_iconv [[ +Name: poppler-vcpkg-iconv +Description: iconv linking requirements for poppler +Version: 0 +Libs:]]) +string(TOLOWER "${Iconv_LIBRARIES}" iconv_libraries) +if(iconv_libraries MATCHES "iconv") + string(APPEND poppler_iconv " -liconv") +endif() +if(iconv_libraries MATCHES "charset") + string(APPEND poppler_iconv " -lcharset") +endif() +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/poppler-vcpkg-iconv.pc" "${poppler_iconv}") +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/poppler-vcpkg-iconv.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") diff --git a/vcpkg/ports/poppler/export-unofficial-poppler.patch b/vcpkg/ports/poppler/export-unofficial-poppler.patch new file mode 100644 index 0000000..4f74013 --- /dev/null +++ b/vcpkg/ports/poppler/export-unofficial-poppler.patch @@ -0,0 +1,93 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 81f5ed6..9fb059e 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -623,7 +623,12 @@ if(MSVC) + add_definitions(-D_CRT_SECURE_NO_WARNINGS) + endif() + add_library(poppler ${poppler_SRCS} ${LINKER_SCRIPT}) +-target_include_directories(poppler PUBLIC poppler ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/poppler) ++target_include_directories(poppler PUBLIC ++ $<INSTALL_INTERFACE:include/poppler> ++ $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/poppler> ++ $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}> ++ $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}> ++ $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/poppler>) + if (OpenJPEG_FOUND) + # check if we can remove this when we depend on newer openjpeg versions, 2.5 seems fixed + # target openjp2 may lack interface include directories +@@ -663,9 +668,16 @@ if(MINGW AND BUILD_SHARED_LIBS) + set_target_properties(poppler PROPERTIES SUFFIX "-${POPPLER_SOVERSION}${CMAKE_SHARED_LIBRARY_SUFFIX}") + endif() + target_link_libraries(poppler LINK_PRIVATE ${poppler_LIBS}) +-install(TARGETS poppler RUNTIME DESTINATION bin LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) ++install(TARGETS poppler EXPORT unofficial-poppler-targets ++ RUNTIME DESTINATION bin LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) ++install(EXPORT unofficial-poppler-targets NAMESPACE unofficial::poppler:: DESTINATION share/unofficial-poppler) ++set_target_properties(poppler PROPERTIES EXPORT_NAME poppler-private) + + if(ENABLE_UNSTABLE_API_ABI_HEADERS) ++ target_include_directories(poppler PUBLIC ++ $<INSTALL_INTERFACE:include/poppler/fofi> ++ $<INSTALL_INTERFACE:include/poppler/goo> ++ ) + set(poppler_poppler_installed_headers + poppler/Annot.h + poppler/AnnotStampImageHelper.h +@@ -785,7 +797,7 @@ if(ENABLE_UNSTABLE_API_ABI_HEADERS) + set(poppler_goo_installed_headers ${poppler_goo_installed_headers} goo/JpegWriter.h) + endif() + +- if (${CMAKE_VERSION} VERSION_LESS "3.23.0") ++ if (1) + install(FILES + ${poppler_poppler_installed_headers} + ${CMAKE_CURRENT_BINARY_DIR}/poppler/poppler-config.h +diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt +index b38814c..303dbba 100644 +--- a/cpp/CMakeLists.txt ++++ b/cpp/CMakeLists.txt +@@ -31,7 +31,9 @@ if(MINGW AND BUILD_SHARED_LIBS) + set_target_properties(poppler-cpp PROPERTIES SUFFIX "-${POPPLER_CPP_SOVERSION}${CMAKE_SHARED_LIBRARY_SUFFIX}") + endif() + target_link_libraries(poppler-cpp poppler Iconv::Iconv) +-install(TARGETS poppler-cpp RUNTIME DESTINATION bin LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) ++install(TARGETS poppler-cpp EXPORT unofficial-poppler-cpp-targets ++ RUNTIME DESTINATION bin LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) ++install(EXPORT unofficial-poppler-cpp-targets NAMESPACE unofficial::poppler:: DESTINATION share/unofficial-poppler) + + set(poppler_cpp_all_install_headers + poppler-destination.h +@@ -50,7 +52,7 @@ set(poppler_cpp_all_install_headers + ${CMAKE_CURRENT_BINARY_DIR}/poppler-version.h + ) + +-if (${CMAKE_VERSION} VERSION_LESS "3.23.0") ++if (1) + install(FILES ${poppler_cpp_all_install_headers} DESTINATION include/poppler/cpp) + else() + target_sources(poppler-cpp +diff --git a/qt6/src/CMakeLists.txt b/qt6/src/CMakeLists.txt +index 1062058..848434c 100644 +--- a/qt6/src/CMakeLists.txt ++++ b/qt6/src/CMakeLists.txt +@@ -47,7 +47,9 @@ if(USE_CMS) + target_link_libraries(poppler-qt6 poppler ${LCMS2_LIBRARIES}) + target_include_directories(poppler-qt6 SYSTEM PRIVATE ${LCMS2_INCLUDE_DIR}) + endif() +-install(TARGETS poppler-qt6 RUNTIME DESTINATION bin LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) ++install(TARGETS poppler-qt6 EXPORT unofficial-poppler-qt6-targets ++ RUNTIME DESTINATION bin LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) ++install(EXPORT unofficial-poppler-qt6-targets NAMESPACE unofficial::poppler:: DESTINATION share/unofficial-poppler) + + set(poppler_qt6_all_install_headers + poppler-qt6.h +@@ -61,7 +63,7 @@ set(poppler_qt6_all_install_headers + ${CMAKE_CURRENT_BINARY_DIR}/poppler-export.h + ${CMAKE_CURRENT_BINARY_DIR}/poppler-version.h + ) +-if (${CMAKE_VERSION} VERSION_LESS "3.23.0") ++if (1) + install(FILES ${poppler_qt6_all_install_headers} DESTINATION include/poppler/qt6) + else() + target_sources(poppler-qt6 diff --git a/vcpkg/ports/poppler/portfile.cmake b/vcpkg/ports/poppler/portfile.cmake new file mode 100644 index 0000000..57d6a91 --- /dev/null +++ b/vcpkg/ports/poppler/portfile.cmake @@ -0,0 +1,111 @@ +string(REGEX REPLACE "^([0-9]+)[.]([0-9][.])" "\\1.0\\2" POPPLER_VERSION "${VERSION}") +vcpkg_from_gitlab( + GITLAB_URL https://gitlab.freedesktop.org + OUT_SOURCE_PATH SOURCE_PATH + REPO poppler/poppler + REF "poppler-${POPPLER_VERSION}" + SHA512 24184d73503c77d614b20d8a2c2f8d77e40fd445ea2ceabdc5b77b5241ed45e053cc582af563284b1c9fd585bde3af5695cfe8fceff2efaf380499fb5f620f8c + HEAD_REF master + PATCHES + export-unofficial-poppler.patch + private-namespace.patch +) + +set(POPPLER_PC_REQUIRES "freetype2 libjpeg libopenjp2 libpng libtiff-4 poppler-vcpkg-iconv") + +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + FEATURES + cairo WITH_Cairo + cairo VCPKG_LOCK_FIND_PACKAGE_CAIRO + cms ENABLE_LCMS + cms VCPKG_LOCK_FIND_PACKAGE_LCMS2 + curl ENABLE_LIBCURL + curl VCPKG_LOCK_FIND_PACKAGE_CURL + glib ENABLE_GLIB + glib VCPKG_LOCK_FIND_PACKAGE_GLIB + private-api ENABLE_UNSTABLE_API_ABI_HEADERS + qt ENABLE_QT6 + qt VCPKG_LOCK_FIND_PACKAGE_Qt6 + zlib ENABLE_ZLIB_UNCOMPRESS +) +if("fontconfig" IN_LIST FEATURES) + list(APPEND FEATURE_OPTIONS "-DFONT_CONFIGURATION=fontconfig") + string(APPEND POPPLER_PC_REQUIRES " fontconfig") +elseif(VCPKG_TARGET_IS_ANDROID) + list(APPEND FEATURE_OPTIONS "-DFONT_CONFIGURATION=android") +elseif(VCPKG_TARGET_IS_WINDOWS) + list(APPEND FEATURE_OPTIONS "-DFONT_CONFIGURATION=win32") +else() + list(APPEND FEATURE_OPTIONS "-DFONT_CONFIGURATION=generic") +endif() +if("cairo" IN_LIST FEATURES) + string(APPEND POPPLER_PC_REQUIRES " cairo") +endif() +if("curl" IN_LIST FEATURES) + string(APPEND POPPLER_PC_REQUIRES " libcurl") +endif() +if("zlib" IN_LIST FEATURES) + string(APPEND POPPLER_PC_REQUIRES " zlib") +endif() + +if("cms" IN_LIST FEATURES) + string(APPEND POPPLER_PC_REQUIRES " lcms2") +endif() + +vcpkg_find_acquire_program(PKGCONFIG) +vcpkg_find_acquire_program(PYTHON3) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + "-DCMAKE_PROJECT_INCLUDE=${CMAKE_CURRENT_LIST_DIR}/cmake-project-include.cmake" + "-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}" + "-DGLIB2_MKENUMS_PYTHON=${PYTHON3}" + -DBUILD_GTK_TESTS=OFF + -DBUILD_QT5_TESTS=OFF + -DBUILD_QT6_TESTS=OFF + -DBUILD_CPP_TESTS=OFF + -DBUILD_MANUAL_TESTS=OFF + -DENABLE_UTILS=OFF + -DENABLE_GOBJECT_INTROSPECTION=OFF + -DENABLE_QT5=OFF + -DENABLE_RELOCATABLE=OFF # https://gitlab.freedesktop.org/poppler/poppler/-/issues/1209 + -DCMAKE_REQUIRE_FIND_PACKAGE_PkgConfig=ON + -DCMAKE_REQUIRE_FIND_PACKAGE_OpenJPEG=ON + -DCMAKE_REQUIRE_FIND_PACKAGE_JPEG=ON + -DCMAKE_REQUIRE_FIND_PACKAGE_TIFF=ON + -DCMAKE_REQUIRE_FIND_PACKAGE_PNG=ON + -DCMAKE_REQUIRE_FIND_PACKAGE_Boost=ON + -DENABLE_NSS3=OFF + -DENABLE_GPGME=OFF + -DRUN_GPERF_IF_PRESENT=OFF + -DVCPKG_LOCK_FIND_PACKAGE_ECM=OFF + -DVCPKG_LOCK_FIND_PACKAGE_GTK=OFF + ${FEATURE_OPTIONS} +-DVCPKG_TRACE_FIND_PACKAGE=1 + MAYBE_UNUSED_VARIABLES + GLIB2_MKENUMS_PYTHON + VCPKG_LOCK_FIND_PACKAGE_CURL + VCPKG_LOCK_FIND_PACKAGE_GLIB + VCPKG_LOCK_FIND_PACKAGE_LCMS2 + VCPKG_LOCK_FIND_PACKAGE_CAIRO + VCPKG_LOCK_FIND_PACKAGE_GTK + VCPKG_LOCK_FIND_PACKAGE_Qt6 +) +vcpkg_cmake_install() + +configure_file("${CMAKE_CURRENT_LIST_DIR}/unofficial-poppler-config.cmake" "${CURRENT_PACKAGES_DIR}/share/unofficial-poppler/unofficial-poppler-config.cmake" @ONLY) +vcpkg_cmake_config_fixup(PACKAGE_NAME unofficial-poppler) + +vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/poppler.pc" "Libs:" "Requires.private: ${POPPLER_PC_REQUIRES}\nLibs:") +if(NOT VCPKG_BUILD_TYPE) + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/poppler.pc" "Libs:" "Requires.private: ${POPPLER_PC_REQUIRES}\nLibs:") +endif() +vcpkg_fixup_pkgconfig() +vcpkg_copy_pdbs() + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") + +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING") + +file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") diff --git a/vcpkg/ports/poppler/private-namespace.patch b/vcpkg/ports/poppler/private-namespace.patch new file mode 100644 index 0000000..052fa0a --- /dev/null +++ b/vcpkg/ports/poppler/private-namespace.patch @@ -0,0 +1,50 @@ +diff --git a/poppler/Gfx.h b/poppler/Gfx.h +index 81a620b..ecfb449 100644 +--- a/poppler/Gfx.h ++++ b/poppler/Gfx.h +@@ -48,7 +48,10 @@ class PDFDoc; + class XRef; + class Array; + class Stream; ++namespace poppler_private { + class Parser; ++} ++using namespace poppler_private; + class Dict; + class Function; + class OutputDev; +diff --git a/poppler/Parser.h b/poppler/Parser.h +index b379b67..c3d85bd 100644 +--- a/poppler/Parser.h ++++ b/poppler/Parser.h +@@ -33,6 +33,7 @@ + // Parser + //------------------------------------------------------------------------ + ++namespace poppler_private { + class POPPLER_PRIVATE_EXPORT Parser + { + public: +@@ -72,5 +73,7 @@ private: + void shift(int objNum = -1); + void shift(const char *cmdA, int objNum); + }; ++} ++using namespace poppler_private; + + #endif +diff --git a/poppler/XRef.h b/poppler/XRef.h +index e2b2ca8..7d6acbb 100644 +--- a/poppler/XRef.h ++++ b/poppler/XRef.h +@@ -46,7 +46,10 @@ + + class Dict; + class Stream; ++namespace poppler_private { + class Parser; ++} ++using namespace poppler_private; + class ObjectStream; + + //------------------------------------------------------------------------ diff --git a/vcpkg/ports/poppler/unofficial-poppler-config.cmake b/vcpkg/ports/poppler/unofficial-poppler-config.cmake new file mode 100644 index 0000000..536a555 --- /dev/null +++ b/vcpkg/ports/poppler/unofficial-poppler-config.cmake @@ -0,0 +1,28 @@ +include(CMakeFindDependencyMacro) +cmake_policy(SET CMP0012 NEW) +cmake_policy(SET CMP0057 NEW) +set(features "@FEATURES@") +find_dependency(Boost) +if("fontconfig" IN_LIST features) + find_dependency(Fontconfig) # CMake 3.14 +endif() +find_dependency(Freetype) +find_dependency(JPEG) +find_dependency(PNG) +find_dependency(TIFF) +find_dependency(OpenJPEG CONFIG) +if("curl" IN_LIST features) + find_dependency(CURL) +endif() +if("zlib" IN_LIST features) + find_dependency(ZLIB) +endif() +if("qt" IN_LIST features) + find_dependency(Qt6 CONFIG Core GUI) +endif() +find_dependency(Iconv) # CMake 3.11 +include("${CMAKE_CURRENT_LIST_DIR}/unofficial-poppler-targets.cmake") +include("${CMAKE_CURRENT_LIST_DIR}/unofficial-poppler-cpp-targets.cmake") +if("qt" IN_LIST features) + include("${CMAKE_CURRENT_LIST_DIR}/unofficial-poppler-qt6-targets.cmake") +endif() diff --git a/vcpkg/ports/poppler/usage b/vcpkg/ports/poppler/usage new file mode 100644 index 0000000..d9b54e2 --- /dev/null +++ b/vcpkg/ports/poppler/usage @@ -0,0 +1,6 @@ +The package poppler can be imported via CMake FindPkgConfig module: + + find_package(PkgConfig) + pkg_check_modules(POPPLER_CPP REQUIRED IMPORTED_TARGET poppler-cpp) + + target_link_libraries(main PRIVATE PkgConfig::POPPLER_CPP) diff --git a/vcpkg/ports/poppler/vcpkg.json b/vcpkg/ports/poppler/vcpkg.json new file mode 100644 index 0000000..7712f46 --- /dev/null +++ b/vcpkg/ports/poppler/vcpkg.json @@ -0,0 +1,113 @@ +{ + "name": "poppler", + "version": "25.7.0", + "description": "A PDF rendering library", + "homepage": "https://poppler.freedesktop.org/", + "license": "GPL-2.0-or-later", + "supports": "!uwp & !xbox", + "dependencies": [ + "boost-container", + "freetype", + "libiconv", + "libjpeg-turbo", + "libpng", + "openjpeg", + { + "name": "tiff", + "default-features": false + }, + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + }, + "zlib" + ], + "default-features": [ + "font-configuration", + "zlib" + ], + "features": { + "cairo": { + "description": "Enable the Cairo graphics backend", + "dependencies": [ + { + "name": "cairo", + "default-features": false + } + ] + }, + "cms": { + "description": "Enable use of LCMS2 as color management system", + "dependencies": [ + "lcms" + ] + }, + "curl": { + "description": "curl for poppler", + "dependencies": [ + { + "name": "curl", + "default-features": false + } + ] + }, + "font-configuration": { + "description": "Defaut font configuration backend", + "dependencies": [ + { + "name": "poppler", + "default-features": false, + "features": [ + "fontconfig" + ], + "platform": "!windows & !android" + } + ] + }, + "fontconfig": { + "description": "Use fontconfig", + "supports": "!windows, mingw", + "dependencies": [ + "fontconfig" + ] + }, + "glib": { + "description": "glib for poppler", + "dependencies": [ + { + "name": "glib", + "default-features": false + }, + { + "name": "poppler", + "default-features": false, + "features": [ + "cairo" + ] + } + ] + }, + "private-api": { + "description": "Install headers for private API (aka unstable API/ABI headers)" + }, + "qt": { + "description": "Enable the Qt API", + "dependencies": [ + { + "name": "qtbase", + "default-features": false, + "features": [ + "gui" + ] + } + ] + }, + "zlib": { + "description": "Use zlib to uncompress flate streams (not totally safe)." + } + } +} |