Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 39 additions & 5 deletions cmake/ext_imgcodecs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,25 @@ set(_IMGCODEC_ROOT_DIR ${dlib_SOURCE_DIR}/dlib/external)
#
# ----------------------------------------------------------------------------
set (PNG_LIBRARY "libpng_static_c")
set (libPNG_SOURCE_DIR ${_IMGCODEC_ROOT_DIR}/libpng)

if(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64|ppc64le")
message(STATUS "Using upstream libpng for PowerPC")
include(FetchContent)
FetchContent_Declare(
libpng_external
GIT_REPOSITORY https://github.com/pnggroup/libpng.git
GIT_TAG v1.6.56 # latest version
)

FetchContent_MakeAvailable(libpng_external)

set(libPNG_SOURCE_DIR ${libpng_external_SOURCE_DIR})

else()
# default (dlib bundled)
set(libPNG_SOURCE_DIR ${_IMGCODEC_ROOT_DIR}/libpng)
endif()

set (zlib_SOURCE_DIR ${_IMGCODEC_ROOT_DIR}/zlib)

if(NOT WIN32)
Expand All @@ -24,10 +42,26 @@ else()
set(M_LIBRARY "")
endif()

set(lib_srcs
${libPNG_SOURCE_DIR}/arm/arm_init.c
${libPNG_SOURCE_DIR}/arm/filter_neon_intrinsics.c
${libPNG_SOURCE_DIR}/arm/palette_neon_intrinsics.c
# Add architecture-specific PNG optimizations
set(lib_srcs)

# PowerPC VSX optimizations
if(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64|ppc64le")
Copy link
Copy Markdown
Collaborator

@sayanshaw24 sayanshaw24 Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we have one if/else here instead of 2 if's in case the processor name is something unexpected (check for ppc and fallback to current arm srcs)?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated it. Please review @https://github.com/sayanshaw24

list(APPEND lib_srcs
${libPNG_SOURCE_DIR}/powerpc/powerpc_init.c
${libPNG_SOURCE_DIR}/powerpc/filter_vsx_intrinsics.c
)

else()
list(APPEND lib_srcs
${libPNG_SOURCE_DIR}/arm/arm_init.c
${libPNG_SOURCE_DIR}/arm/filter_neon_intrinsics.c
${libPNG_SOURCE_DIR}/arm/palette_neon_intrinsics.c
)
endif()

# Common PNG sources
list(APPEND lib_srcs
${libPNG_SOURCE_DIR}//png.c
${libPNG_SOURCE_DIR}//pngerror.c
${libPNG_SOURCE_DIR}//pngget.c
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ line-length = 120
[tool.cibuildwheel]
# Note: the below skip command doesn't do much currently, the platforms to
# build wheels for in CI are controlled in `wheels_linux` and `wheels_macos.yml`.
skip = "cp36-* cp37-* pp37-* *-manylinux_i686 *_ppc64le *_s390x *-musllinux_aarch64"
skip = "cp36-* cp37-* pp37-* *-manylinux_i686 *_s390x *-musllinux_aarch64"
build-verbosity = "3"

[[tool.cibuildwheel.overrides]]
Expand Down
Loading