LibPNG Unbundled (#4657)

This commit is contained in:
Dan Rosser 2024-08-29 21:46:31 +10:00 committed by GitHub
parent 63bed8c8d3
commit 6d2b26645a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 34 additions and 26 deletions

View File

@ -190,8 +190,8 @@ jobs:
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- run: sudo apt -y update && sudo apt -y install cmake ninja-build libssl-dev unixodbc-dev libmysqlclient-dev redis-server libexpat1-dev zlib1g-dev libpcre3-dev - run: sudo apt -y update && sudo apt -y install cmake ninja-build libssl-dev unixodbc-dev libmysqlclient-dev redis-server libexpat1-dev zlib1g-dev libpcre3-dev libpng-dev
- run: cmake -S. -Bcmake-build -GNinja -DENABLE_PDF=OFF -DENABLE_TESTS=ON -DPOCO_UNBUNDLED=ON && cmake --build cmake-build --target all - run: cmake -S. -Bcmake-build -GNinja -DENABLE_PDF=OFF -DENABLE_TESTS=ON -DPOCO_UNBUNDLED=ON -DENABLE_PDF=ON && cmake --build cmake-build --target all
- uses: ./.github/actions/retry-action - uses: ./.github/actions/retry-action
with: with:
timeout_minutes: 90 timeout_minutes: 90

View File

@ -232,9 +232,9 @@ else()
endif() endif()
if(POCO_UNBUNDLED) if(POCO_UNBUNDLED)
message(STATUS "Using external sqlite, zlib, pcre2, expat, ...") message(STATUS "Using external sqlite, zlib, pcre2, expat, libpng, ...")
else() else()
message(STATUS "Using internal sqlite, zlib, pcre2, expat, ...") message(STATUS "Using internal sqlite, zlib, pcre2, expat, libpng, ...")
endif() endif()
# Disable fork exec # Disable fork exec

View File

@ -90,28 +90,30 @@ POCO_SOURCES(SRCS hpdf
src/hpdf_xref.c src/hpdf_xref.c
) )
# TODO: Currently only bundled is supported, in future this should also be possible if(POCO_UNBUNDLED)
# with an unbundled version of libpng find_package(PNG REQUIRED)
POCO_SOURCES(SRCS libpng else()
src/png.c POCO_SOURCES(SRCS libpng
src/pngerror.c src/png.c
src/pnggccrd.c src/pngerror.c
src/pngget.c src/pnggccrd.c
src/pngmem.c src/pngget.c
src/pngpread.c src/pngmem.c
src/pngread.c src/pngpread.c
src/pngrio.c src/pngread.c
src/pngrtran.c src/pngrio.c
src/pngrutil.c src/pngrtran.c
src/pngset.c src/pngrutil.c
src/pngtest.c src/pngset.c
src/pngtrans.c src/pngtest.c
src/pngvcrd.c src/pngtrans.c
src/pngwio.c src/pngvcrd.c
src/pngwrite.c src/pngwio.c
src/pngwtran.c src/pngwrite.c
src/pngwutil.c src/pngwtran.c
) src/pngwutil.c
)
endif(POCO_UNBUNDLED)
# Version Resource # Version Resource
if(MSVC AND BUILD_SHARED_LIBS) if(MSVC AND BUILD_SHARED_LIBS)
@ -132,9 +134,14 @@ set_target_properties(PDF
) )
if(POCO_UNBUNDLED) if(POCO_UNBUNDLED)
include_directories(${PNG_INCLUDE_DIR})
target_link_libraries(PDF PUBLIC ZLIB::ZLIB) target_link_libraries(PDF PUBLIC ZLIB::ZLIB)
target_link_libraries(PDF PUBLIC ${PNG_LIBRARY})
target_compile_definitions(PDF PUBLIC POCO_UNBUNDLED) target_compile_definitions(PDF PUBLIC POCO_UNBUNDLED)
endif(POCO_UNBUNDLED) endif(POCO_UNBUNDLED)
target_link_libraries(PDF PUBLIC Poco::XML Poco::Util) target_link_libraries(PDF PUBLIC Poco::XML Poco::Util)
target_include_directories(PDF target_include_directories(PDF
PUBLIC PUBLIC

View File

@ -2,6 +2,7 @@ include(CMakeFindDependencyMacro)
find_dependency(PocoFoundation) find_dependency(PocoFoundation)
if(@POCO_UNBUNDLED@) if(@POCO_UNBUNDLED@)
find_dependency(ZLIB REQUIRED) find_dependency(ZLIB REQUIRED)
find_dependency(PNG REQUIRED)
endif() endif()
include("${CMAKE_CURRENT_LIST_DIR}/PocoPDFTargets.cmake") include("${CMAKE_CURRENT_LIST_DIR}/PocoPDFTargets.cmake")