diff --git a/recipes/sail/all/conandata.yml b/recipes/sail/all/conandata.yml index 028d8d21524f6..e86dae22aa106 100644 --- a/recipes/sail/all/conandata.yml +++ b/recipes/sail/all/conandata.yml @@ -14,3 +14,24 @@ sources: "0.9.0": url: "https://github.com/HappySeaFox/sail/archive/v0.9.0.tar.gz" sha256: "892738e0f56fed8c6387e1045bba2bfbf1b095024a495845d4879edb310cd1a7" +patches: + "0.9.6": + - patch_file: "patches/0.9.1-fix-libjxl-find.patch" + patch_description: "Fix find_package on libjxl dependency" + patch_type: "conan" + "0.9.5": + - patch_file: "patches/0.9.1-fix-libjxl-find.patch" + patch_description: "Fix find_package on libjxl dependency" + patch_type: "conan" + "0.9.4": + - patch_file: "patches/0.9.1-fix-libjxl-find.patch" + patch_description: "Fix find_package on libjxl dependency" + patch_type: "conan" + "0.9.1": + - patch_file: "patches/0.9.1-fix-libjxl-find.patch" + patch_description: "Fix find_package on libjxl dependency" + patch_type: "conan" + "0.9.0": + - patch_file: "patches/0.9.0-fix-libjxl-find.patch" + patch_description: "Fix find_package on libjxl dependency" + patch_type: "conan" diff --git a/recipes/sail/all/conanfile.py b/recipes/sail/all/conanfile.py index 8afbd6f8c8980..c724f31d4f572 100644 --- a/recipes/sail/all/conanfile.py +++ b/recipes/sail/all/conanfile.py @@ -1,11 +1,10 @@ from conan import ConanFile from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout -from conan.tools.files import copy, get, rename, rmdir -from conan.tools.microsoft import is_msvc +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir, rename from conan.tools.scm import Version import os -required_conan_version = ">=1.53.0" +required_conan_version = ">=2.0.9" class SAILConan(ConanFile): name = "sail" @@ -43,14 +42,10 @@ class SAILConan(ConanFile): "with_low_priority_codecs": "Enable codecs: ICO, PCX, PNM, PSD, QOI, TGA", "with_lowest_priority_codecs": "Enable codecs: WAL, XBM", } + implements = ["auto_shared_fpic"] - def config_options(self): - if self.settings.os == "Windows": - self.options.rm_safe("fPIC") - - def configure(self): - if self.options.shared: - self.options.rm_safe("fPIC") + def export_sources(self): + export_conandata_patches(self) def requirements(self): if self.options.with_highest_priority_codecs: @@ -62,7 +57,7 @@ def requirements(self): if Version(self.version) >= "0.9.1": self.requires("nanosvg/cci.20231025") if self.options.with_medium_priority_codecs: - self.requires("libavif/1.0.4") + self.requires("libavif/1.1.1") self.requires("jasper/4.2.0") self.requires("libjxl/0.8.2") self.requires("libwebp/1.3.2") @@ -73,6 +68,7 @@ def layout(self): def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True, destination=self.source_folder) + apply_conandata_patches(self) def generate(self): only_codecs = [] @@ -130,21 +126,12 @@ def package(self): def package_info(self): self.cpp_info.set_property("cmake_file_name", "Sail") - self.cpp_info.filenames["cmake_find_package"] = "Sail" - self.cpp_info.filenames["cmake_find_package_multi"] = "Sail" - self.cpp_info.names["cmake_find_package"] = "SAIL" - self.cpp_info.names["cmake_find_package_multi"] = "SAIL" - self.cpp_info.components["sail-common"].set_property("cmake_target_name", "SAIL::SailCommon") self.cpp_info.components["sail-common"].set_property("pkg_config_name", "libsail-common") - self.cpp_info.components["sail-common"].names["cmake_find_package"] = "SailCommon" - self.cpp_info.components["sail-common"].names["cmake_find_package_multi"] = "SailCommon" self.cpp_info.components["sail-common"].includedirs = ["include/sail"] self.cpp_info.components["sail-common"].libs = ["sail-common"] self.cpp_info.components["sail-codecs"].set_property("cmake_target_name", "SAIL::SailCodecs") - self.cpp_info.components["sail-codecs"].names["cmake_find_package"] = "SailCodecs" - self.cpp_info.components["sail-codecs"].names["cmake_find_package_multi"] = "SailCodecs" self.cpp_info.components["sail-codecs"].libs = ["sail-codecs"] self.cpp_info.components["sail-codecs"].requires = ["sail-common"] @@ -163,8 +150,6 @@ def package_info(self): self.cpp_info.components["libsail"].set_property("cmake_target_name", "SAIL::Sail") self.cpp_info.components["libsail"].set_property("pkg_config_name", "libsail") - self.cpp_info.components["libsail"].names["cmake_find_package"] = "Sail" - self.cpp_info.components["libsail"].names["cmake_find_package_multi"] = "Sail" self.cpp_info.components["libsail"].libs = ["sail"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["libsail"].system_libs.append("dl") @@ -174,14 +159,10 @@ def package_info(self): self.cpp_info.components["sail-manip"].set_property("cmake_target_name", "SAIL::SailManip") self.cpp_info.components["sail-manip"].set_property("pkg_config_name", "libsail-manip") - self.cpp_info.components["sail-manip"].names["cmake_find_package"] = "SailManip" - self.cpp_info.components["sail-manip"].names["cmake_find_package_multi"] = "SailManip" self.cpp_info.components["sail-manip"].libs = ["sail-manip"] self.cpp_info.components["sail-manip"].requires = ["sail-common"] self.cpp_info.components["sail-c++"].set_property("cmake_target_name", "SAIL::SailC++") self.cpp_info.components["sail-c++"].set_property("pkg_config_name", "libsail-c++") - self.cpp_info.components["sail-c++"].names["cmake_find_package"] = "SailC++" - self.cpp_info.components["sail-c++"].names["cmake_find_package_multi"] = "SailC++" self.cpp_info.components["sail-c++"].libs = ["sail-c++"] self.cpp_info.components["sail-c++"].requires = ["libsail", "sail-manip"] diff --git a/recipes/sail/all/patches/0.9.0-fix-libjxl-find.patch b/recipes/sail/all/patches/0.9.0-fix-libjxl-find.patch new file mode 100644 index 0000000000000..d6e2ba5faadfa --- /dev/null +++ b/recipes/sail/all/patches/0.9.0-fix-libjxl-find.patch @@ -0,0 +1,23 @@ +diff --git a/src/sail-codecs/jpegxl/CMakeLists.txt b/src/sail-codecs/jpegxl/CMakeLists.txt +index 54441fa6..f4cd39b2 100644 +--- a/src/sail-codecs/jpegxl/CMakeLists.txt ++++ b/src/sail-codecs/jpegxl/CMakeLists.txt +@@ -1,3 +1,4 @@ ++if(0) + find_library(JPEGXL_LIBRARY jxl NAMES jxl jxl-static ${SAIL_CODEC_JPEGXL_REQUIRED_OPTION}) + find_library(JPEGXL_THREADS_LIBRARY jxl_threads NAMES jxl_threads jxl_threads-static ${SAIL_CODEC_JPEGXL_REQUIRED_OPTION}) + find_path(JPEGXL_INCLUDE_DIRS jxl/decode.h ${SAIL_CODEC_JPEGXL_REQUIRED_OPTION}) +@@ -50,3 +51,13 @@ sail_codec(NAME jpegxl + DEPENDENCY_INCLUDE_DIRS ${JPEGXL_INCLUDE_DIRS} + DEPENDENCY_LIBS ${BROTLI_COMMON_LIBRARY} ${BROTLI_DEC_LIBRARY} ${HWY_LIBRARY} + ${JPEGXL_LIBRARY} ${JPEGXL_THREADS_LIBRARY}) ++endif() ++# Find libjxl package ++find_package(libjxl REQUIRED CONFIG) ++ ++# Common codec configuration ++sail_codec(NAME jpegxl ++ SOURCES helpers.h helpers.c jpegxl.c memory.h memory.c ++ ICON jpegxl.png) ++ ++target_link_libraries(${SAIL_CODEC_TARGET} PRIVATE libjxl::libjxl) diff --git a/recipes/sail/all/patches/0.9.1-fix-libjxl-find.patch b/recipes/sail/all/patches/0.9.1-fix-libjxl-find.patch new file mode 100644 index 0000000000000..ba9ab3d73051d --- /dev/null +++ b/recipes/sail/all/patches/0.9.1-fix-libjxl-find.patch @@ -0,0 +1,23 @@ +diff --git a/src/sail-codecs/jpegxl/CMakeLists.txt b/src/sail-codecs/jpegxl/CMakeLists.txt +index 16971a48..477d48f6 100644 +--- a/src/sail-codecs/jpegxl/CMakeLists.txt ++++ b/src/sail-codecs/jpegxl/CMakeLists.txt +@@ -1,3 +1,4 @@ ++if(0) + # Don't use SAIL_CODEC_JPEGXL_REQUIRED_OPTION as it requires CMake 3.18 + # + find_library(JPEGXL_LIBRARY jxl NAMES jxl jxl-static) +@@ -56,3 +57,13 @@ sail_codec(NAME jpegxl + DEPENDENCY_INCLUDE_DIRS ${JPEGXL_INCLUDE_DIRS} + DEPENDENCY_LIBS ${BROTLI_COMMON_LIBRARY} ${BROTLI_DEC_LIBRARY} ${HWY_LIBRARY} + ${JPEGXL_LIBRARY} ${JPEGXL_THREADS_LIBRARY}) ++endif() ++# Find libjxl package ++find_package(libjxl REQUIRED CONFIG) ++ ++# Common codec configuration ++sail_codec(NAME jpegxl ++ SOURCES helpers.h helpers.c jpegxl.c memory.h memory.c ++ ICON jpegxl.png) ++ ++target_link_libraries(${SAIL_CODEC_TARGET} PRIVATE libjxl::libjxl) diff --git a/recipes/sail/all/test_package/CMakeLists.txt b/recipes/sail/all/test_package/CMakeLists.txt index cb86fe79928de..cd8881a933f0f 100644 --- a/recipes/sail/all/test_package/CMakeLists.txt +++ b/recipes/sail/all/test_package/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package C CXX) # Enable strict C++11 diff --git a/recipes/sail/all/test_package/test_package.c b/recipes/sail/all/test_package/test_package.c index 59c23fda941fb..a5b966a9fda99 100644 --- a/recipes/sail/all/test_package/test_package.c +++ b/recipes/sail/all/test_package/test_package.c @@ -5,5 +5,5 @@ int main() { struct sail_image *image; sail_status_t status = sail_load_from_file("binary-file.bmp", &image); - printf("Error - file not found generate: status %d\n", status); + printf("Tried opening image with sail: status %d\nTEST SUCCEED\n", status); } diff --git a/recipes/sail/all/test_package/test_package.cpp b/recipes/sail/all/test_package/test_package.cpp index 918cafc9fb33d..7bee34671cf56 100644 --- a/recipes/sail/all/test_package/test_package.cpp +++ b/recipes/sail/all/test_package/test_package.cpp @@ -7,10 +7,11 @@ int main(int argc, char *argv[]) const char* filename = "my-binary.bmp"; try { const sail::image image(filename); - std::cout << "Size: " << image.width() << std::endl; // Never reached + std::cout << "Size: " << image.width() << '\n'; // Never reached } catch (const std::exception& e) { - std::cerr << "Error - file not found generate: " << e.what() << std::endl; + std::cout << "Tried to open " << filename << " with sail library\n"; } + std::cout << "TEST SUCCEED\n"; return 0; }