Skip to content

Commit

Permalink
Don't try to use nonexistent libpng optimizations
Browse files Browse the repository at this point in the history
The embedded copy of libpng doesn't contain code for processor-specific
hardware optimizations, but it may still try to use them in some cases,
resulting in linker errors.

juce_PNGLoader.cpp already sets `PNG_ARM_NEON_OPT` to 0 to disable
optimizations on ARM, but this should be done for all architectures,
especially PowerPC, where builds currently fail.

On x86, this isn't strictly necessary, because libpng optimizations are
opt-in for x86, rather than opt-out as with all other architectures, but
for completeness and robustness it is also included here.

The macros to disable optimizations on other platforms come straight
from libpng's own build files; this is how it disables optimizations
when compiled without support for them. `PNG_ARM_NEON_OPT` is already
one of those macros; this commit simply adds the other three.
  • Loading branch information
taylordotfish committed Jan 27, 2024
1 parent 6c32c4d commit e18a62f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions modules/juce_graphics/image_formats/juce_PNGLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,9 @@ namespace pnglibNamespace
#define PNG_LINKAGE_FUNCTION

#define PNG_ARM_NEON_OPT 0
#define PNG_POWERPC_VSX_OPT 0
#define PNG_INTEL_SSE_OPT 0
#define PNG_MIPS_MSA_OPT 0

#if ! defined (PNG_USER_WIDTH_MAX)
#define PNG_USER_WIDTH_MAX 1000000
Expand Down

0 comments on commit e18a62f

Please sign in to comment.