diff --git a/recipes/sdl_image/all/conandata.yml b/recipes/sdl_image/all/conandata.yml index 0444df801e1ac..5ee1e30b83122 100644 --- a/recipes/sdl_image/all/conandata.yml +++ b/recipes/sdl_image/all/conandata.yml @@ -5,3 +5,8 @@ sources: "2.0.5": url: "https://www.libsdl.org/projects/SDL_image/release/SDL2_image-2.0.5.tar.gz" sha256: "bdd5f6e026682f7d7e1be0b6051b209da2f402a2dd8bd1c4bd9c25ad263108d0" +patches: + "2.6.3": + - patch_file: "patches/0001-set-sdl-version-directly.patch" + patch_type: "conan" + patch_description: "Set SDL version directly in CMake rather than parsing a header" diff --git a/recipes/sdl_image/all/conanfile.py b/recipes/sdl_image/all/conanfile.py index bca15363d987d..8272b452a601f 100644 --- a/recipes/sdl_image/all/conanfile.py +++ b/recipes/sdl_image/all/conanfile.py @@ -2,7 +2,7 @@ from conan.errors import ConanInvalidConfiguration from conan.tools.apple import is_apple_os from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout -from conan.tools.files import copy, get, rmdir +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir from conan.tools.scm import Version import os @@ -67,6 +67,7 @@ class SDLImageConan(ConanFile): } def export_sources(self): + export_conandata_patches(self) if Version(self.version) < "2.6": copy(self, "CMakeLists.txt", src=self.recipe_folder, dst=self.export_sources_folder) @@ -170,6 +171,7 @@ def generate(self): cd.generate() def build(self): + apply_conandata_patches(self) rmdir(self, os.path.join(self.source_folder, "external")) cmake = CMake(self) if Version(self.version) < "2.6": diff --git a/recipes/sdl_image/all/patches/0001-set-sdl-version-directly.patch b/recipes/sdl_image/all/patches/0001-set-sdl-version-directly.patch new file mode 100644 index 0000000000000..5b6569293fc85 --- /dev/null +++ b/recipes/sdl_image/all/patches/0001-set-sdl-version-directly.patch @@ -0,0 +1,21 @@ +diff --git a/cmake/FindPrivateSDL2.cmake b/cmake/FindPrivateSDL2.cmake +index 0314170..185f352 100644 +--- a/cmake/FindPrivateSDL2.cmake ++++ b/cmake/FindPrivateSDL2.cmake +@@ -17,7 +17,7 @@ find_path(SDL2_INCLUDE_DIR + ) + + set(SDL2_VERSION) +-if(SDL2_INCLUDE_DIR) ++if(FALSE) + file(READ "${SDL2_INCLUDE_DIR}/SDL_version.h" _sdl_version_h) + string(REGEX MATCH "#define[ \t]+SDL_MAJOR_VERSION[ \t]+([0-9]+)" _sdl2_major_re "${_sdl_version_h}") + set(_sdl2_major "${CMAKE_MATCH_1}") +@@ -29,6 +29,7 @@ if(SDL2_INCLUDE_DIR) + set(SDL2_VERSION "${_sdl2_major}.${_sdl2_minor}.${_sdl2_patch}") + endif() + endif() ++set(SDL2_VERSION ${SDL2_VERSION_STRING}) + + find_package_handle_standard_args(PrivateSDL2 + REQUIRED_VARS SDL2_LIBRARY SDL2_INCLUDE_DIR