From e18a62fdf23d8bce886e3ca46cca79739f8efa06 Mon Sep 17 00:00:00 2001 From: "taylor.fish" Date: Fri, 26 Jan 2024 17:22:15 -0800 Subject: [PATCH] Don't try to use nonexistent libpng optimizations 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. --- modules/juce_graphics/image_formats/juce_PNGLoader.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/juce_graphics/image_formats/juce_PNGLoader.cpp b/modules/juce_graphics/image_formats/juce_PNGLoader.cpp index 8fb1b109167a..c59838b9cdcc 100644 --- a/modules/juce_graphics/image_formats/juce_PNGLoader.cpp +++ b/modules/juce_graphics/image_formats/juce_PNGLoader.cpp @@ -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