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] Update to 0.9.0-rc2, Conan V1 only #14926

Closed
wants to merge 37 commits into from
Closed
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
922bf0e
Update to RC2
HappySeaFox Dec 25, 2022
08a2ca1
Merge branch 'conan-io:master' into feature/rc2
HappySeaFox Dec 25, 2022
f781ed7
Fix JPEG options
HappySeaFox Dec 25, 2022
3809df1
Merge branch 'feature/rc2' of https://github.com/HappySeaFox/conan-ce…
HappySeaFox Dec 25, 2022
032e7b8
Partial V2 migration
HappySeaFox Dec 25, 2022
bc6459a
Remove _source_folder
HappySeaFox Dec 25, 2022
c453341
Use sail_load_from_file() new API call
HappySeaFox Dec 25, 2022
1e93d08
Fixed AVIF patch
HappySeaFox Dec 25, 2022
58b6a7a
Use BMP demo file
HappySeaFox Dec 25, 2022
07bd30a
Remove comments
HappySeaFox Dec 25, 2022
cd6ac85
Added missing self
HappySeaFox Dec 25, 2022
09dceac
Added Jasper patch
HappySeaFox Dec 25, 2022
9b4178d
Added Webp patch
HappySeaFox Dec 25, 2022
7fe2d14
Update recipes/sail/all/conandata.yml
HappySeaFox Dec 26, 2022
2cee30c
Enable C++11 as a project property
HappySeaFox Dec 26, 2022
feaeb3a
Add CXX_STANDARD_REQUIRED
HappySeaFox Dec 26, 2022
381b61b
Fixed libjpeg dependency in components
HappySeaFox Dec 27, 2022
2b9a070
(#14888) boost: Add 1.81.0
sanblch Dec 26, 2022
14ab378
(#14599) xkbcommon: Use rm_safe from Conan 1.53 and simplify test pac…
jwillikers Dec 26, 2022
9aaa84c
(#14701) jom: Download binaries in build method and fix test packages
jwillikers Dec 26, 2022
42554d8
(#14785) add mbits-semver/0.1.1
mzdun Dec 26, 2022
c45026a
(#14739) Bump vulkan loader/1.3.236.0
SpaceIm Dec 26, 2022
77a4265
(#14749) vulkan-memory-allocator: bump vulkan-headers + modernize more
SpaceIm Dec 26, 2022
66800c7
(#14788) add mbits-mstch/1.0.4
mzdun Dec 26, 2022
911ac92
(#14866) mbits-args: conan v2 support
mzdun Dec 27, 2022
89b65ff
(#14641) hyperscan: support gcc12, support conan v2
toge Dec 27, 2022
fdaf3a5
(#14890) jasper: add 4.0.0 + allow to disable jpeg or use mozjpeg
SpaceIm Dec 27, 2022
f4366f0
(#14941) [bot] Update authorized users list (2022-12-26)
conan-center-bot Dec 27, 2022
631867a
(#14955) User set_property in libunwind
czoido Dec 27, 2022
3408ccb
Try C++17
HappySeaFox Dec 29, 2022
1c68eb6
Added validate()
HappySeaFox Dec 29, 2022
480e89d
Merge branch 'feature/rc2' of https://github.com/HappySeaFox/conan-ce…
HappySeaFox Dec 29, 2022
7cd38d1
Remove validate()
HappySeaFox Dec 29, 2022
7a788dd
Added target_compile_features
HappySeaFox Dec 29, 2022
4741d9a
Merge branch 'conan-io:master' into feature/rc2
HappySeaFox Dec 30, 2022
6a36e08
Try C++20
HappySeaFox Dec 30, 2022
3519ada
Try C++11
HappySeaFox Dec 30, 2022
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
19 changes: 13 additions & 6 deletions recipes/sail/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -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/smoked-herring/sail/archive/v0.9.0-rc2.tar.gz"
HappySeaFox marked this conversation as resolved.
Show resolved Hide resolved
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()"
83 changes: 40 additions & 43 deletions recipes/sail/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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],
Expand All @@ -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":
Expand All @@ -67,66 +63,67 @@ 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)

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"))
Expand Down
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
28 changes: 28 additions & 0 deletions recipes/sail/all/patches/0.9.0-rc2-jpeg2000-find-package.patch
Original file line number Diff line number Diff line change
@@ -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})
25 changes: 25 additions & 0 deletions recipes/sail/all/patches/0.9.0-rc2-webp-find-package.patch
Original file line number Diff line number Diff line change
@@ -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})
4 changes: 2 additions & 2 deletions recipes/sail/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ 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++)
Binary file added recipes/sail/all/test_package/bmp.bmp
Binary file not shown.
Binary file removed recipes/sail/all/test_package/png.png
Binary file not shown.
2 changes: 1 addition & 1 deletion recipes/sail/all/test_package/test_package.c
Original file line number Diff line number Diff line change
Expand Up @@ -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, "
Expand Down
2 changes: 1 addition & 1 deletion recipes/sail/config.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
versions:
"0.9.0-pre23":
"0.9.0-rc2":
folder: all