mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-26 09:31:08 +08:00
[libavif] Fix usage requirements export (#42250)
This commit is contained in:
parent
6ae3ccc87c
commit
2cf1e05bd9
52
ports/libavif/dependencies.diff
Normal file
52
ports/libavif/dependencies.diff
Normal file
@ -0,0 +1,52 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index a28e6c3..aaeb5d2 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -248,6 +248,7 @@ if(AVIF_LIBYUV_ENABLED)
|
||||
target_compile_definitions(avif_obj PRIVATE -DAVIF_LIBYUV_ENABLED=1)
|
||||
avif_target_link_library(yuv::yuv)
|
||||
set(AVIF_PKG_CONFIG_EXTRA_LIBS_PRIVATE "${AVIF_PKG_CONFIG_EXTRA_LIBS_PRIVATE} -lyuv")
|
||||
+ set(AVIF_PKG_CONFIG_EXTRA_REQUIRES_PRIVATE "${AVIF_PKG_CONFIG_EXTRA_REQUIRES_PRIVATE} libjpeg")
|
||||
set(AVIF_LIB_USE_CXX ON)
|
||||
endif(AVIF_LIBYUV_ENABLED)
|
||||
|
||||
@@ -849,13 +850,38 @@ if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL)
|
||||
|
||||
# Enable CMake configs in VCPKG mode
|
||||
if(BUILD_SHARED_LIBS OR VCPKG_TARGET_TRIPLET)
|
||||
- install(EXPORT ${PROJECT_NAME}-config DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
|
||||
+ install(EXPORT ${PROJECT_NAME}-config DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME} FILE ${PROJECT_NAME}-targets.cmake)
|
||||
+ if(NOT BUILD_SHARED_LIBS)
|
||||
+ target_include_directories(avif_static PUBLIC $<INSTALL_INTERFACE:include>)
|
||||
+ set(avif_static_link_libs yuv)
|
||||
+ set(avif_find_dependencies "find_dependency(libyuv CONFIG)\n")
|
||||
+ if(AVIF_CODEC_AOM_ENABLED)
|
||||
+ find_package(aom CONFIG REQUIRED)
|
||||
+ list(APPEND avif_static_link_libs unofficial::aom)
|
||||
+ string(APPEND avif_find_dependencies "find_dependency(aom CONFIG)\n")
|
||||
+ endif()
|
||||
+ if(AVIF_CODEC_DAV1D_ENABLED)
|
||||
+ list(APPEND avif_static_link_libs ${DAV1D_LIBRARIES} ${CMAKE_DL_LIBS})
|
||||
+ endif()
|
||||
+ if(UNIX OR MINGW)
|
||||
+ list(APPEND avif_static_link_libs Threads::Threads m)
|
||||
+ string(APPEND avif_find_dependencies "set(THREADS_PREFER_PTHREAD_FLAG ON)\nfind_dependency(Threads)\n")
|
||||
+ endif()
|
||||
+ target_link_libraries(avif_static INTERFACE ${avif_static_link_libs})
|
||||
+ endif()
|
||||
+ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake"
|
||||
+"# Generated by vcpkg
|
||||
+include(CMakeFindDependencyMacro)
|
||||
+${avif_find_dependencies}
|
||||
+include(\"\${CMAKE_CURRENT_LIST_DIR}/${PROJECT_NAME}-targets.cmake\")
|
||||
+")
|
||||
|
||||
include(CMakePackageConfigHelpers)
|
||||
write_basic_package_version_file(
|
||||
${PROJECT_NAME}-config-version.cmake VERSION ${PROJECT_VERSION} COMPATIBILITY SameMajorVersion
|
||||
)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake
|
||||
+ ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
|
||||
)
|
||||
endif()
|
@ -5,37 +5,33 @@ vcpkg_from_github(
|
||||
SHA512 ba72b8d02b098f361643a073361fccafd22eaac14e46dd06378d5e7acd9853538c5d166473e1de0b020de62dac25be83e42bd57ba51f675d11e2ddf155fbfa21
|
||||
HEAD_REF master
|
||||
PATCHES
|
||||
dependencies.diff
|
||||
disable-source-utf8.patch
|
||||
)
|
||||
file(REMOVE_RECURSE "${SOURCE_PATH}/third_party")
|
||||
|
||||
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
|
||||
FEATURES
|
||||
aom AVIF_CODEC_AOM
|
||||
dav1d AVIF_CODEC_DAV1D
|
||||
)
|
||||
set(FEATURE_OPTIONS "")
|
||||
if("aom" IN_LIST FEATURES)
|
||||
list(APPEND FEATURE_OPTIONS "-DAVIF_CODEC_AOM=SYSTEM")
|
||||
endif()
|
||||
if("dav1d" IN_LIST FEATURES)
|
||||
list(APPEND FEATURE_OPTIONS "-DAVIF_CODEC_DAV1D=SYSTEM")
|
||||
endif()
|
||||
|
||||
vcpkg_find_acquire_program(PKGCONFIG)
|
||||
|
||||
vcpkg_cmake_configure(
|
||||
SOURCE_PATH "${SOURCE_PATH}"
|
||||
OPTIONS
|
||||
-DAVIF_BUILD_APPS=OFF
|
||||
-DAVIF_BUILD_TESTS=OFF
|
||||
-DCMAKE_DISABLE_FIND_PACKAGE_libsharpyuv=ON
|
||||
${FEATURE_OPTIONS}
|
||||
"-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}"
|
||||
)
|
||||
|
||||
vcpkg_cmake_install()
|
||||
|
||||
vcpkg_copy_pdbs()
|
||||
|
||||
# Move cmake configs
|
||||
vcpkg_fixup_pkgconfig()
|
||||
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/${PORT})
|
||||
|
||||
# Fix pkg-config files
|
||||
vcpkg_fixup_pkgconfig()
|
||||
|
||||
# Remove duplicate files
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include"
|
||||
"${CURRENT_PACKAGES_DIR}/debug/share")
|
||||
|
||||
# Handle copyright
|
||||
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
|
||||
|
@ -1,6 +1,7 @@
|
||||
{
|
||||
"name": "libavif",
|
||||
"version-semver": "1.1.1",
|
||||
"port-version": 1,
|
||||
"description": "Library for encoding and decoding AVIF files",
|
||||
"homepage": "https://github.com/AOMediaCodec/libavif",
|
||||
"license": "BSD-2-Clause AND Apache-2.0",
|
||||
|
10
scripts/test_ports/vcpkg-ci-libavif/portfile.cmake
Normal file
10
scripts/test_ports/vcpkg-ci-libavif/portfile.cmake
Normal file
@ -0,0 +1,10 @@
|
||||
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
|
||||
|
||||
vcpkg_find_acquire_program(PKGCONFIG)
|
||||
|
||||
vcpkg_cmake_configure(
|
||||
SOURCE_PATH "${CURRENT_PORT_DIR}/project"
|
||||
OPTIONS
|
||||
"-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}"
|
||||
)
|
||||
vcpkg_cmake_build()
|
17
scripts/test_ports/vcpkg-ci-libavif/project/CMakeLists.txt
Normal file
17
scripts/test_ports/vcpkg-ci-libavif/project/CMakeLists.txt
Normal file
@ -0,0 +1,17 @@
|
||||
cmake_minimum_required(VERSION 3.30)
|
||||
project(libavif-test C)
|
||||
|
||||
find_package(libavif CONFIG REQUIRED)
|
||||
|
||||
add_executable(main main.c)
|
||||
target_link_libraries(main PRIVATE
|
||||
$<TARGET_NAME:avif>
|
||||
)
|
||||
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(libavif_pc libavif REQUIRED IMPORTED_TARGET)
|
||||
|
||||
add_executable(main-pkconfig main.c)
|
||||
target_link_libraries(main-pkconfig PRIVATE
|
||||
PkgConfig::libavif_pc
|
||||
)
|
10
scripts/test_ports/vcpkg-ci-libavif/project/main.c
Normal file
10
scripts/test_ports/vcpkg-ci-libavif/project/main.c
Normal file
@ -0,0 +1,10 @@
|
||||
#include <stdio.h>
|
||||
#include <avif/avif.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
char codecVersions[256];
|
||||
avifCodecVersions(codecVersions);
|
||||
printf("Codec Versions: %s\n", codecVersions);
|
||||
return 0;
|
||||
}
|
34
scripts/test_ports/vcpkg-ci-libavif/vcpkg.json
Normal file
34
scripts/test_ports/vcpkg-ci-libavif/vcpkg.json
Normal file
@ -0,0 +1,34 @@
|
||||
{
|
||||
"name": "vcpkg-ci-libavif",
|
||||
"version-string": "ci",
|
||||
"description": "Port to force features of libavif within CI",
|
||||
"homepage": "https://github.com/microsoft/vcpkg",
|
||||
"license": "MIT",
|
||||
"dependencies": [
|
||||
{
|
||||
"name": "libavif",
|
||||
"default-features": false
|
||||
},
|
||||
{
|
||||
"name": "vcpkg-cmake",
|
||||
"host": true
|
||||
}
|
||||
],
|
||||
"default-features": [
|
||||
"all"
|
||||
],
|
||||
"features": {
|
||||
"all": {
|
||||
"description": "Test all features",
|
||||
"dependencies": [
|
||||
{
|
||||
"name": "libavif",
|
||||
"features": [
|
||||
"aom",
|
||||
"dav1d"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
@ -4330,7 +4330,7 @@
|
||||
},
|
||||
"libavif": {
|
||||
"baseline": "1.1.1",
|
||||
"port-version": 0
|
||||
"port-version": 1
|
||||
},
|
||||
"libb2": {
|
||||
"baseline": "0.98.1",
|
||||
|
@ -1,5 +1,10 @@
|
||||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "6ce7e81979ac4f42aaafb11efbb35b171fe53791",
|
||||
"version-semver": "1.1.1",
|
||||
"port-version": 1
|
||||
},
|
||||
{
|
||||
"git-tree": "ad9d36286110339f45b585a1bbb330273c04edad",
|
||||
"version-semver": "1.1.1",
|
||||
|
Loading…
x
Reference in New Issue
Block a user