Skip to content

Commit

Permalink
fixup3
Browse files Browse the repository at this point in the history
  • Loading branch information
fdintino committed Aug 14, 2024
1 parent 5f11402 commit 0566c65
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 1 deletion.
8 changes: 8 additions & 0 deletions .github/workflows/wheels-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,11 @@ function build_libavif {
-DCMAKE_MACOSX_RPATH=OFF \
. \
&& make install)

if [[ "$MB_ML_LIBC" == "manylinux" ]]; then
cp /usr/local/lib64/libavif.a /usr/local/lib
cp /usr/local/lib64/pkgconfig/libavif.pc /usr/local/lib/pkgconfig
fi
}

function build {
Expand Down Expand Up @@ -212,6 +217,9 @@ if [[ -n "$IS_MACOS" ]]; then
fi

brew install pkg-config

# clear bash path cache for curl
hash -d curl
fi

wrap_wheel_builder build
Expand Down
5 changes: 4 additions & 1 deletion depends/install_libavif.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,14 @@ if [ "$HAS_ENCODER" != 1 ] || [ "$HAS_DECODER" != 1 ]; then
LIBAVIF_CMAKE_FLAGS+=(-DAVIF_CODEC_AOM=LOCAL)
fi

cmake -S . -B build \
cmake -G Ninja -S . -B build \
-DCMAKE_INSTALL_PREFIX=$PREFIX \
-DAVIF_LIBYUV=LOCAL \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_NAME_DIR=$PREFIX/lib \
-DCMAKE_MACOSX_RPATH=OFF \
"${LIBAVIF_CMAKE_FLAGS[@]}"

ninja -C build install

popd
1 change: 1 addition & 0 deletions src/PIL/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ def get_supported_codecs() -> list[str]:
"libjpeg_turbo": ("PIL._imaging", "HAVE_LIBJPEGTURBO", "libjpeg_turbo_version"),
"libimagequant": ("PIL._imaging", "HAVE_LIBIMAGEQUANT", "imagequant_version"),
"xcb": ("PIL._imaging", "HAVE_XCB", None),
"avif": ("PIL._avif", "HAVE_AVIF", "libavif_version"),
}


Expand Down
8 changes: 8 additions & 0 deletions src/_avif.c
Original file line number Diff line number Diff line change
Expand Up @@ -1024,6 +1024,14 @@ setup_module(PyObject *m) {
}
Py_DECREF(v);

v = Py_True;
Py_INCREF(v);
if (PyDict_SetItemString(d, "HAVE_AVIF", v) < 0) {
Py_DECREF(v);
return -1;
}
Py_DECREF(v);

v = Py_BuildValue(
"(iii)", AVIF_VERSION_MAJOR, AVIF_VERSION_MINOR, AVIF_VERSION_PATCH);

Expand Down
7 changes: 7 additions & 0 deletions winbuild/Findrav1e.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
file(TO_CMAKE_PATH "${AVIF_RAV1E_ROOT}" RAV1E_ROOT_PATH)
add_library(rav1e::rav1e STATIC IMPORTED GLOBAL)
set_target_properties(rav1e::rav1e PROPERTIES
IMPORTED_LOCATION "${RAV1E_ROOT_PATH}/lib/rav1e.lib"
AVIF_LOCAL ON
INTERFACE_INCLUDE_DIRECTORIES "${RAV1E_ROOT_PATH}/inc/rav1e"
)

0 comments on commit 0566c65

Please sign in to comment.