diff --git a/recipes/sail/all/conandata.yml b/recipes/sail/all/conandata.yml index 8c052944241b6..1e1d5d73288fd 100644 --- a/recipes/sail/all/conandata.yml +++ b/recipes/sail/all/conandata.yml @@ -1,8 +1,15 @@ sources: - "0.9.0-pre23": - url: "https://github.com/smoked-herring/sail/archive/v0.9.0-pre23.tar.gz" - sha256: "6c5314561fda3d388b4653e7424cdf2ae2c65767e79203576804ca41fc930a6b" + "0.9.0-rc2": + url: "https://github.com/HappySeaFox/sail/archive/v0.9.0-rc2.tar.gz" + sha256: "988d318fd4cfbc77ccbda49f4ac751d1998b990db157aef32b0dbd32d11f8fd6" patches: - "0.9.0-pre23": - - patch_file: "patches/0.9.0-pre23-avif-find-package.patch" - base_path: "src" + "0.9.0-rc2": + - patch_file: "patches/0.9.0-rc2-avif-find-package.patch" + patch_type: "conan" + patch_description: "Make the AVIF codec use find_package()" + - patch_file: "patches/0.9.0-rc2-jpeg2000-find-package.patch" + patch_type: "conan" + patch_description: "Make the JPEG2000 codec use find_package()" + - patch_file: "patches/0.9.0-rc2-webp-find-package.patch" + patch_type: "conan" + patch_description: "Make the WEBP codec use find_package()" diff --git a/recipes/sail/all/conanfile.py b/recipes/sail/all/conanfile.py index ad93abfe3ed64..05b60d895f6f0 100644 --- a/recipes/sail/all/conanfile.py +++ b/recipes/sail/all/conanfile.py @@ -1,9 +1,10 @@ -from conan.tools.files import rename -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.files import apply_conandata_patches, export_conandata_patches, copy, get, rename, rmdir +from conans import CMake import functools import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class SAILConan(ConanFile): name = "sail" @@ -20,7 +21,7 @@ class SAILConan(ConanFile): "with_avif": [True, False], "with_gif": [True, False], "with_jpeg2000": [True, False], - "with_jpeg": [True, False], + "with_jpeg": ["libjpeg", "libjpeg-turbo", False], "with_png": [True, False], "with_tiff": [True, False], "with_webp": [True, False], @@ -32,25 +33,20 @@ class SAILConan(ConanFile): "with_avif": True, "with_gif": True, "with_jpeg2000": True, - "with_jpeg": True, + "with_jpeg": "libjpeg", "with_png": True, "with_tiff": True, "with_webp": True, } generators = "cmake", "cmake_find_package", "cmake_find_package_multi" - @property - def _source_subfolder(self): - return "src" - @property def _build_subfolder(self): return "build" def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + copy(self, "CMakeLists.txt", src=self.recipe_folder, dst=self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -67,44 +63,46 @@ def requirements(self): self.requires("giflib/5.2.1") if self.options.with_jpeg2000: self.requires("jasper/2.0.33") - if self.options.with_jpeg: - self.requires("libjpeg/9d") + if self.options.with_jpeg == "libjpeg-turbo": + self.requires("libjpeg-turbo/2.1.4") + elif self.options.with_jpeg == "libjpeg": + self.requires("libjpeg/9e") if self.options.with_png: - self.requires("libpng/1.6.37") + self.requires("libpng/1.6.39") if self.options.with_tiff: - self.requires("libtiff/4.3.0") + self.requires("libtiff/4.4.0") if self.options.with_webp: - self.requires("libwebp/1.2.2") + self.requires("libwebp/1.2.4") def source(self): - tools.get(**self.conan_data["sources"][self.version], - strip_root=True, destination=self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], + strip_root=True, destination=self.source_folder) @functools.lru_cache(1) def _configure_cmake(self): - except_codecs = [] - - if not self.options.with_avif: - except_codecs.append("AVIF") - if not self.options.with_gif: - except_codecs.append("GIF") - if not self.options.with_jpeg2000: - except_codecs.append("JPEG2000") - if not self.options.with_jpeg: - except_codecs.append("JPEG") - if not self.options.with_png: - except_codecs.append("PNG") - if not self.options.with_tiff: - except_codecs.append("TIFF") - if not self.options.with_webp: - except_codecs.append("WEBP") + enable_codecs = [] + + if self.options.with_avif: + enable_codecs.append("avif") + if self.options.with_gif: + enable_codecs.append("gif") + if self.options.with_jpeg2000: + enable_codecs.append("jpeg2000") + if self.options.with_jpeg: + enable_codecs.append("jpeg") + if self.options.with_png: + enable_codecs.append("png") + if self.options.with_tiff: + enable_codecs.append("tiff") + if self.options.with_webp: + enable_codecs.append("webp") cmake = CMake(self) cmake.definitions["SAIL_BUILD_APPS"] = False cmake.definitions["SAIL_BUILD_EXAMPLES"] = False cmake.definitions["SAIL_BUILD_TESTS"] = False cmake.definitions["SAIL_COMBINE_CODECS"] = True - cmake.definitions["SAIL_EXCEPT_CODECS"] = ";".join(except_codecs) + cmake.definitions["SAIL_ENABLE_CODECS"] = ";".join(enable_codecs) cmake.definitions["SAIL_INSTALL_PDB"] = False cmake.definitions["SAIL_THREAD_SAFE"] = self.options.thread_safe cmake.configure(build_folder=self._build_subfolder) @@ -112,21 +110,20 @@ def _configure_cmake(self): return cmake def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) cmake = self._configure_cmake() cmake.build() def package(self): - self.copy("LICENSE.txt", src=self._source_subfolder, dst="licenses") - self.copy("LICENSE.INIH.txt", src=self._source_subfolder, dst="licenses") - self.copy("LICENSE.MUNIT.txt", src=self._source_subfolder, dst="licenses") + copy(self, "LICENSE.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "LICENSE.INIH.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "LICENSE.MUNIT.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) cmake = self._configure_cmake() cmake.install() # Remove CMake and pkg-config rules - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) # Move icons rename(self, os.path.join(self.package_folder, "share"), os.path.join(self.package_folder, "res")) @@ -158,7 +155,7 @@ def package_info(self): if self.options.with_jpeg2000: self.cpp_info.components["sail-codecs"].requires.append("jasper::jasper") if self.options.with_jpeg: - self.cpp_info.components["sail-codecs"].requires.append("libjpeg::libjpeg") + self.cpp_info.components["sail-codecs"].requires.append("{0}::{0}".format(self.options.with_jpeg)) if self.options.with_png: self.cpp_info.components["sail-codecs"].requires.append("libpng::libpng") if self.options.with_tiff: diff --git a/recipes/sail/all/patches/0.9.0-pre23-avif-find-package.patch b/recipes/sail/all/patches/0.9.0-rc2-avif-find-package.patch similarity index 73% rename from recipes/sail/all/patches/0.9.0-pre23-avif-find-package.patch rename to recipes/sail/all/patches/0.9.0-rc2-avif-find-package.patch index 3004739a6cda7..98ec3b23d5ae9 100644 --- a/recipes/sail/all/patches/0.9.0-pre23-avif-find-package.patch +++ b/recipes/sail/all/patches/0.9.0-rc2-avif-find-package.patch @@ -1,11 +1,11 @@ diff --git a/src/sail-codecs/avif/CMakeLists.txt b/src/sail-codecs/avif/CMakeLists.txt -index 870de541..1fe5a7e7 100644 +index 3f36e0c8..1e31be83 100644 --- a/src/sail-codecs/avif/CMakeLists.txt +++ b/src/sail-codecs/avif/CMakeLists.txt @@ -1,7 +1,6 @@ --find_library(AVIF_LIBRARY avif) --find_path(AVIF_INCLUDE_DIRS avif/avif.h) -+find_package(libavif CONFIG) +-find_library(AVIF_LIBRARY avif ${SAIL_CODEC_AVIF_REQUIRED_OPTION}) +-find_path(AVIF_INCLUDE_DIRS avif/avif.h ${SAIL_CODEC_AVIF_REQUIRED_OPTION}) ++find_package(libavif ${SAIL_CODEC_AVIF_REQUIRED_OPTION}) -if (NOT AVIF_LIBRARY OR NOT AVIF_INCLUDE_DIRS) +if (NOT libavif_FOUND) diff --git a/recipes/sail/all/patches/0.9.0-rc2-jpeg2000-find-package.patch b/recipes/sail/all/patches/0.9.0-rc2-jpeg2000-find-package.patch new file mode 100644 index 0000000000000..57fb33011ec77 --- /dev/null +++ b/recipes/sail/all/patches/0.9.0-rc2-jpeg2000-find-package.patch @@ -0,0 +1,28 @@ +diff --git a/src/sail-codecs/jpeg2000/CMakeLists.txt b/src/sail-codecs/jpeg2000/CMakeLists.txt +index b3fe5c12..6fb3f644 100644 +--- a/src/sail-codecs/jpeg2000/CMakeLists.txt ++++ b/src/sail-codecs/jpeg2000/CMakeLists.txt +@@ -1,13 +1,9 @@ +-find_library(JPEG2000_RELEASE_LIBRARY NAMES jasper ${SAIL_CODEC_JPEG2000_REQUIRED_OPTION}) +-find_library(JPEG2000_DEBUG_LIBRARY NAMES jasperd jasper ${SAIL_CODEC_JPEG2000_REQUIRED_OPTION}) +-find_path(JPEG2000_INCLUDE_DIRS jasper/jasper.h ${SAIL_CODEC_JPEG2000_REQUIRED_OPTION}) ++find_package(Jasper ${SAIL_CODEC_JPEG2000_REQUIRED_OPTION}) + +-if ((NOT JPEG2000_RELEASE_LIBRARY AND NOT JPEG2000_DEBUG_LIBRARY) OR NOT JPEG2000_INCLUDE_DIRS) ++if (NOT Jasper_FOUND) + return() + endif() + +-set(JPEG2000_LIBRARY optimized ${JPEG2000_RELEASE_LIBRARY} debug ${JPEG2000_DEBUG_LIBRARY}) +- + # This will add the following CMake rules to the CMake config for static builds so a client + # application links against the required dependencies: + # +@@ -22,5 +18,5 @@ set(SAIL_CODECS_FIND_DEPENDENCIES ${SAIL_CODECS_FIND_DEPENDENCIES} "find_library + sail_codec(NAME jpeg2000 + SOURCES helpers.h helpers.c jpeg2000.c + ICON jpeg2000.png +- DEPENDENCY_INCLUDE_DIRS ${JPEG2000_INCLUDE_DIRS} +- DEPENDENCY_LIBS optimized ${JPEG2000_RELEASE_LIBRARY} debug ${JPEG2000_DEBUG_LIBRARY}) ++ DEPENDENCY_INCLUDE_DIRS ${Jasper_INCLUDE_DIR} ++ DEPENDENCY_LIBS ${Jasper_LIBRARIES}) diff --git a/recipes/sail/all/patches/0.9.0-rc2-webp-find-package.patch b/recipes/sail/all/patches/0.9.0-rc2-webp-find-package.patch new file mode 100644 index 0000000000000..3ba8c6a786a6e --- /dev/null +++ b/recipes/sail/all/patches/0.9.0-rc2-webp-find-package.patch @@ -0,0 +1,25 @@ +diff --git a/src/sail-codecs/webp/CMakeLists.txt b/src/sail-codecs/webp/CMakeLists.txt +index 64d31e5a..d3a34985 100644 +--- a/src/sail-codecs/webp/CMakeLists.txt ++++ b/src/sail-codecs/webp/CMakeLists.txt +@@ -1,10 +1,6 @@ +-find_library(WEBP_RELEASE_LIBRARY NAMES webp ${SAIL_CODEC_WEBP_REQUIRED_OPTION}) +-find_library(WEBP_DEBUG_LIBRARY NAMES webpd webp ${SAIL_CODEC_WEBP_REQUIRED_OPTION}) +-find_library(WEBP_DEMUX_RELEASE_LIBRARY NAMES webpdemux ${SAIL_CODEC_WEBP_REQUIRED_OPTION}) +-find_library(WEBP_DEMUX_DEBUG_LIBRARY NAMES webpdemuxd webpdemux ${SAIL_CODEC_WEBP_REQUIRED_OPTION}) +-find_path(WEBP_INCLUDE_DIRS webp/decode.h ${SAIL_CODEC_WEBP_REQUIRED_OPTION}) ++find_package(WebP ${SAIL_CODEC_WEBP_REQUIRED_OPTION}) + +-if ((NOT WEBP_RELEASE_LIBRARY AND NOT WEBP_DEBUG_LIBRARY) OR (NOT WEBP_DEMUX_RELEASE_LIBRARY AND NOT WEBP_DEMUX_DEBUG_LIBRARY) OR NOT WEBP_INCLUDE_DIRS) ++if (NOT WebP_FOUND) + return() + endif() + +@@ -24,5 +20,5 @@ set(SAIL_CODECS_FIND_DEPENDENCIES ${SAIL_CODECS_FIND_DEPENDENCIES} "find_library + sail_codec(NAME webp + SOURCES helpers.h helpers.c webp.c + ICON webp.png +- DEPENDENCY_INCLUDE_DIRS ${WEBP_INCLUDE_DIRS} +- DEPENDENCY_LIBS optimized ${WEBP_RELEASE_LIBRARY} debug ${WEBP_DEBUG_LIBRARY} optimized ${WEBP_DEMUX_RELEASE_LIBRARY} debug ${WEBP_DEMUX_DEBUG_LIBRARY}) ++ DEPENDENCY_INCLUDE_DIRS ${WebP_INCLUDE_DIRS} ++ DEPENDENCY_LIBS ${WebP_LIBRARIES}) diff --git a/recipes/sail/all/test_package/CMakeLists.txt b/recipes/sail/all/test_package/CMakeLists.txt index 63838b328e8e7..2a4a2660ff277 100644 --- a/recipes/sail/all/test_package/CMakeLists.txt +++ b/recipes/sail/all/test_package/CMakeLists.txt @@ -1,12 +1,6 @@ cmake_minimum_required(VERSION 3.1) project(test_package C CXX) -# Enable strict C++11 -# -set(CMAKE_CXX_STANDARD 11) -set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_CXX_EXTENSIONS OFF) - include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) @@ -14,10 +8,11 @@ find_package(Sail REQUIRED CONFIG) # C API add_executable(test_package_c test_package.c) -target_compile_definitions(test_package_c PRIVATE SAIL_DEMO_FILE_PATH="${CMAKE_CURRENT_SOURCE_DIR}/png.png") +target_compile_definitions(test_package_c PRIVATE SAIL_DEMO_FILE_PATH="${CMAKE_CURRENT_SOURCE_DIR}/bmp.bmp") target_link_libraries(test_package_c PRIVATE SAIL::Sail) # C++ API add_executable(test_package_cxx test_package.cpp) -target_compile_definitions(test_package_cxx PRIVATE SAIL_DEMO_FILE_PATH="${CMAKE_CURRENT_SOURCE_DIR}/png.png") +target_compile_definitions(test_package_cxx PRIVATE SAIL_DEMO_FILE_PATH="${CMAKE_CURRENT_SOURCE_DIR}/bmp.bmp") target_link_libraries(test_package_cxx PRIVATE SAIL::SailC++) +target_compile_features(test_package_cxx PRIVATE cxx_std_11) diff --git a/recipes/sail/all/test_package/bmp.bmp b/recipes/sail/all/test_package/bmp.bmp new file mode 100644 index 0000000000000..74d4973a3b13c Binary files /dev/null and b/recipes/sail/all/test_package/bmp.bmp differ diff --git a/recipes/sail/all/test_package/conanfile.py b/recipes/sail/all/test_package/conanfile.py index e1256a3fd44fe..525f72d72cd85 100644 --- a/recipes/sail/all/test_package/conanfile.py +++ b/recipes/sail/all/test_package/conanfile.py @@ -1,7 +1,8 @@ +from conan import ConanFile +from conan.tools.build import cross_building +from conans import CMake import os -from conans import ConanFile, CMake, tools - class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" generators = "cmake", "cmake_find_package", "cmake_find_package_multi" @@ -12,7 +13,7 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): + if not cross_building(self): bin_path = os.path.join("bin", "test_package_c") self.run(bin_path, run_environment=True) diff --git a/recipes/sail/all/test_package/png.png b/recipes/sail/all/test_package/png.png deleted file mode 100644 index 28a719d048562..0000000000000 Binary files a/recipes/sail/all/test_package/png.png and /dev/null differ diff --git a/recipes/sail/all/test_package/test_package.c b/recipes/sail/all/test_package/test_package.c index 3b6c3b66b46a6..eba9d786722c4 100644 --- a/recipes/sail/all/test_package/test_package.c +++ b/recipes/sail/all/test_package/test_package.c @@ -9,7 +9,7 @@ int main(int argc, char *argv[]) struct sail_image *image; - SAIL_TRY_OR_EXECUTE(sail_load_image_from_file(SAIL_DEMO_FILE_PATH, &image), + SAIL_TRY_OR_EXECUTE(sail_load_from_file(SAIL_DEMO_FILE_PATH, &image), /* on error */ return 1); printf("Size: %ux%u, bytes per line: %u, " diff --git a/recipes/sail/config.yml b/recipes/sail/config.yml index 1ce318b79e80e..4b9680ce33efb 100644 --- a/recipes/sail/config.yml +++ b/recipes/sail/config.yml @@ -1,3 +1,3 @@ versions: - "0.9.0-pre23": + "0.9.0-rc2": folder: all