Skip to content

Commit 6d2b266

Browse files
authored
LibPNG Unbundled (#4657)
1 parent 63bed8c commit 6d2b266

File tree

4 files changed

+34
-26
lines changed

4 files changed

+34
-26
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,8 @@ jobs:
190190
runs-on: ubuntu-22.04
191191
steps:
192192
- uses: actions/checkout@v4
193-
- 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
194-
- run: cmake -S. -Bcmake-build -GNinja -DENABLE_PDF=OFF -DENABLE_TESTS=ON -DPOCO_UNBUNDLED=ON && cmake --build cmake-build --target all
193+
- 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
194+
- run: cmake -S. -Bcmake-build -GNinja -DENABLE_PDF=OFF -DENABLE_TESTS=ON -DPOCO_UNBUNDLED=ON -DENABLE_PDF=ON && cmake --build cmake-build --target all
195195
- uses: ./.github/actions/retry-action
196196
with:
197197
timeout_minutes: 90

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,9 +232,9 @@ else()
232232
endif()
233233

234234
if(POCO_UNBUNDLED)
235-
message(STATUS "Using external sqlite, zlib, pcre2, expat, ...")
235+
message(STATUS "Using external sqlite, zlib, pcre2, expat, libpng, ...")
236236
else()
237-
message(STATUS "Using internal sqlite, zlib, pcre2, expat, ...")
237+
message(STATUS "Using internal sqlite, zlib, pcre2, expat, libpng, ...")
238238
endif()
239239

240240
# Disable fork exec

PDF/CMakeLists.txt

Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -90,28 +90,30 @@ POCO_SOURCES(SRCS hpdf
9090
src/hpdf_xref.c
9191
)
9292

93-
# TODO: Currently only bundled is supported, in future this should also be possible
94-
# with an unbundled version of libpng
95-
POCO_SOURCES(SRCS libpng
96-
src/png.c
97-
src/pngerror.c
98-
src/pnggccrd.c
99-
src/pngget.c
100-
src/pngmem.c
101-
src/pngpread.c
102-
src/pngread.c
103-
src/pngrio.c
104-
src/pngrtran.c
105-
src/pngrutil.c
106-
src/pngset.c
107-
src/pngtest.c
108-
src/pngtrans.c
109-
src/pngvcrd.c
110-
src/pngwio.c
111-
src/pngwrite.c
112-
src/pngwtran.c
113-
src/pngwutil.c
114-
)
93+
if(POCO_UNBUNDLED)
94+
find_package(PNG REQUIRED)
95+
else()
96+
POCO_SOURCES(SRCS libpng
97+
src/png.c
98+
src/pngerror.c
99+
src/pnggccrd.c
100+
src/pngget.c
101+
src/pngmem.c
102+
src/pngpread.c
103+
src/pngread.c
104+
src/pngrio.c
105+
src/pngrtran.c
106+
src/pngrutil.c
107+
src/pngset.c
108+
src/pngtest.c
109+
src/pngtrans.c
110+
src/pngvcrd.c
111+
src/pngwio.c
112+
src/pngwrite.c
113+
src/pngwtran.c
114+
src/pngwutil.c
115+
)
116+
endif(POCO_UNBUNDLED)
115117

116118
# Version Resource
117119
if(MSVC AND BUILD_SHARED_LIBS)
@@ -132,9 +134,14 @@ set_target_properties(PDF
132134
)
133135

134136
if(POCO_UNBUNDLED)
137+
include_directories(${PNG_INCLUDE_DIR})
138+
135139
target_link_libraries(PDF PUBLIC ZLIB::ZLIB)
140+
target_link_libraries(PDF PUBLIC ${PNG_LIBRARY})
136141
target_compile_definitions(PDF PUBLIC POCO_UNBUNDLED)
142+
137143
endif(POCO_UNBUNDLED)
144+
138145
target_link_libraries(PDF PUBLIC Poco::XML Poco::Util)
139146
target_include_directories(PDF
140147
PUBLIC

PDF/cmake/PocoPDFConfig.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ include(CMakeFindDependencyMacro)
22
find_dependency(PocoFoundation)
33
if(@POCO_UNBUNDLED@)
44
find_dependency(ZLIB REQUIRED)
5+
find_dependency(PNG REQUIRED)
56
endif()
67

78
include("${CMAKE_CURRENT_LIST_DIR}/PocoPDFTargets.cmake")

0 commit comments

Comments
 (0)