Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
fdintino committed Nov 9, 2023
1 parent fb054d9 commit 3c2aad7
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 31 deletions.
15 changes: 14 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,19 @@ def readme():
IS_DEBUG = hasattr(sys, "gettotalrefcount")
PLATFORM_MINGW = os.name == "nt" and "GCC" in sys.version

libraries = ["avif"]
if sys.platform == "win32":
libraries.extend(
[
"advapi32.lib",
"bcrypt.lib",
"ntdll.lib",
"userenv.lib",
"ws2_32.lib",
"kernel32.lib",
]
)

setup(
name="pillow-avif-plugin",
description="A pillow plugin that adds avif support via libavif",
Expand All @@ -39,7 +52,7 @@ def readme():
"pillow_avif._avif",
["src/pillow_avif/_avif.c"],
depends=["avif/avif.h"],
libraries=["avif"],
libraries=libraries,
),
],
package_data={"": ["README.rst"]},
Expand Down
2 changes: 1 addition & 1 deletion wheelbuild/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -eo pipefail
CONFIG_DIR=$(abspath $(dirname "${BASH_SOURCE[0]}"))

ARCHIVE_SDIR=pillow-avif-plugin-depends
LIBAVIF_VERSION=bef0bcb9613769ca3706b82c0c9e477b7711f42e
LIBAVIF_VERSION=7414dd89e7a989f8cfc1646c0d972731d3236ede
DAV1D_VERSION=1.2.1
RAV1E_VERSION=p20231003
CCACHE_VERSION=4.7.1
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 @@
add_library(rav1e STATIC IMPORTED GLOBAL)
set_target_properties(rav1e PROPERTIES
IMPORTED_LOCATION "${AVIF_RAV1E_ROOT}/lib/rav1e.lib"
AVIF_LOCAL ON
INTERFACE_INCLUDE_DIRECTORIES "${AVIF_RAV1E_ROOT}/include/rav1e"
)
add_library(rav1e::rav1e ALIAS rav1e)
35 changes: 6 additions & 29 deletions winbuild/build_prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,38 +180,13 @@ def cmd_msbuild(
},
"libavif": {
"url": (
"https://github.com/AOMediaCodec/libavif/archive/"
"a7a404cccc50dc3e25d684dfb1251bac0c1cf0aa.zip"
"https://github.com/fdintino/libavif/archive/"
"7414dd89e7a989f8cfc1646c0d972731d3236ede.zip"
),
"filename": "libavif-a7a404cccc50dc3e25d684dfb1251bac0c1cf0aa.zip",
"dir": "libavif-a7a404cccc50dc3e25d684dfb1251bac0c1cf0aa",
"filename": "libavif-7414dd89e7a989f8cfc1646c0d972731d3236ede.zip",
"dir": "libavif-7414dd89e7a989f8cfc1646c0d972731d3236ede",
"license": "LICENSE",
"build": [
cmd_mkdir(r"ext\rav1e\build.libavif\usr"),
cmd_xcopy(r"..\rav1e-windows-msvc-sdk", r"ext\rav1e\build.libavif\usr"),
cmd_cd("ext"),
"@echo ::group::Building SVT-AV1",
cmd_rmdir("SVT-AV1"),
"cmd.exe /c svt.cmd",
"@echo ::endgroup::",
"@echo ::group::Building aom",
cmd_rmdir("aom"),
'cmd.exe /c "aom.cmd"',
"@echo ::endgroup::",
"@echo ::group::Building dav1d",
cmd_rmdir("dav1d"),
'cmd.exe /c "dav1d.cmd"',
"@echo ::endgroup::",
"@echo ::group::Building libyuv",
cmd_rmdir("libyuv"),
'cmd.exe /c "libyuv.cmd"',
"@echo ::endgroup::",
"@echo ::group::Building libsharpyuv",
cmd_rmdir("libsharpyuv"),
'cmd.exe /c "libsharpyuv.cmd"',
"@echo ::endgroup::",
"@echo ::group::Building libavif",
cmd_cd(".."),
*cmds_cmake(
"avif",
"-DBUILD_SHARED_LIBS=OFF",
Expand All @@ -220,6 +195,8 @@ def cmd_msbuild(
"-DAVIF_LOCAL_LIBYUV=ON",
"-DAVIF_LOCAL_LIBSHARPYUV=ON",
"-DAVIF_CODEC_RAV1E=ON",
"-DAVIF_RAV1E_ROOT={build_dir}",
"-DCMAKE_MODULE_PATH={winbuild_dir}",
"-DAVIF_CODEC_DAV1D=ON",
"-DAVIF_LOCAL_DAV1D=ON",
"-DAVIF_CODEC_SVT=ON",
Expand Down

0 comments on commit 3c2aad7

Please sign in to comment.