Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sail: Enable jpegxl #25806

Merged
merged 4 commits into from
Nov 4, 2024
Merged
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
25 changes: 7 additions & 18 deletions recipes/sail/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from conan import ConanFile
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
from conan.tools.files import apply_conandata_patches, export_conandata_patches, copy, get, rename, rmdir
from conan.tools.files import copy, get, rename, rmdir
from conan.tools.microsoft import is_msvc
from conan.tools.scm import Version
import os
Expand All @@ -9,6 +9,7 @@

class SAILConan(ConanFile):
name = "sail"
package_type = "library"
description = "The missing small and fast image decoding library for humans (not for machines)"
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://sail.software"
Expand Down Expand Up @@ -43,9 +44,6 @@ class SAILConan(ConanFile):
"with_lowest_priority_codecs": "Enable codecs: WAL, XBM",
}

def export_sources(self):
export_conandata_patches(self)

def config_options(self):
if self.settings.os == "Windows":
self.options.rm_safe("fPIC")
Expand All @@ -66,10 +64,7 @@ def requirements(self):
if self.options.with_medium_priority_codecs:
self.requires("libavif/1.0.4")
self.requires("jasper/4.2.0")
# TODO Re-enable JPEG XL after merging either of the following:
# - https://github.com/conan-io/conan-center-index/pull/13898
# - https://github.com/conan-io/conan-center-index/pull/18812
# self.requires("libjxl/0.10.2")
self.requires("libjxl/0.8.2")
self.requires("libwebp/1.3.2")

def layout(self):
Expand Down Expand Up @@ -100,25 +95,19 @@ def generate(self):
tc.variables["SAIL_COMBINE_CODECS"] = True
tc.variables["SAIL_ENABLE_OPENMP"] = False
tc.variables["SAIL_ONLY_CODECS"] = ";".join(only_codecs)
# JPEGXL needs porting to Conan2
# SVG with nanosvg is supported in >= 0.9.1
if Version(self.version) >= "0.9.1":
tc.variables["SAIL_DISABLE_CODECS"] = "jpegxl"
else:
tc.variables["SAIL_DISABLE_CODECS"] = "jpegxl;svg"
if Version(self.version) < "0.9.1":
tc.variables["SAIL_DISABLE_CODECS"] = "svg"
tc.variables["SAIL_INSTALL_PDB"] = False
tc.variables["SAIL_THREAD_SAFE"] = self.options.thread_safe
# TODO: Remove after fixing https://github.com/conan-io/conan/issues/12012
if is_msvc(self):
tc.cache_variables["CMAKE_TRY_COMPILE_CONFIGURATION"] = str(self.settings.build_type)
tc.cache_variables["CMAKE_TRY_COMPILE_CONFIGURATION"] = str(self.settings.build_type)
tc.generate()

deps = CMakeDeps(self)
deps.generate()

def build(self):
apply_conandata_patches(self)

cmake = CMake(self)
cmake.configure()
cmake.build()
Expand Down Expand Up @@ -169,7 +158,7 @@ def package_info(self):
if self.options.with_medium_priority_codecs:
self.cpp_info.components["sail-codecs"].requires.append("libavif::libavif")
self.cpp_info.components["sail-codecs"].requires.append("jasper::jasper")
# self.cpp_info.components["sail-codecs"].requires.append("libjxl::libjxl")
self.cpp_info.components["sail-codecs"].requires.append("libjxl::libjxl")
self.cpp_info.components["sail-codecs"].requires.append("libwebp::libwebp")

self.cpp_info.components["libsail"].set_property("cmake_target_name", "SAIL::Sail")
Expand Down