Skip to content

Commit

Permalink
sail: Enable jpegxl (#25806)
Browse files Browse the repository at this point in the history
* sail: Enable jpegxl

* sail: Try libjxl 0.8.2

* Small fixes

* sail: Use CMAKE_TRY_COMPILE_CONFIGURATION for all compilers

---------

Co-authored-by: Luis Caro Campos <[email protected]>
  • Loading branch information
HappySeaFox and jcar87 authored Nov 4, 2024
1 parent 4a61de6 commit 0ab91ca
Showing 1 changed file with 7 additions and 18 deletions.
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

0 comments on commit 0ab91ca

Please sign in to comment.