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

exiv2: add version 0.28.0, add win_unicode option for 0.27.x #18149

Merged
merged 23 commits into from
Sep 11, 2023
Merged
Show file tree
Hide file tree
Changes from 20 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
8 changes: 8 additions & 0 deletions recipes/exiv2/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,29 @@
sources:
"0.28.0":
url: "https://github.com/Exiv2/exiv2/releases/download/v0.28.0/exiv2-0.28.0-Source.tar.gz"
sha256: "89af3b5ef7277753ef7a7b5374ae017c6b9e304db3b688f1948e73e103491f3d"
"0.27.5":
url: "https://github.com/Exiv2/exiv2/releases/download/v0.27.5/exiv2-0.27.5-Source.tar.gz"
sha256: "35a58618ab236a901ca4928b0ad8b31007ebdc0386d904409d825024e45ea6e2"
"0.27.4":
url: "https://github.com/Exiv2/exiv2/releases/download/v0.27.4/exiv2-0.27.4-Source.tar.gz"
sha256: "84366dba7c162af9a7603bcd6c16f40fe0e9af294ba2fd2f66ffffb9fbec904e"
patches:
"0.28.0":
- patch_file: "patches/0001-link-0.28.0.patch"

Check warning on line 13 in recipes/exiv2/all/conandata.yml

View workflow job for this annotation

GitHub Actions / Lint changed files (YAML files)

conandata.yml schema warning

Schema outlined in https://github.com/conan-io/conan-center-index/blob/master/docs/adding_packages/conandata_yml_format.md#patches-fields is not followed. required key(s) 'patch_description', 'patch_type' not found in - patch_file: patches/0001-lin ... ^ (line: 13)
- patch_file: "patches/0004-find-expat-0.28.0.patch"
patch_description: "enforce usage of FindEXPAT.cmake"
patch_type: "conan"
"0.27.5":
- patch_file: "patches/0001-link-0.27.5.patch"

Check warning on line 18 in recipes/exiv2/all/conandata.yml

View workflow job for this annotation

GitHub Actions / Lint changed files (YAML files)

conandata.yml schema warning

Schema outlined in https://github.com/conan-io/conan-center-index/blob/master/docs/adding_packages/conandata_yml_format.md#patches-fields is not followed. required key(s) 'patch_description', 'patch_type' not found in - patch_file: patches/0001-lin ... ^ (line: 18)
- patch_file: "patches/0003-fix-ios.patch"

Check warning on line 19 in recipes/exiv2/all/conandata.yml

View workflow job for this annotation

GitHub Actions / Lint changed files (YAML files)

conandata.yml schema warning

Schema outlined in https://github.com/conan-io/conan-center-index/blob/master/docs/adding_packages/conandata_yml_format.md#patches-fields is not followed. required key(s) 'patch_description', 'patch_type' not found in - patch_file: patches/0003-fix ... ^ (line: 19)
- patch_file: "patches/0004-find-expat.patch"
patch_description: "enforce usage of FindEXPAT.cmake"
patch_type: "conan"
"0.27.4":
- patch_file: "patches/0001-link.patch"

Check warning on line 24 in recipes/exiv2/all/conandata.yml

View workflow job for this annotation

GitHub Actions / Lint changed files (YAML files)

conandata.yml schema warning

Schema outlined in https://github.com/conan-io/conan-center-index/blob/master/docs/adding_packages/conandata_yml_format.md#patches-fields is not followed. required key(s) 'patch_description', 'patch_type' not found in - patch_file: patches/0001-lin ... ^ (line: 24)
- patch_file: "patches/0002-fpic.patch"

Check warning on line 25 in recipes/exiv2/all/conandata.yml

View workflow job for this annotation

GitHub Actions / Lint changed files (YAML files)

conandata.yml schema warning

Schema outlined in https://github.com/conan-io/conan-center-index/blob/master/docs/adding_packages/conandata_yml_format.md#patches-fields is not followed. required key(s) 'patch_description', 'patch_type' not found in - patch_file: patches/0002-fpi ... ^ (line: 25)
- patch_file: "patches/0003-fix-ios.patch"

Check warning on line 26 in recipes/exiv2/all/conandata.yml

View workflow job for this annotation

GitHub Actions / Lint changed files (YAML files)

conandata.yml schema warning

Schema outlined in https://github.com/conan-io/conan-center-index/blob/master/docs/adding_packages/conandata_yml_format.md#patches-fields is not followed. required key(s) 'patch_description', 'patch_type' not found in - patch_file: patches/0003-fix ... ^ (line: 26)
- patch_file: "patches/0004-find-expat.patch"
patch_description: "enforce usage of FindEXPAT.cmake"
patch_type: "conan"
66 changes: 58 additions & 8 deletions recipes/exiv2/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
from conan import ConanFile
from conan import ConanFile, conan_version
from conan.errors import ConanInvalidConfiguration
from conan.tools.build import check_min_cppstd
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout, CMakeDeps
from conan.tools.files import get, copy, rmdir, save, export_conandata_patches, apply_conandata_patches
from conan.tools.microsoft import is_msvc, is_msvc_static_runtime
from conan.tools.microsoft import is_msvc, is_msvc_static_runtime, check_min_vs
from conan.tools.scm import Version
import os
import sys
import textwrap

required_conan_version = ">=1.53.0"
Expand All @@ -26,13 +29,17 @@ class Exiv2Conan(ConanFile):
"with_png": [True, False],
"with_xmp": [False, "bundled", "external"],
"with_curl": [True, False],
"with_brotli": [True, False],
"with_inih": [True, False],
}
default_options = {
"shared": False,
"fPIC": True,
"with_png": True,
"with_xmp": "bundled",
"with_curl": False,
"with_brotli": True,
"with_inih": True,
}

provides = []
Expand All @@ -51,6 +58,9 @@ def configure(self):
# recipe has bundled xmp-toolkit-sdk of old version
# avoid conflict with a future xmp recipe
self.provides.append("xmp-toolkit-sdk")
if Version(self.version) < "0.28.0":
del self.options.with_brotli
del self.options.with_inih

def layout(self):
cmake_layout(self, src_folder="src")
Expand All @@ -63,9 +73,38 @@ def requirements(self):
if self.options.with_xmp == "bundled":
self.requires("expat/2.5.0")
if self.options.with_curl:
self.requires("libcurl/7.87.0")
self.requires("libcurl/8.1.2")
if self.options.get_safe("with_brotli"):
maksim-petukhov marked this conversation as resolved.
Show resolved Hide resolved
self.requires("brotli/1.0.9")
if self.options.get_safe("with_inih"):
self.requires("inih/57")

def validate(self):
if Version(self.version) >= "0.28.0":
min_cppstd = 17

if self.settings.compiler.cppstd:
check_min_cppstd(self, min_cppstd)
check_min_vs(self, 191)

compilers_minimum_version = {
"gcc": "8",
"clang": "5",
"apple-clang": "10",
}
if not is_msvc(self):
minimum_version = compilers_minimum_version.get(str(self.settings.compiler), False)
if minimum_version and Version(self.info.settings.compiler.version) < minimum_version:
raise ConanInvalidConfiguration(
f"{self.ref} requires C++{min_cppstd}, which your compiler does not fully support."
)
elif conan_version.major == 2:
# FIXME: linter complains, but function is there
# https://docs.conan.io/2.0/reference/tools/build.html?highlight=check_min_cppstd#conan-tools-build-check-max-cppstd
check_max_cppstd = getattr(sys.modules['conan.tools.build'], 'check_max_cppstd')
# https://github.com/Exiv2/exiv2/tree/v0.27.7#217-building-with-c11-and-other-compilers
check_max_cppstd(self, 14)

if self.options.with_xmp == "external":
raise ConanInvalidConfiguration("adobe-xmp-toolkit is not available on cci (yet)")

Expand All @@ -84,6 +123,10 @@ def generate(self):
tc.variables["EXIV2_ENABLE_WEBREADY"] = self.options.with_curl
tc.variables["EXIV2_ENABLE_CURL"] = self.options.with_curl
tc.variables["EXIV2_ENABLE_SSH"] = False
if Version(self.version) >= "0.28.0":
tc.variables["EXIV2_ENABLE_BMFF"] = self.options.with_brotli
tc.variables["EXIV2_ENABLE_BROTLI"] = self.options.with_brotli
tc.variables["EXIV2_ENABLE_INIH"] = self.options.with_inih
tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW"

if is_msvc(self):
Expand Down Expand Up @@ -145,6 +188,10 @@ def package_info(self):
self.cpp_info.components["exiv2lib"].requires.extend(["libpng::libpng", "zlib::zlib"])
if self.options.with_curl:
self.cpp_info.components["exiv2lib"].requires.append("libcurl::libcurl")
if self.options.get_safe("with_brotli"):
self.cpp_info.components["exiv2lib"].requires.extend(["brotli::brotlidec", "brotli::brotlienc"])
if self.options.get_safe("with_inih"):
self.cpp_info.components["exiv2lib"].requires.append("inih::inireader")

if self.settings.os in ("FreeBSD", "Linux"):
self.cpp_info.components["exiv2lib"].system_libs.extend(["pthread"])
Expand All @@ -154,14 +201,17 @@ def package_info(self):

# component exiv2-xmp
if self.options.with_xmp == "bundled":
self.cpp_info.components["exiv2-xmp"].set_property("cmake_target_name", "exiv2-xmp")
self.cpp_info.components["exiv2-xmp"].libs = ["exiv2-xmp"]
self.cpp_info.components["exiv2-xmp"].requires = [ "expat::expat" ]
self.cpp_info.components["exiv2lib"].requires.append("exiv2-xmp")
if Version(self.version) < "0.28.0":
self.cpp_info.components["exiv2-xmp"].set_property("cmake_target_name", "exiv2-xmp")
self.cpp_info.components["exiv2-xmp"].libs = ["exiv2-xmp"]
self.cpp_info.components["exiv2-xmp"].requires = [ "expat::expat" ]
self.cpp_info.components["exiv2lib"].requires.append("exiv2-xmp")
else:
self.cpp_info.components["exiv2lib"].requires.append("expat::expat")

# TODO: to remove in conan v2 once cmake_find_package_* generators removed
self.cpp_info.components["exiv2lib"].build_modules["cmake_find_package"] = [self._module_file_rel_path]
self.cpp_info.components["exiv2lib"].build_modules["cmake_find_package_multi"] = [self._module_file_rel_path]
if self.options.with_xmp == "bundled":
if self.options.with_xmp == "bundled" and Version(self.version) < "0.28.0":
self.cpp_info.components["exiv2-xmp"].build_modules["cmake_find_package"] = [self._module_file_rel_path]
self.cpp_info.components["exiv2-xmp"].build_modules["cmake_find_package_multi"] = [self._module_file_rel_path]
22 changes: 22 additions & 0 deletions recipes/exiv2/all/patches/0001-link-0.28.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 41a672e8..93370b5e 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -170,10 +170,10 @@ if (MSVC)
set_target_properties(exiv2lib PROPERTIES LINK_FLAGS "/ignore:4099")
endif()

-set_target_properties( exiv2lib_int PROPERTIES
- POSITION_INDEPENDENT_CODE ON
- COMPILE_DEFINITIONS exiv2lib_EXPORTS
-)
+
+
+
+

# NOTE: Cannot use target_link_libraries on OBJECT libraries with old versions of CMake
target_include_directories(exiv2lib_int PRIVATE ${ZLIB_INCLUDE_DIR})
--
2.33.0.windows.1

16 changes: 16 additions & 0 deletions recipes/exiv2/all/patches/0004-find-expat-0.28.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
diff --git a/cmake/findDependencies.cmake b/cmake/findDependencies.cmake
index 1075c303..d8b580d4 100644
--- a/cmake/findDependencies.cmake
+++ b/cmake/findDependencies.cmake
@@ -60,7 +60,7 @@ if (EXIV2_ENABLE_XMP AND EXIV2_ENABLE_EXTERNAL_XMP)
message(FATAL_ERROR "EXIV2_ENABLE_XMP AND EXIV2_ENABLE_EXTERNAL_XMP are mutually exclusive. You can only choose one of them")
else()
if (EXIV2_ENABLE_XMP)
- find_package(EXPAT REQUIRED)
+ find_package(EXPAT REQUIRED MODULE)
elseif (EXIV2_ENABLE_EXTERNAL_XMP)
find_package(XmpSdk REQUIRED)
endif ()
--
2.33.0.windows.1

4 changes: 4 additions & 0 deletions recipes/exiv2/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ find_package(exiv2 REQUIRED CONFIG)

add_executable(${PROJECT_NAME} test_package.cpp)
target_link_libraries(${PROJECT_NAME} exiv2lib)

if(${exiv2_VERSION} VERSION_GREATER_EQUAL "0.28.0")
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17)
endif()
2 changes: 2 additions & 0 deletions recipes/exiv2/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
versions:
"0.28.0":
folder: all
"0.27.5":
folder: all
"0.27.4":
Expand Down