[exiv2] Fix cmake config, cleanup, add test port (#47776)

This commit is contained in:
Kai Pastor
2025-10-13 21:06:01 +02:00
committed by GitHub
parent 8cf314c988
commit 5451aa7b8f
8 changed files with 109 additions and 13 deletions

View File

@@ -7,7 +7,7 @@ index 09b46df..85badd2 100644
if(@EXIV2_ENABLE_BMFF@ AND @EXIV2_ENABLE_BROTLI@) # if(EXIV2_ENABLE_BMFF AND EXIV2_ENABLE_BROTLI)
- find_package(Brotli QUIET)
+ find_package(unofficial-brotli QUIET)
+ find_dependency(Brotli NAMES unofficial-brotli)
if (NOT Brotli_FOUND)
message(FATAL_ERROR
"Static builds of exiv2 require Brotli. "
@@ -16,7 +16,7 @@ index 09b46df..85badd2 100644
if(@EXIV2_ENABLE_XMP@) # if(EXIV2_ENABLE_XMP)
- find_dependency(EXPAT REQUIRED)
+ find_dependency(expat CONFIG REQUIRED)
+ find_dependency(EXPAT NAMES expat)
elseif(@EXIV2_ENABLE_EXTERNAL_XMP@) # elseif(EXIV2_ENABLE_EXTERNAL_XMP)
find_dependency(XmpSdk REQUIRED)
endif()
@@ -25,7 +25,7 @@ index 09b46df..85badd2 100644
if(@EXIV2_ENABLE_INIH@) # if(EXIV2_ENABLE_INIH)
- find_package(inih QUIET)
+ find_package(unofficial-inih QUIET)
+ find_dependency(inih NAMES unofficial-inih)
if (NOT inih_FOUND)
message(FATAL_ERROR
"Static builds of exiv2 require inih. "

View File

@@ -10,10 +10,10 @@ vcpkg_from_github(
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
xmp EXIV2_ENABLE_XMP
png EXIV2_ENABLE_PNG
nls EXIV2_ENABLE_NLS
bmff EXIV2_ENABLE_BMFF
nls EXIV2_ENABLE_NLS
png EXIV2_ENABLE_PNG
xmp EXIV2_ENABLE_XMP
)
if(VCPKG_TARGET_IS_UWP)
list(APPEND FEATURE_OPTIONS -DEXIV2_ENABLE_FILESYSTEM_ACCESS=OFF)
@@ -45,9 +45,22 @@ vcpkg_cmake_configure(
)
vcpkg_cmake_install()
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/exiv2)
vcpkg_fixup_pkgconfig()
vcpkg_copy_pdbs()
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/exiv2)
if(VCPKG_TARGET_IS_OSX AND "nls" IN_LIST FEATURES)
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/exiv2.pc" " -lintl" " -lintl -framework CoreFoundation")
if(NOT VCPKG_BUILD_TYPE)
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/exiv2.pc" " -lintl" " -lintl -framework CoreFoundation")
endif()
endif()
if(VCPKG_TARGET_IS_WINDOWS)
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/exiv2.pc" "Libs.private: " "Libs.private: -lpsapi ")
if(NOT VCPKG_BUILD_TYPE)
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/exiv2.pc" "Libs.private: " "Libs.private: -lpsapi ")
endif()
endif()
vcpkg_fixup_pkgconfig()
file(REMOVE_RECURSE
"${CURRENT_PACKAGES_DIR}/debug/include"

View File

@@ -1,12 +1,19 @@
{
"name": "exiv2",
"version": "0.28.7",
"port-version": 1,
"description": "Image metadata library and tools",
"homepage": "https://exiv2.org",
"license": "GPL-2.0-or-later",
"supports": "!xbox",
"dependencies": [
"inih",
{
"name": "inih",
"default-features": false,
"features": [
"cpp"
]
},
{
"name": "libiconv",
"platform": "!windows"
@@ -46,9 +53,6 @@
"zlib"
]
},
"video": {
"description": "Deprecated. it will be removed in the future."
},
"xmp": {
"description": "Build with XMP metadata support",
"dependencies": [

View File

@@ -0,0 +1,19 @@
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO Exiv2/exiv2
REF v0.28.7
SHA512 b53f4989abcd5d346f2a9c726a06707c47e1990ecb2e5e193c963e01d452fefe4dddd14e25eb08ef35e2f8288b8ec4bdee60725aa7dcd6b1c0348ed56c803fc0
HEAD_REF master
)
vcpkg_find_acquire_program(PKGCONFIG)
vcpkg_cmake_configure(
SOURCE_PATH "${CURRENT_PORT_DIR}/project"
OPTIONS
"-DSOURCE_PATH=${SOURCE_PATH}"
"-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}"
)
vcpkg_cmake_build()

View File

@@ -0,0 +1,19 @@
cmake_minimum_required(VERSION 3.10)
project(exiv2-test CXX)
set(CMAKE_CXX_STANDARD 11)
block()
find_package(exiv2 CONFIG REQUIRED)
add_executable(main "${SOURCE_PATH}/samples/exifdata.cpp")
target_link_libraries(main PRIVATE Exiv2::exiv2lib)
endblock()
block()
find_package(PkgConfig REQUIRED)
pkg_check_modules(exiv2 exiv2 REQUIRED IMPORTED_TARGET)
add_executable(main-pkgconfig "${SOURCE_PATH}/samples/exifdata.cpp")
target_link_libraries(main-pkgconfig PRIVATE PkgConfig::exiv2)
endblock()

View File

@@ -0,0 +1,36 @@
{
"name": "vcpkg-ci-exiv2",
"version-string": "ci",
"description": "Port to validate exiv2 within CI",
"homepage": "https://github.com/microsoft/vcpkg",
"license": "MIT",
"dependencies": [
{
"name": "exiv2",
"default-features": false
},
{
"name": "vcpkg-cmake",
"host": true
}
],
"default-features": [
"all"
],
"features": {
"all": {
"description": "Test all features",
"dependencies": [
{
"name": "exiv2",
"features": [
"bmff",
"nls",
"png",
"xmp"
]
}
]
}
}
}

View File

@@ -2774,7 +2774,7 @@
},
"exiv2": {
"baseline": "0.28.7",
"port-version": 0
"port-version": 1
},
"expat": {
"baseline": "2.7.3",

View File

@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "cedee9b50efea8688a242e81109bf6d14181e724",
"version": "0.28.7",
"port-version": 1
},
{
"git-tree": "5db23f21afc77595bf8b020dc33fc655abef3b4c",
"version": "0.28.7",