package/sdl3_image: add optional support for avif, jpeg, tiff, webp, jxl

Signed-off-by: Alsey Coleman Miller <alseycmiller@gmail.com>
[Thomas: extracted from https://patchwork.buildroot.org/project/buildroot/patch/20260816191830.533747-5-alseycmiller@gmail.com/]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This commit is contained in:
Alsey Coleman Miller
2026-10-19 23:00:27 +02:00
committed by Thomas Petazzoni
parent 785365def7
commit 396e388f83
2 changed files with 47 additions and 2 deletions

View File

@@ -3,7 +3,13 @@ config BR2_PACKAGE_SDL3_IMAGE
depends on BR2_PACKAGE_SDL3
help
SDL3_image is an image file loading library. It loads images
as SDL surfaces, and supports the following formats: BMP,
GIF, JPEG, LBM, PCX, PNG, PNM, TGA, TIFF, XCF, XPM, XV.
as SDL surfaces, and supports the following formats: AVIF,
BMP, GIF, JPEG, JXL, LBM, PCX, PNG, PNM, QOI, SVG, TGA, TIFF,
WEBP, XCF, XPM, XV.
The formats needing a helper library are built according to
the image libraries enabled in the configuration (jpeg,
libpng, tiff, webp, libjxl, libavif); the rest are decoded by
SDL3_image itself and are always available.
http://www.libsdl.org/projects/SDL_image/

View File

@@ -21,6 +21,24 @@ SDL3_IMAGE_CONF_OPTS = \
-DSDLIMAGE_TESTS=OFF \
-DSDLIMAGE_INSTALL_MAN=OFF
# Without jpeg, JPEG support falls back to the bundled stb_image
# decoder rather than being dropped.
ifeq ($(BR2_PACKAGE_JPEG),y)
SDL3_IMAGE_DEPENDENCIES += jpeg
SDL3_IMAGE_CONF_OPTS += \
-DSDLIMAGE_BACKEND_STB=OFF \
-DSDLIMAGE_JPG=ON
else
SDL3_IMAGE_CONF_OPTS += -DSDLIMAGE_BACKEND_STB=ON
endif
ifeq ($(BR2_PACKAGE_LIBAVIF),y)
SDL3_IMAGE_DEPENDENCIES += libavif
SDL3_IMAGE_CONF_OPTS += -DSDLIMAGE_AVIF=ON
else
SDL3_IMAGE_CONF_OPTS += -DSDLIMAGE_AVIF=OFF
endif
ifeq ($(BR2_PACKAGE_LIBPNG),y)
SDL3_IMAGE_DEPENDENCIES += libpng
SDL3_IMAGE_CONF_OPTS += -DSDLIMAGE_PNG=ON -DSDLIMAGE_PNG_LIBPNG=ON
@@ -28,4 +46,25 @@ else
SDL3_IMAGE_CONF_OPTS += -DSDLIMAGE_PNG=OFF -DSDLIMAGE_PNG_LIBPNG=OFF
endif
ifeq ($(BR2_PACKAGE_TIFF),y)
SDL3_IMAGE_DEPENDENCIES += tiff
SDL3_IMAGE_CONF_OPTS += -DSDLIMAGE_TIF=ON
else
SDL3_IMAGE_CONF_OPTS += -DSDLIMAGE_TIF=OFF
endif
ifeq ($(BR2_PACKAGE_WEBP_DEMUX)$(BR2_PACKAGE_WEBP_MUX),yy)
SDL3_IMAGE_DEPENDENCIES += webp
SDL3_IMAGE_CONF_OPTS += -DSDLIMAGE_WEBP=ON
else
SDL3_IMAGE_CONF_OPTS += -DSDLIMAGE_WEBP=OFF
endif
ifeq ($(BR2_PACKAGE_LIBJXL),y)
SDL3_IMAGE_DEPENDENCIES += libjxl
SDL3_IMAGE_CONF_OPTS += -DSDLIMAGE_JXL=ON
else
SDL3_IMAGE_CONF_OPTS += -DSDLIMAGE_JXL=OFF
endif
$(eval $(cmake-package))