From 8daafb8bb55eebf98b5dda0ec550f06ffc746bc7 Mon Sep 17 00:00:00 2001
From: Anonymous Maarten <[EMAIL REDACTED]>
Date: Thu, 15 Aug 2024 23:43:47 +0200
Subject: [PATCH] cmake: rename 'SDL3IMAGE_' prefix to 'SDLIMAGE_'
---
.github/workflows/main.yml | 26 +-
CMakeLists.txt | 600 +++++++++---------
README.txt | 2 +-
.../pkg-support/cmake/sdl3_image-config.cmake | 46 +-
.../resources/CMake/sdl3_image-config.cmake | 52 +-
build-scripts/android-prefab.sh | 40 +-
cmake/SDL3_imageConfig.cmake.in | 90 +--
test/CMakeLists.txt | 14 +-
test/README.md | 4 +-
9 files changed, 437 insertions(+), 437 deletions(-)
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index f357c6ed..0b31b4bd 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -16,9 +16,9 @@ jobs:
matrix:
platform:
- { name: Windows (MSVC), os: windows-latest, shell: sh, vendored: true, msvc: 1, shared: 1, static: 0, artifact: 'SDL3_image-VC-x64',
- cmake: '-DSDL3IMAGE_BACKEND_STB=OFF -DPerl_ROOT=C:/Strawberry/perl/bin/ -GNinja -DCMAKE_POLICY_DEFAULT_CMP0141=NEW -DCMAKE_MSVC_DEBUG_INFORMATION_FORMAT=ProgramDatabase -DCMAKE_EXE_LINKER_FLAGS=-DEBUG -DCMAKE_SHARED_LINKER_FLAGS=-DEBUG' }
+ cmake: '-DSDLIMAGE_BACKEND_STB=OFF -DPerl_ROOT=C:/Strawberry/perl/bin/ -GNinja -DCMAKE_POLICY_DEFAULT_CMP0141=NEW -DCMAKE_MSVC_DEBUG_INFORMATION_FORMAT=ProgramDatabase -DCMAKE_EXE_LINKER_FLAGS=-DEBUG -DCMAKE_SHARED_LINKER_FLAGS=-DEBUG' }
- { name: Windows (mingw64), os: windows-latest, shell: 'msys2 {0}', vendored: false, msystem: mingw64, msys-env: mingw-w64-x86_64, shared: 1, static: 0, artifact: 'SDL3_image-mingw64',
- cmake: '-DSDL3IMAGE_BACKEND_STB=OFF -DSDL3IMAGE_BACKEND_WIC=OFF -DSDL3IMAGE_AVIF=ON -G "Ninja Multi-Config"' }
+ cmake: '-DSDLIMAGE_BACKEND_STB=OFF -DSDLIMAGE_BACKEND_WIC=OFF -DSDLIMAGE_AVIF=ON -G "Ninja Multi-Config"' }
- { name: Linux, os: ubuntu-latest, shell: sh, vendored: false, cmake: '-GNinja', shared: 1, static: 0, noavif: true, nojxl: true, artifact: 'SDL3_image-linux-x64' }
- { name: 'Linux (static)', os: ubuntu-latest, shell: sh, vendored: true, cmake: '-DBUILD_SHARED_LIBS=OFF -GNinja', shared: 0, static: 1, artifact: 'SDL3_image-static-linux-x64' }
- { name: Macos, os: macos-latest, shell: sh, vendored: false, cmake: '-GNinja', shared: 1, static: 0, artifact: 'SDL3_image-macos' }
@@ -97,19 +97,19 @@ jobs:
run: |
export CMAKE_CONFIGURATION_TYPES=Release
cmake -B build \
- -DSDL3IMAGE_VENDORED=${{ matrix.platform.vendored }} \
+ -DSDLIMAGE_VENDORED=${{ matrix.platform.vendored }} \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_BUILD_TYPE=Release \
- -DSDL3IMAGE_SAMPLES=ON \
- -DSDL3IMAGE_TESTS=ON \
- -DSDL3IMAGE_TESTS_INSTALL=ON \
- -DSDL3IMAGE_AVIF=${{ !matrix.platform.noavif }} \
- -DSDL3IMAGE_JXL=${{ !matrix.platform.nojxl }} \
- -DSDL3IMAGE_TIF=ON \
- -DSDL3IMAGE_WEBP=ON \
- -DSDL3IMAGE_STRICT=ON \
- -DSDL3IMAGE_WERROR=ON \
- -DSDL3IMAGE_INSTALL_MAN=ON \
+ -DSDLIMAGE_SAMPLES=ON \
+ -DSDLIMAGE_TESTS=ON \
+ -DSDLIMAGE_TESTS_INSTALL=ON \
+ -DSDLIMAGE_AVIF=${{ !matrix.platform.noavif }} \
+ -DSDLIMAGE_JXL=${{ !matrix.platform.nojxl }} \
+ -DSDLIMAGE_TIF=ON \
+ -DSDLIMAGE_WEBP=ON \
+ -DSDLIMAGE_STRICT=ON \
+ -DSDLIMAGE_WERROR=ON \
+ -DSDLIMAGE_INSTALL_MAN=ON \
-DCMAKE_INSTALL_PREFIX=prefix_cmake \
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=$PWD/build \
-DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE=$PWD/build \
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 81c8529a..88ba575c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -27,14 +27,14 @@ sdl_calculate_derived_version_variables(${MAJOR_VERSION} ${MINOR_VERSION} ${MICR
message(STATUS "Configuring ${PROJECT_NAME} ${PROJECT_VERSION}")
if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
- set(SDL3IMAGE_ROOTPROJECT ON)
+ set(SDLIMAGE_ROOTPROJECT ON)
else()
- set(SDL3IMAGE_ROOTPROJECT OFF)
+ set(SDLIMAGE_ROOTPROJECT OFF)
endif()
-set(SDL3IMAGE_SAMPLES_DEFAULT ${SDL3IMAGE_ROOTPROJECT})
+set(SDLIMAGE_SAMPLES_DEFAULT ${SDLIMAGE_ROOTPROJECT})
if(ANDROID)
- set(SDL3IMAGE_SAMPLES_DEFAULT OFF)
+ set(SDLIMAGE_SAMPLES_DEFAULT OFF)
endif()
# Assume MSVC projects don't have a package manager and need vendored dependencies (by default).
@@ -45,10 +45,10 @@ else()
set(vendored_default OFF)
endif()
-set(sdl3image_install_enableable ON)
+set(sdlimage_install_enableable ON)
if((TARGET SDL3-shared OR TARGET SDL3-static) AND SDL_DISABLE_INSTALL)
# Cannot install SDL3_image when SDL3 is built in same built, and is not installed.
- set(sdl3image_install_enableable OFF)
+ set(sdlimage_install_enableable OFF)
endif()
if(NOT DEFINED CMAKE_FIND_PACKAGE_PREFER_CONFIG)
@@ -67,144 +67,144 @@ endif()
option(CMAKE_POSITION_INDEPENDENT_CODE "Build static libraries with -fPIC" ${PLATFORM_SUPPORTS_SHARED})
cmake_dependent_option(BUILD_SHARED_LIBS "Build the library as a shared library" ON PLATFORM_SUPPORTS_SHARED OFF)
-cmake_dependent_option(SDL3IMAGE_INSTALL "Enable SDL3_image install target" ${SDL3IMAGE_ROOTPROJECT} "${sdl3image_install_enableable}" OFF)
-cmake_dependent_option(SDL3IMAGE_INSTALL_CPACK "Create binary SDL3_image archive using CPack" ${SDL3IMAGE_ROOTPROJECT} "SDL3IMAGE_INSTALL" OFF)
-cmake_dependent_option(SDL3IMAGE_INSTALL_MAN "Install man pages for SDL3_image" OFF "SDL3IMAGE_INSTALL" OFF)
-cmake_dependent_option(SDL3IMAGE_DEPS_SHARED "Load dependencies dynamically" ON PLATFORM_SUPPORTS_SHARED OFF)
-option(SDL3IMAGE_VENDORED "Use vendored third-party libraries" ${vendored_default})
-option(SDL3IMAGE_WERROR "Treat warnings as errors" OFF)
+cmake_dependent_option(SDLIMAGE_INSTALL "Enable SDL3_image install target" ${SDLIMAGE_ROOTPROJECT} "${sdlimage_install_enableable}" OFF)
+cmake_dependent_option(SDLIMAGE_INSTALL_CPACK "Create binary SDL3_image archive using CPack" ${SDLIMAGE_ROOTPROJECT} "SDLIMAGE_INSTALL" OFF)
+cmake_dependent_option(SDLIMAGE_INSTALL_MAN "Install man pages for SDL3_image" OFF "SDLIMAGE_INSTALL" OFF)
+cmake_dependent_option(SDLIMAGE_DEPS_SHARED "Load dependencies dynamically" ON PLATFORM_SUPPORTS_SHARED OFF)
+option(SDLIMAGE_VENDORED "Use vendored third-party libraries" ${vendored_default})
+option(SDLIMAGE_WERROR "Treat warnings as errors" OFF)
-option(SDL3IMAGE_STRICT "Fail when a dependency could not be found" OFF)
+option(SDLIMAGE_STRICT "Fail when a dependency could not be found" OFF)
set(required "")
set(fatal_error "STATUS")
-if(SDL3IMAGE_STRICT)
+if(SDLIMAGE_STRICT)
set(required "REQUIRED")
set(fatal_error "FATAL_ERROR")
endif()
-option(SDL3IMAGE_SAMPLES "Build the SDL3_image sample program(s)" ${SDL3IMAGE_SAMPLES_DEFAULT})
-cmake_dependent_option(SDL3IMAGE_SAMPLES_INSTALL "Install the SDL3_image sample program(s)" OFF "SDL3IMAGE_SAMPLES;SDL3IMAGE_INSTALL" OFF)
-
-option(SDL3IMAGE_TESTS "Build unit tests?" OFF)
-option(SDL3IMAGE_TESTS_INSTALL "Install unit tests?" OFF)
-
-option(SDL3IMAGE_BACKEND_STB "Use stb_image for loading JPEG and PNG files" ON)
-cmake_dependent_option(SDL3IMAGE_BACKEND_WIC "Add WIC backend (Windows Imaging Component)" OFF WIN32 OFF)
-cmake_dependent_option(SDL3IMAGE_BACKEND_IMAGEIO "Use native Mac OS X frameworks for loading images" ON APPLE OFF)
-
-option(SDL3IMAGE_AVIF "Support loading AVIF images" ON)
-option(SDL3IMAGE_BMP "Support loading BMP images" ON)
-option(SDL3IMAGE_GIF "Support loading GIF images" ON)
-option(SDL3IMAGE_JPG "Support loading JPEG images" ON)
-option(SDL3IMAGE_JXL "Support loading JXL images" OFF)
-option(SDL3IMAGE_LBM "Support loading LBM images" ON)
-option(SDL3IMAGE_PCX "Support loading PCX images" ON)
-option(SDL3IMAGE_PNG "Support loading PNG images" ON)
-option(SDL3IMAGE_PNM "Support loading PNM images" ON)
-option(SDL3IMAGE_QOI "Support loading QOI images" ON)
-option(SDL3IMAGE_SVG "Support loading SVG images" ON)
-option(SDL3IMAGE_TGA "Support loading TGA images" ON)
-option(SDL3IMAGE_TIF "Support loading TIFF images" ON)
-option(SDL3IMAGE_WEBP "Support loading WEBP images" ON)
-option(SDL3IMAGE_XCF "Support loading XCF images" ON)
-option(SDL3IMAGE_XPM "Support loading XPM images" ON)
-option(SDL3IMAGE_XV "Support loading XV images" ON)
-
-cmake_dependent_option(SDL3IMAGE_AVIF_SAVE "Add AVIF save support" ON SDL3IMAGE_AVIF OFF)
-cmake_dependent_option(SDL3IMAGE_JPG_SAVE "Add JPEG save support" ON SDL3IMAGE_JPG OFF)
-cmake_dependent_option(SDL3IMAGE_PNG_SAVE "Add PNG save support" ON SDL3IMAGE_PNG OFF)
+option(SDLIMAGE_SAMPLES "Build the SDL3_image sample program(s)" ${SDLIMAGE_SAMPLES_DEFAULT})
+cmake_dependent_option(SDLIMAGE_SAMPLES_INSTALL "Install the SDL3_image sample program(s)" OFF "SDLIMAGE_SAMPLES;SDLIMAGE_INSTALL" OFF)
+
+option(SDLIMAGE_TESTS "Build unit tests?" OFF)
+option(SDLIMAGE_TESTS_INSTALL "Install unit tests?" OFF)
+
+option(SDLIMAGE_BACKEND_STB "Use stb_image for loading JPEG and PNG files" ON)
+cmake_dependent_option(SDLIMAGE_BACKEND_WIC "Add WIC backend (Windows Imaging Component)" OFF WIN32 OFF)
+cmake_dependent_option(SDLIMAGE_BACKEND_IMAGEIO "Use native Mac OS X frameworks for loading images" ON APPLE OFF)
+
+option(SDLIMAGE_AVIF "Support loading AVIF images" ON)
+option(SDLIMAGE_BMP "Support loading BMP images" ON)
+option(SDLIMAGE_GIF "Support loading GIF images" ON)
+option(SDLIMAGE_JPG "Support loading JPEG images" ON)
+option(SDLIMAGE_JXL "Support loading JXL images" OFF)
+option(SDLIMAGE_LBM "Support loading LBM images" ON)
+option(SDLIMAGE_PCX "Support loading PCX images" ON)
+option(SDLIMAGE_PNG "Support loading PNG images" ON)
+option(SDLIMAGE_PNM "Support loading PNM images" ON)
+option(SDLIMAGE_QOI "Support loading QOI images" ON)
+option(SDLIMAGE_SVG "Support loading SVG images" ON)
+option(SDLIMAGE_TGA "Support loading TGA images" ON)
+option(SDLIMAGE_TIF "Support loading TIFF images" ON)
+option(SDLIMAGE_WEBP "Support loading WEBP images" ON)
+option(SDLIMAGE_XCF "Support loading XCF images" ON)
+option(SDLIMAGE_XPM "Support loading XPM images" ON)
+option(SDLIMAGE_XV "Support loading XV images" ON)
+
+cmake_dependent_option(SDLIMAGE_AVIF_SAVE "Add AVIF save support" ON SDLIMAGE_AVIF OFF)
+cmake_dependent_option(SDLIMAGE_JPG_SAVE "Add JPEG save support" ON SDLIMAGE_JPG OFF)
+cmake_dependent_option(SDLIMAGE_PNG_SAVE "Add PNG save support" ON SDLIMAGE_PNG OFF)
set(LIBAVIF_MINIMUM_VERSION "1.0")
-if(SDL3IMAGE_VENDORED AND SDL3IMAGE_AVIF)
- set(SDL3IMAGE_AVIF_VENDORED ON)
+if(SDLIMAGE_VENDORED AND SDLIMAGE_AVIF)
+ set(SDLIMAGE_AVIF_VENDORED ON)
else()
- set(SDL3IMAGE_AVIF_VENDORED OFF)
+ set(SDLIMAGE_AVIF_VENDORED OFF)
endif()
-cmake_dependent_option(SDL3IMAGE_AVIF_SHARED "Dynamically load AVIF support (requires shared libavif)"
- ${SDL3IMAGE_DEPS_SHARED} SDL3IMAGE_AVIF ON)
-
-if(SDL3IMAGE_AVIF_VENDORED)
- set(SDL3IMAGE_DAV1D ON)
- set(SDL3IMAGE_DAV1D_VENDORED ON)
- set(SDL3IMAGE_AOM ON)
- set(SDL3IMAGE_AOM_VENDORED ON)
+cmake_dependent_option(SDLIMAGE_AVIF_SHARED "Dynamically load AVIF support (requires shared libavif)"
+ ${SDLIMAGE_DEPS_SHARED} SDLIMAGE_AVIF ON)
+
+if(SDLIMAGE_AVIF_VENDORED)
+ set(SDLIMAGE_DAV1D ON)
+ set(SDLIMAGE_DAV1D_VENDORED ON)
+ set(SDLIMAGE_AOM ON)
+ set(SDLIMAGE_AOM_VENDORED ON)
else()
- set(SDL3IMAGE_DAV1D OFF)
- set(SDL3IMAGE_DAV1D_VENDORED OFF)
- set(SDL3IMAGE_AOM OFF)
- set(SDL3IMAGE_AOM_VENDORED OFF)
+ set(SDLIMAGE_DAV1D OFF)
+ set(SDLIMAGE_DAV1D_VENDORED OFF)
+ set(SDLIMAGE_AOM OFF)
+ set(SDLIMAGE_AOM_VENDORED OFF)
endif()
-if(SDL3IMAGE_AVIF_SHARED)
- set(SDL3IMAGE_DAV1D_SHARED ON)
- set(SDL3IMAGE_AOM_SHARED ON)
+if(SDLIMAGE_AVIF_SHARED)
+ set(SDLIMAGE_DAV1D_SHARED ON)
+ set(SDLIMAGE_AOM_SHARED ON)
else()
- set(SDL3IMAGE_DAV1D_SHARED OFF)
- set(SDL3IMAGE_AOM_SHARED OFF)
+ set(SDLIMAGE_DAV1D_SHARED OFF)
+ set(SDLIMAGE_AOM_SHARED OFF)
endif()
-if(SDL3IMAGE_VENDORED AND SDL3IMAGE_JPG AND NOT (SDL3IMAGE_BACKEND_WIC OR SDL3IMAGE_BACKEND_STB OR SDL3IMAGE_BACKEND_IMAGEIO))
- set(SDL3IMAGE_JPG_VENDORED ON)
+if(SDLIMAGE_VENDORED AND SDLIMAGE_JPG AND NOT (SDLIMAGE_BACKEND_WIC OR SDLIMAGE_BACKEND_STB OR SDLIMAGE_BACKEND_IMAGEIO))
+ set(SDLIMAGE_JPG_VENDORED ON)
else()
- set(SDL3IMAGE_JPG_VENDORED OFF)
+ set(SDLIMAGE_JPG_VENDORED OFF)
endif()
-cmake_dependent_option(SDL3IMAGE_JPG_SHARED "Dynamically load JPG support (requires shared libjpeg)"
- ${SDL3IMAGE_DEPS_SHARED} "SDL3IMAGE_JPG;NOT SDL3IMAGE_BACKEND_WIC;NOT SDL3IMAGE_BACKEND_STB;NOT SDL3IMAGE_BACKEND_IMAGEIO" OFF)
+cmake_dependent_option(SDLIMAGE_JPG_SHARED "Dynamically load JPG support (requires shared libjpeg)"
+ ${SDLIMAGE_DEPS_SHARED} "SDLIMAGE_JPG;NOT SDLIMAGE_BACKEND_WIC;NOT SDLIMAGE_BACKEND_STB;NOT SDLIMAGE_BACKEND_IMAGEIO" OFF)
-if(SDL3IMAGE_VENDORED AND SDL3IMAGE_JXL)
- set(SDL3IMAGE_JXL_VENDORED ON)
+if(SDLIMAGE_VENDORED AND SDLIMAGE_JXL)
+ set(SDLIMAGE_JXL_VENDORED ON)
else()
- set(SDL3IMAGE_JXL_VENDORED OFF)
+ set(SDLIMAGE_JXL_VENDORED OFF)
endif()
-cmake_dependent_option(SDL3IMAGE_JXL_SHARED "Dynamically load JXL support (requires shared libjxl)"
- ${SDL3IMAGE_DEPS_SHARED} SDL3IMAGE_JXL OFF)
+cmake_dependent_option(SDLIMAGE_JXL_SHARED "Dynamically load JXL support (requires shared libjxl)"
+ ${SDLIMAGE_DEPS_SHARED} SDLIMAGE_JXL OFF)
-if(SDL3IMAGE_VENDORED AND SDL3IMAGE_PNG AND NOT (SDL3IMAGE_BACKEND_WIC OR SDL3IMAGE_BACKEND_STB OR SDL3IMAGE_BACKEND_IMAGEIO))
- set(SDL3IMAGE_PNG_VENDORED ON)
+if(SDLIMAGE_VENDORED AND SDLIMAGE_PNG AND NOT (SDLIMAGE_BACKEND_WIC OR SDLIMAGE_BACKEND_STB OR SDLIMAGE_BACKEND_IMAGEIO))
+ set(SDLIMAGE_PNG_VENDORED ON)
else()
- set(SDL3IMAGE_PNG_VENDORED OFF)
+ set(SDLIMAGE_PNG_VENDORED OFF)
endif()
-cmake_dependent_option(SDL3IMAGE_PNG_SHARED "Dynamically load PNG support (requires shared libpng)"
- ${SDL3IMAGE_DEPS_SHARED} "SDL3IMAGE_PNG;NOT SDL3IMAGE_BACKEND_WIC;NOT SDL3IMAGE_BACKEND_STB;NOT SDL3IMAGE_BACKEND_IMAGEIO" OFF)
+cmake_dependent_option(SDLIMAGE_PNG_SHARED "Dynamically load PNG support (requires shared libpng)"
+ ${SDLIMAGE_DEPS_SHARED} "SDLIMAGE_PNG;NOT SDLIMAGE_BACKEND_WIC;NOT SDLIMAGE_BACKEND_STB;NOT SDLIMAGE_BACKEND_IMAGEIO" OFF)
-if(SDL3IMAGE_VENDORED AND SDL3IMAGE_TIF AND NOT (SDL3IMAGE_BACKEND_IMAGEIO OR SDL3IMAGE_BACKEND_WIC))
- set(SDL3IMAGE_TIF_VENDORED ON)
+if(SDLIMAGE_VENDORED AND SDLIMAGE_TIF AND NOT (SDLIMAGE_BACKEND_IMAGEIO OR SDLIMAGE_BACKEND_WIC))
+ set(SDLIMAGE_TIF_VENDORED ON)
else()
- set(SDL3IMAGE_TIF_VENDORED OFF)
+ set(SDLIMAGE_TIF_VENDORED OFF)
endif()
-cmake_dependent_option(SDL3IMAGE_TIF_SHARED "Dynamically load TIFF support (requires shared libtiff)"
- ${SDL3IMAGE_DEPS_SHARED} SDL3IMAGE_TIF OFF)
+cmake_dependent_option(SDLIMAGE_TIF_SHARED "Dynamically load TIFF support (requires shared libtiff)"
+ ${SDLIMAGE_DEPS_SHARED} SDLIMAGE_TIF OFF)
-if(SDL3IMAGE_VENDORED AND SDL3IMAGE_WEBP)
- set(SDL3IMAGE_WEBP_VENDORED ON)
+if(SDLIMAGE_VENDORED AND SDLIMAGE_WEBP)
+ set(SDLIMAGE_WEBP_VENDORED ON)
else()
- set(SDL3IMAGE_WEBP_VENDORED OFF)
+ set(SDLIMAGE_WEBP_VENDORED OFF)
endif()
-cmake_dependent_option(SDL3IMAGE_WEBP_SHARED "Dynamically load WEBP support (requires shared libwebp)"
- ${SDL3IMAGE_DEPS_SHARED} SDL3IMAGE_WEBP OFF)
+cmake_dependent_option(SDLIMAGE_WEBP_SHARED "Dynamically load WEBP support (requires shared libwebp)"
+ ${SDLIMAGE_DEPS_SHARED} SDLIMAGE_WEBP OFF)
-if(SDL3IMAGE_PNG_VENDORED)
- set(SDL3IMAGE_ZLIB ON)
+if(SDLIMAGE_PNG_VENDORED)
+ set(SDLIMAGE_ZLIB ON)
else()
- set(SDL3IMAGE_ZLIB OFF)
+ set(SDLIMAGE_ZLIB OFF)
endif()
-if(SDL3IMAGE_VENDORED AND SDL3IMAGE_PNG_VENDORED)
- set(SDL3IMAGE_ZLIB_VENDORED ON)
+if(SDLIMAGE_VENDORED AND SDLIMAGE_PNG_VENDORED)
+ set(SDLIMAGE_ZLIB_VENDORED ON)
else()
- set(SDL3IMAGE_ZLIB_VENDORED OFF)
+ set(SDLIMAGE_ZLIB_VENDORED OFF)
endif()
-if(SDL3IMAGE_PNG_SHARED)
- set(SDL3IMAGE_ZLIB_SHARED ON)
+if(SDLIMAGE_PNG_SHARED)
+ set(SDLIMAGE_ZLIB_SHARED ON)
else()
- set(SDL3IMAGE_ZLIB_SHARED OFF)
+ set(SDLIMAGE_ZLIB_SHARED OFF)
endif()
# Save BUILD_SHARED_LIBS variable
-set(SDL3IMAGE_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})
+set(SDLIMAGE_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})
set(sdl_required_components Headers)
-if(SDL3IMAGE_BUILD_SHARED_LIBS)
+if(SDLIMAGE_BUILD_SHARED_LIBS)
set(sdl3_image_target_name SDL3_image-shared)
set(sdl3_target_name SDL3::SDL3-shared)
@@ -234,7 +234,7 @@ if(NOT DEFINED OpenGL_GL_PREFERENCE)
set(OpenGL_GL_PREFERENCE GLVND)
endif()
-set(BUILD_SHARED_LIBS ${SDL3IMAGE_BUILD_SHARED_LIBS})
+set(BUILD_SHARED_LIBS ${SDLIMAGE_BUILD_SHARED_LIBS})
add_library(${sdl3_image_target_name}
src/IMG.c
src/IMG_WIC.c
@@ -273,11 +273,11 @@ target_compile_definitions(${sdl3_image_target_name} PRIVATE
SDL_BUILD_MICRO_VERSION=${MICRO_VERSION}
)
target_link_libraries(${sdl3_image_target_name} PUBLIC SDL3::Headers)
-if(SDL3IMAGE_BUILD_SHARED_LIBS)
+if(SDLIMAGE_BUILD_SHARED_LIBS)
target_link_libraries(${sdl3_image_target_name} PRIVATE SDL3::SDL3-shared)
endif()
-sdl_add_warning_options(${sdl3_image_target_name} WARNING_AS_ERROR ${SDL3IMAGE_WERROR})
-if(WIN32 AND SDL3IMAGE_BUILD_SHARED_LIBS)
+sdl_add_warning_options(${sdl3_image_target_name} WARNING_AS_ERROR ${SDLIMAGE_WERROR})
+if(WIN32 AND SDLIMAGE_BUILD_SHARED_LIBS)
target_sources(${sdl3_image_target_name} PRIVATE
src/version.rc
)
@@ -320,7 +320,7 @@ if(NOT ANDROID)
sdl_no_deprecated_errors(${sdl3_image_target_name})
endif()
endif()
-if(SDL3IMAGE_BUILD_SHARED_LIBS)
+if(SDLIMAGE_BUILD_SHARED_LIBS)
if(WIN32)
set_target_properties(${sdl3_image_target_name} PROPERTIES
PREFIX ""
@@ -336,16 +336,16 @@ else()
endif()
# Use `Compatible Interface Properties` to ensure a shared SDL3_image is built with a shared SDL3
-if(SDL3IMAGE_BUILD_SHARED_LIBS)
+if(SDLIMAGE_BUILD_SHARED_LIBS)
set_property(TARGET ${sdl3_image_target_name} PROPERTY INTERFACE_SDL3_SHARED TRUE)
set_property(TARGET ${sdl3_image_target_name} APPEND PROPERTY COMPATIBLE_INTERFACE_BOOL SDL3_SHARED)
endif()
-if(SDL3IMAGE_BUILD_SHARED_LIBS)
+if(SDLIMAGE_BUILD_SHARED_LIBS)
sdl_target_link_options_no_undefined(${sdl3_image_target_name})
endif()
-if(SDL3IMAGE_BUILD_SHARED_LIBS)
+if(SDLIMAGE_BUILD_SHARED_LIBS)
# Make sure static library dependencies are built with -fPIC when building a shared SDL3_image
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
endif()
@@ -354,30 +354,30 @@ set(INSTALL_EXTRA_TARGETS)
set(INSTALL_EXTRA_CMAKE_MODULES)
set(PC_LIBS)
set(PC_REQUIRES)
-set(SDL3IMAGE_BACKENDS)
+set(SDLIMAGE_BACKENDS)
-list(APPEND SDL3IMAGE_BACKENDS STB)
-set(SDL3IMAGE_STB_ENABLED FALSE)
-if(SDL3IMAGE_BACKEND_STB)
- set(SDL3IMAGE_STB_ENABLED TRUE)
+list(APPEND SDLIMAGE_BACKENDS STB)
+set(SDLIMAGE_STB_ENABLED FALSE)
+if(SDLIMAGE_BACKEND_STB)
+ set(SDLIMAGE_STB_ENABLED TRUE)
target_compile_definitions(${sdl3_image_target_name} PRIVATE USE_STBIMAGE)
endif()
-list(APPEND SDL3IMAGE_BACKENDS IMAGEIO)
-set(SDL3IMAGE_IMAGEIO_ENABLED FALSE)
+list(APPEND SDLIMAGE_BACKENDS IMAGEIO)
+set(SDLIMAGE_IMAGEIO_ENABLED FALSE)
if(APPLE)
- if(SDL3IMAGE_BACKEND_IMAGEIO)
- set(SDL3IMAGE_IMAGEIO_ENABLED TRUE)
+ if(SDLIMAGE_BACKEND_IMAGEIO)
+ set(SDLIMAGE_IMAGEIO_ENABLED TRUE)
target_link_libraries(${sdl3_image_target_name} PRIVATE -Wl,-framework,ApplicationServices)
target_link_libraries(${sdl3_image_target_name} PRIVATE objc)
target_sources(${sdl3_image_target_name} PRIVATE
src/IMG_ImageIO.m
)
- if (SDL3IMAGE_PNG AND NOT SDL3IMAGE_BACKEND_STB)
+ if (SDLIMAGE_PNG AND NOT SDLIMAGE_BACKEND_STB)
target_compile_definitions(${sdl3_image_target_name} PRIVATE PNG_USES_IMAGEIO)
endif()
- if (SDL3IMAGE_JPG AND NOT SDL3IMAGE_BACKEND_STB)
+ if (SDLIMAGE_JPG AND NOT SDLIMAGE_BACKEND_STB)
target_compile_definitions(${sdl3_image_target_name} PRIVATE JPG_USES_IMAGEIO)
endif()
else()
@@ -385,26 +385,26 @@ if(APPLE)
endif()
endif()
-list(APPEND SDL3IMAGE_BACKENDS WIC)
-set(SDL3IMAGE_WIC_ENABLED FALSE)
-if(SDL3IMAGE_BACKEND_WIC)
- set(SDL3IMAGE_WIC_ENABLED TRUE)
+list(APPEND SDLIMAGE_BACKENDS WIC)
+set(SDLIMAGE_WIC_ENABLED FALSE)
+if(SDLIMAGE_BACKEND_WIC)
+ set(SDLIMAGE_WIC_ENABLED TRUE)
target_compile_definitions(${sdl3_image_target_name} PRIVATE SDL_IMAGE_USE_WIC_BACKEND)
endif()
-if(SDL3IMAGE_ZLIB)
- if(SDL3IMAGE_ZLIB_VENDORED)
+if(SDLIMAGE_ZLIB)
+ if(SDLIMAGE_ZLIB_VENDORED)
message(STATUS "${PROJECT_NAME}: Using vendored zlib")
# disable build of zlib example programs:
set(ZLIB_BUILD_EXAMPLES OFF CACHE BOOL "zlib examples" FORCE)
- sdl_check_project_in_subfolder(external/zlib zlib SDL3IMAGE_VENDORED)
+ sdl_check_project_in_subfolder(external/zlib zlib SDLIMAGE_VENDORED)
add_subdirectory(external/zlib EXCLUDE_FROM_ALL)
# PNG_BUILD_ZLIB variable is used by vendored libpng
set(PNG_BUILD_ZLIB ON CACHE BOOL "libpng option to tell it should use 'our' vendored ZLIB library" FORCE)
# ZLIB_INCLUDE_DIR variable is used by vendored libpng
set(ZLIB_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/external/zlib;${CMAKE_CURRENT_BINARY_DIR}/external/zlib" CACHE STRING "path of zlib, passed to libpng" FORCE)
# ZLIB_LIBRARY variable is used by vendored libpng
- if(SDL3IMAGE_ZLIB_SHARED)
+ if(SDLIMAGE_ZLIB_SHARED)
set(ZLIB_LIBRARY zlib)
else()
set(ZLIB_LIBRARY zlibstatic)
@@ -417,7 +417,7 @@ if(SDL3IMAGE_ZLIB)
# ZLIB_INCLUDE_DIRS variable is used by vendored libpng
set(ZLIB_INCLUDE_DIRS "${ZLIB_INCLUDE_DIR}")
target_include_directories(${ZLIB_LIBRARY} INTERFACE $<BUILD_INTERFACE:${ZLIB_INCLUDE_DIRS}>)
- if(SDL3IMAGE_ZLIB_SHARED OR NOT SDL3IMAGE_BUILD_SHARED_LIBS)
+ if(SDLIMAGE_ZLIB_SHARED OR NOT SDLIMAGE_BUILD_SHARED_LIBS)
list(APPEND INSTALL_EXTRA_TARGETS ${ZLIB_LIBRARY})
endif()
set_target_properties(${ZLIB_LIBRARY} PROPERTIES EXPORT_NAME external_zlib)
@@ -427,16 +427,16 @@ if(SDL3IMAGE_ZLIB)
endif()
endif()
-if(SDL3IMAGE_DAV1D)
- if(SDL3IMAGE_DAV1D_VENDORED)
+if(SDLIMAGE_DAV1D)
+ if(SDLIMAGE_DAV1D_VENDORED)
message(STATUS "${PROJECT_NAME}: Using vendored dav1d")
- set(BUILD_SHARED_LIBS ${SDL3IMAGE_DAV1D_SHARED})
+ set(BUILD_SHARED_LIBS ${SDLIMAGE_DAV1D_SHARED})
add_subdirectory(external/dav1d EXCLUDE_FROM_ALL)
if(DAV1D_ASM AND (CHECK_CPU_ARCHITECTURE_X64 OR CHECK_CPU_ARCHITECTURE_X86))
enable_language(ASM_NASM)
endif()
set(DAV1D_LIBRARY dav1d)
- if(SDL3IMAGE_DAV1D_SHARED OR NOT SDL3IMAGE_BUILD_SHARED_LIBS)
+ if(SDLIMAGE_DAV1D_SHARED OR NOT SDLIMAGE_BUILD_SHARED_LIBS)
list(APPEND INSTALL_EXTRA_TARGETS dav1d)
endif()
else()
@@ -444,16 +444,16 @@ if(SDL3IMAGE_DAV1D)
endif()
endif()
-if(SDL3IMAGE_AOM)
- if(SDL3IMAGE_AOM_VENDORED)
+if(SDLIMAGE_AOM)
+ if(SDLIMAGE_AOM_VENDORED)
message(STATUS "${PROJECT_NAME}: Using vendored aom")
- set(BUILD_SHARED_LIBS ${SDL3IMAGE_AOM_SHARED})
+ set(BUILD_SHARED_LIBS ${SDLIMAGE_AOM_SHARED})
set(ENABLE_DOCS OFF CACHE BOOL "")
set(ENABLE_EXAMPLES OFF CACHE BOOL "")
set(ENABLE_TESTDATA OFF CACHE BOOL "")
set(ENABLE_TESTS OFF CACHE BOOL "")
set(ENABLE_TOOLS OFF CACHE BOOL "")
- if(SDL3IMAGE_AOM_SHARED)
+ if(SDLIMAGE_AOM_SHARED)
set(CONFIG_AV1_DECODER 1 CACHE BOOL "" FORCE)
else()
set(CONFIG_AV1_DECODER 0 CACHE BOOL "" FORCE)
@@ -471,7 +471,7 @@ if(SDL3IMAGE_AOM)
endif()
add_subdirectory(external/aom EXCLUDE_FROM_ALL)
set(AOM_LIBRARY aom)
- if(SDL3IMAGE_AOM_SHARED OR NOT SDL3IMAGE_BUILD_SHARED_LIBS)
+ if(SDLIMAGE_AOM_SHARED OR NOT SDLIMAGE_BUILD_SHARED_LIBS)
list(APPEND INSTALL_EXTRA_TARGETS aom)
endif()
else()
@@ -479,31 +479,31 @@ if(SDL3IMAGE_AOM)
endif()
endif()
-list(APPEND SDL3IMAGE_BACKENDS AVIF)
-set(SDL3IMAGE_AVIF_ENABLED FALSE)
-if(SDL3IMAGE_AVIF)
- if(SDL3IMAGE_AVIF_VENDORED)
- set(SDL3IMAGE_AVIF_ENABLED TRUE)
+list(APPEND SDLIMAGE_BACKENDS AVIF)
+set(SDLIMAGE_AVIF_ENABLED FALSE)
+if(SDLIMAGE_AVIF)
+ if(SDLIMAGE_AVIF_VENDORED)
+ set(SDLIMAGE_AVIF_ENABLED TRUE)
message(STATUS "${PROJECT_NAME}: Using vendored libavif")
- sdl_check_project_in_subfolder(external/libavif libavif SDL3IMAGE_VENDORED)
+ sdl_check_project_in_subfolder(external/libavif libavif SDLIMAGE_VENDORED)
set(SKIP_INSTALL_LIBRARIES TRUE)
- set(BUILD_SHARED_LIBS ${SDL3IMAGE_AVIF_SHARED})
+ set(BUILD_SHARED_LIBS ${SDLIMAGE_AVIF_SHARED})
set(AVIF_CODEC_DAV1D ON CACHE BOOL "Use dav1d codec for decoding" FORCE)
set(AVIF_LOCAL_DAV1D OFF CACHE BOOL "Build dav1d by libavif" FORCE)
set(AVIF_CODEC_AOM ON CACHE BOOL "Use aom codec for decoding" FORCE)
set(AVIF_LOCAL_AOM OFF CACHE BOOL "Build aom by libavif" FORCE)
set(AVIF_CODEC_AOM_ENCODE ON CACHE BOOL "Enable aom encoder" FORCE)
set(AVIF_CODEC_AOM_DECODE OFF CACHE BOOL "Enable aom decoder" FORCE)
- set(LIBAVIF_WITH_SHARPYUV_SDLIMAGE ${SDL3IMAGE_WEBP} CACHE BOOL "Build libavif with sharpyuv support (re-use sharpyuv built by libwebp)" FORCE)
- set(BUILD_SHARED_LIBS ${SDL3IMAGE_AVIF_SHARED})
+ set(LIBAVIF_WITH_SHARPYUV_SDLIMAGE ${SDLIMAGE_WEBP} CACHE BOOL "Build libavif with sharpyuv support (re-use sharpyuv built by libwebp)" FORCE)
+ set(BUILD_SHARED_LIBS ${SDLIMAGE_AVIF_SHARED})
set(AOM_LIBRARIES "aom" CACHE STRING "aom libraries" FORCE)
add_subdirectory(external/libavif EXCLUDE_FROM_ALL)
- if(SDL3IMAGE_AVIF_SHARED OR NOT SDL3IMAGE_BUILD_SHARED_LIBS)
+ if(SDLIMAGE_AVIF_SHARED OR NOT SDLIMAGE_BUILD_SHARED_LIBS)
list(APPEND INSTALL_EXTRA_TARGETS avif)
endif()
set_target_properties(avif PROPERTIES EXPORT_NAME external_libavif)
add_library(SDL3_image::external_libavif ALIAS avif)
- if(NOT SDL3IMAGE_AVIF_SHARED)
+ if(NOT SDLIMAGE_AVIF_SHARED)
list(APPEND PC_LIBS -l$<TARGET_FILE_BASE_NAME:avif>)
endif()
if(NOT MSVC)
@@ -516,8 +516,8 @@ if(SDL3IMAGE_AVIF)
find_package(libavif "${LIBAVIF_MINIMUM_VERSION}" QUIET ${required})
if(libavif_FOUND)
message(STATUS "${PROJECT_NAME}: Using system libavif")
- set(SDL3IMAGE_AVIF_ENABLED TRUE)
- if(NOT SDL3IMAGE_AVIF_SHARED)
+ set(SDLIMAGE_AVIF_ENABLED TRUE)
+ if(NOT SDLIMAGE_AVIF_SHARED)
list(APPEND PC_REQUIRES "libavif >= ${LIBAVIF_MINIMUM_VERSION}")
endif()
else()
@@ -525,12 +525,12 @@ if(SDL3IMAGE_AVIF)
message(${fatal_error} "libavif NOT found")
endif()
endif()
- if(SDL3IMAGE_AVIF_ENABLED)
+ if(SDLIMAGE_AVIF_ENABLED)
target_compile_definitions(${sdl3_image_target_name} PRIVATE
LOAD_AVIF
- SDL_IMAGE_SAVE_AVIF=$<BOOL:${SDL3IMAGE_AVIF_SAVE}>
+ SDL_IMAGE_SAVE_AVIF=$<BOOL:${SDLIMAGE_AVIF_SAVE}>
)
- if(SDL3IMAGE_AVIF_SHARED)
+ if(SDLIMAGE_AVIF_SHARED)
target_include_directories(${sdl3_image_target_name} PRIVATE
$<TARGET_PROPERTY:avif,INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:avif,INTERFACE_INCLUDE_DIRECTORIES>
@@ -539,7 +539,7 @@ if(SDL3IMAGE_AVIF)
target_get_dynamic_library(dynamic_avif avif)
message(STATUS "Dynamic libavif: ${dynamic_avif}")
target_compile_definitions(${sdl3_image_target_name} PRIVATE "LOAD_AVIF_DYNAMIC=\"${dynamic_avif}\"")
- if(SDL3IMAGE_AVIF_VENDORED)
+ if(SDLIMAGE_AVIF_VENDORED)
add_dependencies(${sdl3_image_target_name} avif)
endif()
else()
@@ -548,54 +548,54 @@ if(SDL3IMAGE_AVIF)
endif()
endif()
-list(APPEND SDL3IMAGE_BACKENDS BMP)
-set(SDL3IMAGE_BMP_ENABLED FALSE)
-if(SDL3IMAGE_BMP)
- set(SDL3IMAGE_BMP_ENABLED TRUE)
+list(APPEND SDLIMAGE_BACKENDS BMP)
+set(SDLIMAGE_BMP_ENABLED FALSE)
+if(SDLIMAGE_BMP)
+ set(SDLIMAGE_BMP_ENABLED TRUE)
target_compile_definitions(${sdl3_image_target_name} PRIVATE LOAD_BMP)
endif()
-list(APPEND SDL3IMAGE_BACKENDS GIF)
-set(SDL3IMAGE_GIF_ENABLED FALSE)
-if(SDL3IMAGE_GIF)
- set(SDL3IMAGE_GIF_ENABLED TRUE)
+list(APPEND SDLIMAGE_BACKENDS GIF)
+set(SDLIMAGE_GIF_ENABLED FALSE)
+if(SDLIMAGE_GIF)
+ set(SDLIMAGE_GIF_ENABLED TRUE)
target_compile_definitions(${sdl3_image_target_name} PRIVATE LOAD_GIF)
endif()
-list(APPEND SDL3IMAGE_BACKENDS JPG)
-set(SDL3IMAGE_JPG_ENABLED FALSE)
-if(SDL3IMAGE_JPG)
- if(SDL3IMAGE_BACKEND_STB OR SDL3IMAGE_BACKEND_WIC OR SDL3IMAGE_BACKEND_IMAGEIO)
- set(SDL3IMAGE_JPG_ENABLED TRUE)
+list(APPEND SDLIMAGE_BACKENDS JPG)
+set(SDLIMAGE_JPG_ENABLED FALSE)
+if(SDLIMAGE_JPG)
+ if(SDLIMAGE_BACKEND_STB OR SDLIMAGE_BACKEND_WIC OR SDLIMAGE_BACKEND_IMAGEIO)
+ set(SDLIMAGE_JPG_ENABLED TRUE)
else()
- if(SDL3IMAGE_JPG_VENDORED)
- set(SDL3IMAGE_JPG_ENABLED TRUE)
+ if(SDLIMAGE_JPG_VENDORED)
+ set(SDLIMAGE_JPG_ENABLED TRUE)
message(STATUS "${PROJECT_NAME}: Using vendored libjpeg")
- sdl_check_project_in_subfolder(external/jpeg libjpeg SDL3IMAGE_VENDORED)
- set(BUILD_SHARED_LIBS ${SDL3IMAGE_JPG_SHARED})
+ sdl_check_project_in_subfolder(external/jpeg libjpeg SDLIMAGE_VENDORED)
+ set(BUILD_SHARED_LIBS ${SDLIMAGE_JPG_SHARED})
add_subdirectory(external/jpeg EXCLUDE_FROM_ALL)
- if(SDL3IMAGE_JPG_SHARED OR NOT SDL3IMAGE_BUILD_SHARED_LIBS)
+ if(SDLIMAGE_JPG_SHARED OR NOT SDLIMAGE_BUILD_SHARED_LIBS)
list(APPEND INSTALL_EXTRA_TARGETS jpeg)
endif()
set_target_properties(jpeg PROPERTIES EXPORT_NAME external_libjpeg)
add_library(SDL3_image::external_libjpeg ALIAS jpeg)
- if(NOT SDL3IMAGE_JPG_SHARED)
+ if(NOT SDLIMAGE_JPG_SHARED)
list(APPEND PC_LIBS -l$<TARGET_FILE_BASE_NAME:jpeg>)
endif()
else()
find_package(JPEG ${required})
if(JPEG_FOUND)
message(STATUS "${PROJECT_NAME}: Using system libjpeg")
- set(SDL3IMAGE_JPG_ENABLED TRUE)
- if(NOT SDL3IMAGE_JPG_SHARED)
+ set(SDLIMAGE_JPG_ENABLED TRUE)
+ if(NOT SDLIMAGE_JPG_SHARED)
list(APPEND PC_REQUIRES libjpeg)
endif()
else()
message(${fatal_error} "libjpeg NOT found")
endif()
endif()
- if(SDL3IMAGE_JPG_ENABLED)
- if(SDL3IMAGE_JPG_SHARED)
+ if(SDLIMAGE_JPG_ENABLED)
+ if(SDLIMAGE_JPG_SHARED)
target_include_directories(${sdl3_image_target_name} PRIVATE
$<TARGET_PROPERTY:JPEG::JPEG,INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:JPEG::JPEG,INTERFACE_INCLUDE_DIRECTORIES>
@@ -604,7 +604,7 @@ if(
(Patch may be truncated, please check the link at the top of this post.)