From 3b399fec5c2d1fc7a369a03f5c2b7cb17b3da109 Mon Sep 17 00:00:00 2001 From: Green Sky Date: Mon, 9 Sep 2024 11:49:32 +0200 Subject: [PATCH] update sdl and sdl_image to latest --- external/sdl/CMakeLists.txt | 3 ++- external/sdl_image/CMakeLists.txt | 15 ++++++++------- flake.lock | 16 ++++++++-------- flake.nix | 4 ++-- src/image_loader_sdl_bmp.cpp | 2 +- src/main.cpp | 2 +- 6 files changed, 22 insertions(+), 20 deletions(-) diff --git a/external/sdl/CMakeLists.txt b/external/sdl/CMakeLists.txt index d5bcee39..4948a846 100644 --- a/external/sdl/CMakeLists.txt +++ b/external/sdl/CMakeLists.txt @@ -21,7 +21,8 @@ if (NOT TARGET SDL3::SDL3) #GIT_TAG 657c0135b1ff1685afa1bad63b0417d92f4bcb46 # tip 09-06-2024 #GIT_TAG d65a8146b950abe31b4fbf779f3e2fea731af9bd # tip 16-07-2024 - before string policy changes breaking imgui #GIT_TAG e949f12f63cdfcef4bdf456936ee676e0a3f9de6 # tip 18-07-2024 - broke bmp surface (before too) - GIT_TAG 67b973b5fad633b3be76d4daf4fd9fece292c25f # tip 29-07-2024 + #GIT_TAG 67b973b5fad633b3be76d4daf4fd9fece292c25f # tip 29-07-2024 + GIT_TAG 6e885d96193a4b0096fe7fed6d4e6c3e5f247283 # tip 09-09-2024 FIND_PACKAGE_ARGS # for the future ) diff --git a/external/sdl_image/CMakeLists.txt b/external/sdl_image/CMakeLists.txt index 3fd69e2b..aabea5e4 100644 --- a/external/sdl_image/CMakeLists.txt +++ b/external/sdl_image/CMakeLists.txt @@ -5,12 +5,12 @@ include(FetchContent) if (NOT TARGET SDL3_image::SDL3_image) set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE) # TODO: make pr to make this an option - set(SDL3IMAGE_BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE) - set(SDL3IMAGE_BACKEND_STB OFF CACHE BOOL "" FORCE) # important for security - set(SDL3IMAGE_BACKEND_IMAGEIO OFF CACHE BOOL "" FORCE) # some funky apple cmake bug - #set(SDL3IMAGE_JXL ON CACHE BOOL "" FORCE) # default to off - set(SDL3IMAGE_QOI OFF CACHE BOOL "" FORCE) # we have our own - set(SDL3IMAGE_WEBP OFF CACHE BOOL "" FORCE) # we have our own + set(SDLIMAGE_BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE) + set(SDLIMAGE_BACKEND_STB OFF CACHE BOOL "" FORCE) # important for security + set(SDLIMAGE_BACKEND_IMAGEIO OFF CACHE BOOL "" FORCE) # some funky apple cmake bug + #set(SDLIMAGE_JXL ON CACHE BOOL "" FORCE) # default to off + set(SDLIMAGE_QOI OFF CACHE BOOL "" FORCE) # we have our own + set(SDLIMAGE_WEBP OFF CACHE BOOL "" FORCE) # we have our own FetchContent_Declare(SDL3_image GIT_REPOSITORY https://github.com/libsdl-org/SDL_image @@ -20,7 +20,8 @@ if (NOT TARGET SDL3_image::SDL3_image) #GIT_TAG 2fc5310a9a2700fc856663200f94edebeb5e554a # tip 28-05-2024 #GIT_TAG 8eff782fa33d795c9ea1ac42dbe7e17cc9874c78 # tip 09-06-2024 #GIT_TAG 8abc07df88cc035997e797967ac2f479b0e50981 # tip 18-07-2024 - GIT_TAG 2a27018eda394a4e005cd8ba6bb3bfd0298809c7 # tip 29-07-2024 + #GIT_TAG 2a27018eda394a4e005cd8ba6bb3bfd0298809c7 # tip 29-07-2024 + GIT_TAG c1b272450d306db3845086cc231acae736b92f4f # tip 09-09-2024 FIND_PACKAGE_ARGS # for the future ) FetchContent_MakeAvailable(SDL3_image) diff --git a/flake.lock b/flake.lock index 562c5cf7..11791c39 100644 --- a/flake.lock +++ b/flake.lock @@ -63,34 +63,34 @@ "sdl3": { "flake": false, "locked": { - "lastModified": 1722282731, - "narHash": "sha256-02y7JB23xAehjqBp6hj7ExNkD06XkFE8Odxnu0hYx8k=", + "lastModified": 1725865005, + "narHash": "sha256-4vauaoxf+2LhGYLKRJOugZWKKMqa0bHTJCuR2F01DeM=", "owner": "libsdl-org", "repo": "SDL", - "rev": "67b973b5fad633b3be76d4daf4fd9fece292c25f", + "rev": "6e885d96193a4b0096fe7fed6d4e6c3e5f247283", "type": "github" }, "original": { "owner": "libsdl-org", "repo": "SDL", - "rev": "67b973b5fad633b3be76d4daf4fd9fece292c25f", + "rev": "6e885d96193a4b0096fe7fed6d4e6c3e5f247283", "type": "github" } }, "sdl3_image": { "flake": false, "locked": { - "lastModified": 1722000822, - "narHash": "sha256-h2vyWcGdLPbg42M6bgJAzskXJfeq9UYTMHi1XdP/otk=", + "lastModified": 1725662120, + "narHash": "sha256-jLKf3xSqjIL7L6iarQAiwcrmIQlM4R1zC2gXGXcdwPA=", "owner": "libsdl-org", "repo": "SDL_image", - "rev": "2a27018eda394a4e005cd8ba6bb3bfd0298809c7", + "rev": "c1b272450d306db3845086cc231acae736b92f4f", "type": "github" }, "original": { "owner": "libsdl-org", "repo": "SDL_image", - "rev": "2a27018eda394a4e005cd8ba6bb3bfd0298809c7", + "rev": "c1b272450d306db3845086cc231acae736b92f4f", "type": "github" } }, diff --git a/flake.nix b/flake.nix index f0e95401..59519080 100644 --- a/flake.nix +++ b/flake.nix @@ -11,11 +11,11 @@ flake = false; }; sdl3 = { - url = "github:libsdl-org/SDL/67b973b5fad633b3be76d4daf4fd9fece292c25f"; # keep in sync this cmake + url = "github:libsdl-org/SDL/6e885d96193a4b0096fe7fed6d4e6c3e5f247283"; # keep in sync this cmake flake = false; }; sdl3_image = { - url = "github:libsdl-org/SDL_image/2a27018eda394a4e005cd8ba6bb3bfd0298809c7"; + url = "github:libsdl-org/SDL_image/c1b272450d306db3845086cc231acae736b92f4f"; flake = false; }; }; diff --git a/src/image_loader_sdl_bmp.cpp b/src/image_loader_sdl_bmp.cpp index 02a80077..8c92875e 100644 --- a/src/image_loader_sdl_bmp.cpp +++ b/src/image_loader_sdl_bmp.cpp @@ -52,7 +52,7 @@ ImageLoaderSDLBMP::ImageResult ImageLoaderSDLBMP::loadFromMemoryRGBA(const uint8 ImageResult res; if (SDL_MUSTLOCK(conv_surf)) { - if (SDL_LockSurface(conv_surf) < 0) { + if (!SDL_LockSurface(conv_surf)) { std::cerr << "IL_SDLBMP error: " << SDL_GetError() << "\n"; SDL_DestroySurface(conv_surf); return {}; diff --git a/src/main.cpp b/src/main.cpp index b94cf8b6..9e9eceb3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -44,7 +44,7 @@ int main(int argc, char** argv) { auto last_time_tick = std::chrono::steady_clock::now(); // actual setup - if (SDL_Init(SDL_INIT_VIDEO) < 0) { + if (!SDL_Init(SDL_INIT_VIDEO)) { std::cerr << "SDL_Init failed (" << SDL_GetError() << ")\n"; return 1; }