Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions ports/sdl3-image/cmake-sdl3.patch

This file was deleted.

46 changes: 46 additions & 0 deletions ports/sdl3-image/dependencies.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0a0cc03..27a009d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -293,6 +293,8 @@ target_compile_definitions(${sdl3_image_target_name} PRIVATE
target_link_libraries(${sdl3_image_target_name} PUBLIC SDL3::Headers)
if(SDLIMAGE_BUILD_SHARED_LIBS)
target_link_libraries(${sdl3_image_target_name} PRIVATE SDL3::SDL3-shared)
+else()
+ target_link_libraries(${sdl3_image_target_name} PRIVATE SDL3::SDL3)
endif()
sdl_add_warning_options(${sdl3_image_target_name} WARNING_AS_ERROR ${SDLIMAGE_WERROR})
if(WIN32 AND SDLIMAGE_BUILD_SHARED_LIBS)
@@ -971,7 +973,7 @@ if(SDLIMAGE_WEBP)
message(STATUS "${PROJECT_NAME}: Using libwebp from CMake variable")
set(SDLIMAGE_WEBP_ENABLED TRUE)
else()
- find_package(webp ${required})
+ find_package(webp NAMES WebP ${required})
if(webp_FOUND)
message(STATUS "${PROJECT_NAME}: Using system libwebp")
set(SDLIMAGE_WEBP_ENABLED TRUE)
diff --git a/cmake/SDL3_imageConfig.cmake.in b/cmake/SDL3_imageConfig.cmake.in
index db72fd7..d8f91ff 100644
--- a/cmake/SDL3_imageConfig.cmake.in
+++ b/cmake/SDL3_imageConfig.cmake.in
@@ -6,6 +6,9 @@ set_package_properties(SDL3_image PROPERTIES
DESCRIPTION "SDL_image is an image file loading library"
)

+include(CMakeFindDependencyMacro)
+find_dependency(SDL3 CONFIG)
+
set(SDL3_image_FOUND ON)

set(SDLIMAGE_AVIF @SDLIMAGE_AVIF_ENABLED@)
@@ -110,8 +113,7 @@ if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL3_image-static-targets.cmake")
endif()

if(SDLIMAGE_WEBP AND NOT TARGET WebP::webp AND NOT SDLIMAGE_WEBP_SHARED)
- list(APPEND webp_ROOT "${CMAKE_CURRENT_LIST_DIR}")
- find_dependency(webp)
+ find_dependency(WebP)
endif()

set(CMAKE_MODULE_PATH "${_sdl_cmake_module_path}")
25 changes: 25 additions & 0 deletions ports/sdl3-image/pkgconfig-libname.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 27a009d..0306afb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1122,6 +1122,7 @@ if(SDLIMAGE_INSTALL)
set(SDL_PKGCONFIG_PREFIX "${CMAKE_INSTALL_PREFIX}")
endif()

+ get_target_property(PC_LIB_NAME "${sdl3_image_target_name}" OUTPUT_NAME)
string(JOIN " " PC_REQUIRES ${PC_REQUIRES})
string(JOIN " " PC_LIBS ${PC_LIBS})
configure_file(cmake/sdl3-image.pc.in sdl3-image.pc @ONLY)
diff --git a/cmake/sdl3-image.pc.in b/cmake/sdl3-image.pc.in
index dae41df..e4ce850 100644
--- a/cmake/sdl3-image.pc.in
+++ b/cmake/sdl3-image.pc.in
@@ -7,7 +7,7 @@ Name: @PROJECT_NAME@
Description: image loading library for Simple DirectMedia Layer
Version: @PROJECT_VERSION@
Requires: sdl3 >= @SDL_REQUIRED_VERSION@
-Libs: -L${libdir} -lSDL3_image
+Libs: -L${libdir} -l@PC_LIB_NAME@
Requires.private: @PC_REQUIRES@
Libs.private: @PC_LIBS@
Cflags: -I${includedir}
32 changes: 15 additions & 17 deletions ports/sdl3-image/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO libsdl-org/SDL_image
REF "preview-${VERSION}"
SHA512 e139fd9474213757f473ca96cb7df78e6b122ac1a0f8b88e66d28955b8ee0390f83ee14dfe4f188aa4ba14b812c5522ce366e61a00609a3079930d68d8233921
REF "prerelease-${VERSION}"
SHA512 d11764142798e9c3cbb2fcfb123a5d6e5192d45011118f5a76f63b9ba100119799aacf9cd64835a9c504d3040116202f44aba9df1fc851afc1fdfb3b498c56a2
HEAD_REF main
PATCHES
cmake-sdl3.patch
dependencies.diff
pkgconfig-libname.diff
)

vcpkg_check_features(
OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
libjpeg-turbo SDLIMAGE_JPG
libwebp SDLIMAGE_WEBP
tiff SDLIMAGE_TIF
jpeg SDLIMAGE_JPG
png SDLIMAGE_PNG
tiff SDLIMAGE_TIF
webp SDLIMAGE_WEBP
INVERTED_FEATURES
# Disabled capabilities: Needing dependencies.
core SDLIMAGE_AVIF
core SDLIMAGE_JXL
)

vcpkg_cmake_configure(
Expand All @@ -23,32 +29,24 @@ vcpkg_cmake_configure(
-DSDLIMAGE_BACKEND_IMAGEIO=OFF
-DSDLIMAGE_BACKEND_STB=OFF
-DSDLIMAGE_DEPS_SHARED=OFF
-DSDLIMAGE_RELOCATABLE=ON
-DSDLIMAGE_SAMPLES=OFF
-DSDLIMAGE_STRICT=ON
-DSDLIMAGE_VENDORED=OFF
)

vcpkg_cmake_install()
vcpkg_copy_pdbs()
vcpkg_fixup_pkgconfig()

if(EXISTS "${CURRENT_PACKAGES_DIR}/cmake")
vcpkg_cmake_config_fixup(PACKAGE_NAME SDL3_image CONFIG_PATH cmake)
elseif(EXISTS "${CURRENT_PACKAGES_DIR}/SDL3_image.framework/Resources")
vcpkg_cmake_config_fixup(PACKAGE_NAME SDL3_image CONFIG_PATH SDL3_image.framework/Resources)
else()
vcpkg_cmake_config_fixup(PACKAGE_NAME SDL3_image CONFIG_PATH lib/cmake/SDL3_image)
endif()

vcpkg_fixup_pkgconfig()

if(NOT VCPKG_TARGET_IS_LINUX AND NOT VCPKG_TARGET_IS_ANDROID AND NOT VCPKG_BUILD_TYPE)
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/SDL3-image.pc" "-lSDL3_image" "-lSDL3_imaged")
endif()

file(REMOVE_RECURSE
"${CURRENT_PACKAGES_DIR}/debug/share"
"${CURRENT_PACKAGES_DIR}/debug/include"
"${CURRENT_PACKAGES_DIR}/SDL3_image.framework"
"${CURRENT_PACKAGES_DIR}/debug/SDL3_image.framework"
)

file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
Expand Down
2 changes: 1 addition & 1 deletion ports/sdl3-image/usage
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
sdl3-image provides CMake targets:

find_package(SDL3_image CONFIG REQUIRED)
target_link_libraries(main PRIVATE $<IF:$<TARGET_EXISTS:SDL3_image::SDL3_image-shared>,SDL3_image::SDL3_image-shared,SDL3_image-static>)
target_link_libraries(main PRIVATE $<IF:$<TARGET_EXISTS:SDL3_image::SDL3_image-shared>,SDL3_image::SDL3_image-shared,SDL3_image::SDL3_image-static>)

sdl3-image provides pkg-config modules:

Expand Down
17 changes: 11 additions & 6 deletions ports/sdl3-image/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
{
"name": "sdl3-image",
"version": "3.1.0",
"version": "3.1.1",
"description": "SDL_image is an image file loading library. It loads images as SDL surfaces and textures, and supports the following formats: BMP, GIF, JPEG, LBM, PCX, PNG, PNM, TGA, TIFF, WEBP, XCF, XPM, XV",
"homepage": "https://github.com/libsdl-org/SDL_image",
"license": "Zlib",
"dependencies": [
"libpng",
{
"name": "sdl3",
"default-features": false
Expand All @@ -20,16 +19,16 @@
}
],
"features": {
"libjpeg-turbo": {
"jpeg": {
"description": "Support for JPEG image format",
"dependencies": [
"libjpeg-turbo"
]
},
"libwebp": {
"description": "Support for WEBP image format.",
"png": {
"description": "Support for PNG image format",
"dependencies": [
"libwebp"
"libpng"
]
},
"tiff": {
Expand All @@ -40,6 +39,12 @@
"default-features": false
}
]
},
"webp": {
"description": "Support for WEBP image format.",
"dependencies": [
"libwebp"
]
}
}
}
10 changes: 10 additions & 0 deletions scripts/test_ports/vcpkg-ci-sdl3-image/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)

vcpkg_find_acquire_program(PKGCONFIG)

vcpkg_cmake_configure(
SOURCE_PATH "${CURRENT_PORT_DIR}/project"
OPTIONS
"-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}"
)
vcpkg_cmake_build()
25 changes: 25 additions & 0 deletions scripts/test_ports/vcpkg-ci-sdl3-image/project/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
cmake_minimum_required(VERSION 3.30)
project(sdl3-image-test C CXX) # C++ for tiff[lerc]

block(SCOPE_FOR VARIABLES)
find_package(SDL3_image CONFIG REQUIRED)

add_executable(main main.c)
target_link_libraries(main PRIVATE
$<IF:$<TARGET_EXISTS:SDL3_image::SDL3_image-shared>,SDL3_image::SDL3_image-shared,SDL3_image::SDL3_image-static>
)
endblock()

block(SCOPE_FOR VARIABLES)
find_package(PkgConfig REQUIRED)
pkg_check_modules(PC_SDL3_IMAGE sdl3-image REQUIRED IMPORTED_TARGET)

add_executable(main-pkconfig main.c)
if(WIN32 AND NOT MINGW)
target_link_libraries(main-pkconfig PRIVATE PkgConfig::PC_SDL3_IMAGE)
else()
# Use raw flags, avoid find_library
target_compile_options(main-pkconfig PRIVATE ${PC_SDL3_IMAGE_CFLAGS})
target_link_libraries(main-pkconfig PRIVATE ${PC_SDL3_IMAGE_LDFLAGS})
endif()
endblock()
7 changes: 7 additions & 0 deletions scripts/test_ports/vcpkg-ci-sdl3-image/project/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include <SDL3_image/SDL_image.h>

int main()
{
IMG_Version();
return 0;
}
36 changes: 36 additions & 0 deletions scripts/test_ports/vcpkg-ci-sdl3-image/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"name": "vcpkg-ci-sdl3-image",
"version-string": "ci",
"description": "Port to force features of sdl3-image within CI",
"homepage": "https://github.com/microsoft/vcpkg",
"license": "MIT",
"dependencies": [
{
"name": "sdl3-image",
"default-features": false
},
{
"name": "vcpkg-cmake",
"host": true
}
],
"default-features": [
"all"
],
"features": {
"all": {
"description": "Test all features",
"dependencies": [
{
"name": "sdl3-image",
"features": [
"jpeg",
"png",
"tiff",
"webp"
]
}
]
}
}
}
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -8285,7 +8285,7 @@
"port-version": 0
},
"sdl3-image": {
"baseline": "3.1.0",
"baseline": "3.1.1",
"port-version": 0
},
"seacas": {
Expand Down
5 changes: 5 additions & 0 deletions versions/s-/sdl3-image.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "cf10d2f8df73d5a1e81dfbc824786fdfb32549be",
"version": "3.1.1",
"port-version": 0
},
{
"git-tree": "e5c443cbdf6896a4989f1a0a6034be21c3fc43c0",
"version": "3.1.0",
Expand Down