diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0c84f58b9..7a3a474ce 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -190,8 +190,8 @@ jobs: runs-on: ubuntu-22.04 steps: - 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: cmake -S. -Bcmake-build -GNinja -DENABLE_PDF=OFF -DENABLE_TESTS=ON -DPOCO_UNBUNDLED=ON && cmake --build cmake-build --target all + - 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 -DENABLE_PDF=ON && cmake --build cmake-build --target all - uses: ./.github/actions/retry-action with: timeout_minutes: 90 diff --git a/CMakeLists.txt b/CMakeLists.txt index c1107521b..3cc5cfa39 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -232,9 +232,9 @@ else() endif() if(POCO_UNBUNDLED) - message(STATUS "Using external sqlite, zlib, pcre2, expat, ...") + message(STATUS "Using external sqlite, zlib, pcre2, expat, libpng, ...") else() - message(STATUS "Using internal sqlite, zlib, pcre2, expat, ...") + message(STATUS "Using internal sqlite, zlib, pcre2, expat, libpng, ...") endif() # Disable fork exec diff --git a/PDF/CMakeLists.txt b/PDF/CMakeLists.txt index f0c16350e..b2492487e 100644 --- a/PDF/CMakeLists.txt +++ b/PDF/CMakeLists.txt @@ -90,28 +90,30 @@ POCO_SOURCES(SRCS hpdf src/hpdf_xref.c ) -# TODO: Currently only bundled is supported, in future this should also be possible -# with an unbundled version of libpng -POCO_SOURCES(SRCS libpng - src/png.c - src/pngerror.c - src/pnggccrd.c - src/pngget.c - src/pngmem.c - src/pngpread.c - src/pngread.c - src/pngrio.c - src/pngrtran.c - src/pngrutil.c - src/pngset.c - src/pngtest.c - src/pngtrans.c - src/pngvcrd.c - src/pngwio.c - src/pngwrite.c - src/pngwtran.c - src/pngwutil.c -) +if(POCO_UNBUNDLED) + find_package(PNG REQUIRED) +else() + POCO_SOURCES(SRCS libpng + src/png.c + src/pngerror.c + src/pnggccrd.c + src/pngget.c + src/pngmem.c + src/pngpread.c + src/pngread.c + src/pngrio.c + src/pngrtran.c + src/pngrutil.c + src/pngset.c + src/pngtest.c + src/pngtrans.c + src/pngvcrd.c + src/pngwio.c + src/pngwrite.c + src/pngwtran.c + src/pngwutil.c + ) +endif(POCO_UNBUNDLED) # Version Resource if(MSVC AND BUILD_SHARED_LIBS) @@ -132,9 +134,14 @@ set_target_properties(PDF ) if(POCO_UNBUNDLED) + include_directories(${PNG_INCLUDE_DIR}) + target_link_libraries(PDF PUBLIC ZLIB::ZLIB) + target_link_libraries(PDF PUBLIC ${PNG_LIBRARY}) target_compile_definitions(PDF PUBLIC POCO_UNBUNDLED) + endif(POCO_UNBUNDLED) + target_link_libraries(PDF PUBLIC Poco::XML Poco::Util) target_include_directories(PDF PUBLIC diff --git a/PDF/cmake/PocoPDFConfig.cmake b/PDF/cmake/PocoPDFConfig.cmake index bc8aad35f..36bae9b96 100644 --- a/PDF/cmake/PocoPDFConfig.cmake +++ b/PDF/cmake/PocoPDFConfig.cmake @@ -2,6 +2,7 @@ include(CMakeFindDependencyMacro) find_dependency(PocoFoundation) if(@POCO_UNBUNDLED@) find_dependency(ZLIB REQUIRED) + find_dependency(PNG REQUIRED) endif() include("${CMAKE_CURRENT_LIST_DIR}/PocoPDFTargets.cmake")