From e2a669684cab8c0c2f9e18ab774ceab817b1ec3e Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Mon, 19 Jan 2026 10:23:34 -0800
Subject: [PATCH] Don't enable libpng support by default in xcframework
Apple doesn't allow directly linking to libpng symbols. We could potentially rename them all as a workaround, but that's out of scope of this change.
---
Xcode/config.xcconfig | 1 +
Xcode/pkg-support/build.xcconfig | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/Xcode/config.xcconfig b/Xcode/config.xcconfig
index 73d8718c..37c085c3 100644
--- a/Xcode/config.xcconfig
+++ b/Xcode/config.xcconfig
@@ -20,6 +20,7 @@
// Uncomment these lines to enable libpng support
// If you do this, you should run external/download.sh to download the decode libraries and add png.framework to your application bundle.
+// WARNING: Enabling this will prevent your application from passing App Store review, as linking directly with libpng is not allowed.
//PNG_PREPROCESSOR_DEFINITIONS = SDL_IMAGE_LIBPNG INCLUDE_PNG_FRAMEWORK
//PNG_FRAMEWORK_LDFLAGS = -weak_framework png
diff --git a/Xcode/pkg-support/build.xcconfig b/Xcode/pkg-support/build.xcconfig
index 66389bf7..bd85869f 100644
--- a/Xcode/pkg-support/build.xcconfig
+++ b/Xcode/pkg-support/build.xcconfig
@@ -17,8 +17,8 @@ JXL_FRAMEWORK_LDFLAGS = -weak_framework jxl
// Uncomment these lines to enable libpng support
// If you do this, you should run external/download.sh to download the decode libraries and add png.framework to your application bundle.
-PNG_PREPROCESSOR_DEFINITIONS = SDL_IMAGE_LIBPNG INCLUDE_PNG_FRAMEWORK
-PNG_FRAMEWORK_LDFLAGS = -weak_framework png
+//PNG_PREPROCESSOR_DEFINITIONS = SDL_IMAGE_LIBPNG INCLUDE_PNG_FRAMEWORK
+//PNG_FRAMEWORK_LDFLAGS = -weak_framework png
// Uncomment these lines to enable WebP support
// If you do this, you should run external/download.sh to download the decode libraries and add webp.framework to your application bundle.