Skip to content

Commit

Permalink
[libavif] Fix target config include dirs for static build
Browse files Browse the repository at this point in the history
  • Loading branch information
WangWeiLin-MV committed Nov 19, 2024
1 parent 2a8dc1b commit c0339dd
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 6 deletions.
42 changes: 37 additions & 5 deletions ports/libavif/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
vcpkg_download_distfile(PATCH_MERGE_STATIC_LIBS_INCLUDE
URLS https://github.com/AOMediaCodec/libavif/commit/6fac47f047ac7c62d19f25cef5de34e793fbd8ad.patch?full_index=1
SHA512 9c37f72de31a79e0f7a9a80c32eaca1e538570455f7f5df5441d22a44d8a3761f2a454e9a54e6624439885f3a57939b3414187468e28d20b3b5bfb680c72dfbc
FILENAME AOMediaCodec-libavif-v1.1.1-6fac47f047ac7c62d19f25cef5de34e793fbd8ad.patch
)

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO AOMediaCodec/libavif
REF "v${VERSION}"
SHA512 ba72b8d02b098f361643a073361fccafd22eaac14e46dd06378d5e7acd9853538c5d166473e1de0b020de62dac25be83e42bd57ba51f675d11e2ddf155fbfa21
HEAD_REF master
HEAD_REF main
PATCHES
disable-source-utf8.patch
"${PATCH_MERGE_STATIC_LIBS_INCLUDE}"
)

vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
Expand All @@ -19,6 +26,7 @@ vcpkg_cmake_configure(
OPTIONS
-DAVIF_BUILD_APPS=OFF
-DAVIF_BUILD_TESTS=OFF
-DAVIF_BUILD_EXAMPLES=OFF
-DCMAKE_DISABLE_FIND_PACKAGE_libsharpyuv=ON
${FEATURE_OPTIONS}
)
Expand All @@ -27,15 +35,39 @@ vcpkg_cmake_install()

vcpkg_copy_pdbs()

# Move cmake configs
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/${PORT})

# Fix pkg-config files
vcpkg_fixup_pkgconfig()

# Remove duplicate files
set(USAGE_FILE "${CURRENT_PACKAGES_DIR}/share/libavif/usage")
file(APPEND ${USAGE_FILE} [[
libavif provides pkg-config modules:

# Library for encoding and decoding .avif files
libavif

libavif provides CMake targets:

find_package(libavif CONFIG REQUIRED)
target_link_libraries(main PRIVATE avif)
]])
if("aom" IN_LIST FEATURES)
file(APPEND ${USAGE_FILE} [[
find_package(aom CONFIG REQUIRED)
target_link_libraries(main PRIVATE unofficial::aom)
]]
)
endif()
if("dav1d" IN_LIST FEATURES)
file(APPEND ${USAGE_FILE} [[
find_package(PkgConfig REQUIRED)
pkg_check_modules(dav1d REQUIRED IMPORTED_TARGET dav1d)
target_link_libraries(main PRIVATE PkgConfig::dav1d)
]]
)
endif()

file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include"
"${CURRENT_PACKAGES_DIR}/debug/share")

# Handle copyright
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
1 change: 1 addition & 0 deletions ports/libavif/vcpkg.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -4330,7 +4330,7 @@
},
"libavif": {
"baseline": "1.1.1",
"port-version": 0
"port-version": 1
},
"libb2": {
"baseline": "0.98.1",
Expand Down
5 changes: 5 additions & 0 deletions versions/l-/libavif.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "a99def7114d7c0c32f404f0110d5f411ded75437",
"version-semver": "1.1.1",
"port-version": 1
},
{
"git-tree": "ad9d36286110339f45b585a1bbb330273c04edad",
"version-semver": "1.1.1",
Expand Down

0 comments on commit c0339dd

Please sign in to comment.