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.3 #25810

Merged
merged 3 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions recipes/exiv2/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
sources:
"0.28.3":
url: "https://github.com/Exiv2/exiv2/archive/refs/tags/v0.28.3.tar.gz"
sha256: "1315e17d454bf4da3cc0edb857b1d2c143670f3485b537d0f946d9ed31d87b70"
"0.28.2":
url: "https://github.com/Exiv2/exiv2/archive/refs/tags/v0.28.2.tar.gz"
sha256: "543bead934135f20f438e0b6d8858c55c5fcb7ff80f5d1d55489965f1aad58b9"
Expand Down
56 changes: 10 additions & 46 deletions recipes/exiv2/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from conan import ConanFile, conan_version
from conan.errors import ConanInvalidConfiguration
from conan.tools.build import check_min_cppstd
from conan.tools.build import check_min_cppstd, check_max_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, replace_in_file
from conan.tools.microsoft import is_msvc, is_msvc_static_runtime, check_min_vs
Expand All @@ -17,9 +17,9 @@ class Exiv2Conan(ConanFile):
description = "Exiv2 is a C++ library and a command-line utility " \
"to read, write, delete and modify Exif, IPTC, XMP and ICC image metadata."
license = "GPL-2.0"
topics = ("image", "exif", "xmp")
homepage = "https://www.exiv2.org"
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://www.exiv2.org"
topics = ("image", "exif", "xmp")

package_type = "library"
settings = "os", "arch", "compiler", "build_type"
Expand Down Expand Up @@ -88,25 +88,20 @@ 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_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')
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."
)
else:
# https://github.com/Exiv2/exiv2/tree/v0.27.7#217-building-with-c11-and-other-compilers
check_max_cppstd(self, 14)

Expand Down Expand Up @@ -167,30 +162,6 @@ def package(self):
rmdir(self, os.path.join(self.package_folder, "lib", "cmake"))
rmdir(self, os.path.join(self.package_folder, "share"))

# TODO: to remove in conan v2 once cmake_find_package_* generators removed
targets = {"exiv2lib": "exiv2::exiv2lib"}
if self.options.with_xmp == "bundled":
targets.update({"exiv2-xmp": "exiv2::exiv2-xmp"})
self._create_cmake_module_alias_targets(
os.path.join(self.package_folder, self._module_file_rel_path),
targets
)

def _create_cmake_module_alias_targets(self, module_file, targets):
content = ""
for alias, aliased in targets.items():
content += textwrap.dedent(f"""\
if(TARGET {aliased} AND NOT TARGET {alias})
add_library({alias} INTERFACE IMPORTED)
set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased})
endif()
""")
save(self, module_file, content)

@property
def _module_file_rel_path(self):
return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake")

def package_info(self):
self.cpp_info.set_property("cmake_file_name", "exiv2")
self.cpp_info.set_property("pkg_config_name", "exiv2")
Expand Down Expand Up @@ -223,10 +194,3 @@ def package_info(self):
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" 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]
4 changes: 2 additions & 2 deletions recipes/exiv2/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
cmake_minimum_required(VERSION 3.1)
project(test_package CXX)
project(test_package LANGUAGES CXX)

find_package(exiv2 REQUIRED CONFIG)

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

if(${exiv2_VERSION} VERSION_GREATER_EQUAL "0.28.0")
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17)
Expand Down
8 changes: 0 additions & 8 deletions recipes/exiv2/all/test_v1_package/CMakeLists.txt

This file was deleted.

17 changes: 0 additions & 17 deletions recipes/exiv2/all/test_v1_package/conanfile.py

This file was deleted.

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.3":
folder: all
"0.28.2":
folder: all
"0.28.1":
Expand Down