From 53732f020b9d7e8b76051d68974094d21c59fa0c Mon Sep 17 00:00:00 2001 From: Frankie Dintino Date: Wed, 7 Feb 2024 12:44:36 -0500 Subject: [PATCH] chore: update libavif to v1.0.3 (#43) Update libavif to v1.0.3 and update transitive dependencies (versions changed from previous release bolded in the table below). | | | |-------------|------------| | **libavif** | **1.0.3** | | **libaom** | **3.8.1** | | **dav1d** | **1.3.0** | | SVT-AV1 | 1.7.0 | | **rav1e** | **0.7.0** | --- .github/workflows/test.yml | 11 +- .github/workflows/wheels.yml | 25 ++- depends/install_libavif.sh | 11 +- setup.py | 15 +- wheelbuild/aom-fix-stack-size.patch | 12 -- wheelbuild/config.sh | 261 +++---------------------- wheelbuild/toolchain-arm64-macos.cmake | 7 + winbuild/Findrav1e.cmake | 7 + winbuild/build_prepare.py | 77 ++++---- 9 files changed, 118 insertions(+), 308 deletions(-) create mode 100644 wheelbuild/toolchain-arm64-macos.cmake create mode 100644 winbuild/Findrav1e.cmake diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 42bd0d1..1d4502a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,7 +1,12 @@ name: Test -on: [push, pull_request] - +on: + pull_request: + push: + branches: + - main + tags: + - '*' jobs: build: @@ -26,7 +31,7 @@ jobs: include: - python-version: "3.9" os: "ubuntu-20.04" - libavif-version: "1.0.1" + libavif-version: "88d3dccda111f6ccbcccd925179f67e7d6fdf4ff" - python-version: "3.7" PYTHONOPTIMIZE: 1 - python-version: "3.8" diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index fd945e6..3fdf78d 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -1,7 +1,12 @@ name: Wheels -on: [push, pull_request] - +on: + pull_request: + push: + branches: + - main + tags: + - '*' env: REPO_DIR: pillow-avif-plugin BUILD_DEPENDS: "" @@ -9,7 +14,7 @@ env: MACOSX_DEPLOYMENT_TARGET: "10.10" WHEEL_SDIR: wheelhouse CONFIG_PATH: pillow-avif-plugin/wheelbuild/config.sh - LIBAVIF_VERSION: ee29bec775ab8e6d555f602775301c14302b96e7 + LIBAVIF_VERSION: 88d3dccda111f6ccbcccd925179f67e7d6fdf4ff jobs: build: @@ -120,13 +125,13 @@ jobs: export GITHUB_ACTIONS=1" EOF - - name: Cache build - id: build-cache - uses: actions/cache@v3 - with: - path: pillow-avif-plugin/depends/libavif-${{ env.LIBAVIF_VERSION }} - key: - ${{ env.LIBAVIF_VERSION }}-${{ hashFiles('pillow-avif-plugin/wheelbuild/*.sh', 'pillow-avif-plugin/.github/workflows/wheels.yml', 'pillow-avif-plugin/depends/*') }}-${{ matrix.os }}-${{ env.PLAT }} + # - name: Cache build + # id: build-cache + # uses: actions/cache@v3 + # with: + # path: pillow-avif-plugin/depends/libavif-${{ env.LIBAVIF_VERSION }} + # key: + # ${{ env.LIBAVIF_VERSION }}-${{ hashFiles('pillow-avif-plugin/wheelbuild/*.sh', 'pillow-avif-plugin/.github/workflows/wheels.yml', 'pillow-avif-plugin/depends/*') }}-${{ matrix.os }}-${{ env.PLAT }} - name: Cache ccache/sccache uses: actions/cache@v3 diff --git a/depends/install_libavif.sh b/depends/install_libavif.sh index 709e71f..08b91bb 100755 --- a/depends/install_libavif.sh +++ b/depends/install_libavif.sh @@ -23,6 +23,7 @@ export CXXFLAGS="-fPIC -O3 $CXXFLAGS" ARCHIVE="${LIBAVIF_VERSION}.tar.gz" if [[ "$LIBAVIF_VERSION" == *"."* ]]; then ARCHIVE="v${ARCHIVE}" + HAS_EXT_DIR=1 fi echo "::group::Fetching libavif" @@ -67,10 +68,12 @@ if $PKGCONFIG --exists aom; then fi if [ "$HAS_ENCODER" != 1 ] || [ "$HAS_DECODER" != 1 ]; then - echo "::group::Building aom" - pushd ext > /dev/null - bash aom.cmd - popd > /dev/null + if [ -n "${HAS_EXT_DIR}" ]; then + echo "::group::Building aom" + pushd ext > /dev/null + bash aom.cmd + popd > /dev/null + fi LIBAVIF_CMAKE_FLAGS+=(-DAVIF_CODEC_AOM=ON -DAVIF_LOCAL_AOM=ON) echo "::endgroup::" fi diff --git a/setup.py b/setup.py index 0d1f4b9..098fab6 100644 --- a/setup.py +++ b/setup.py @@ -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", + "bcrypt", + "ntdll", + "userenv", + "ws2_32", + "kernel32", + ] + ) + setup( name="pillow-avif-plugin", description="A pillow plugin that adds avif support via libavif", @@ -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"]}, diff --git a/wheelbuild/aom-fix-stack-size.patch b/wheelbuild/aom-fix-stack-size.patch index beaca04..9023831 100644 --- a/wheelbuild/aom-fix-stack-size.patch +++ b/wheelbuild/aom-fix-stack-size.patch @@ -56,15 +56,3 @@ index a749a22..8411569 100644 Error: aom_free(worker->impl_); worker->impl_ = NULL; -diff --git a/aom_util/aom_thread.h b/aom_util/aom_thread.h -index 8d04312..efbed78 100644 ---- a/aom_util/aom_thread.h -+++ b/aom_util/aom_thread.h -@@ -32,6 +32,7 @@ - #include // NOLINT - #include // NOLINT - typedef HANDLE pthread_t; -+typedef int pthread_attr_t; - typedef CRITICAL_SECTION pthread_mutex_t; - - #if _WIN32_WINNT < 0x0600 diff --git a/wheelbuild/config.sh b/wheelbuild/config.sh index 4a1ffbb..c0dd4ae 100644 --- a/wheelbuild/config.sh +++ b/wheelbuild/config.sh @@ -4,13 +4,8 @@ set -eo pipefail CONFIG_DIR=$(abspath $(dirname "${BASH_SOURCE[0]}")) ARCHIVE_SDIR=pillow-avif-plugin-depends -LIBAVIF_VERSION=ee29bec775ab8e6d555f602775301c14302b96e7 -AOM_VERSION=3.7.0 -DAV1D_VERSION=1.2.1 -SVT_AV1_VERSION=1.7.0 +LIBAVIF_VERSION=88d3dccda111f6ccbcccd925179f67e7d6fdf4ff RAV1E_VERSION=p20231003 -LIBWEBP_SHA=e2c85878f6a33f29948b43d3492d9cdaf801aa54 -LIBYUV_SHA=464c51a0 CCACHE_VERSION=4.7.1 SCCACHE_VERSION=0.3.0 export PERLBREWURL=https://raw.githubusercontent.com/gugod/App-perlbrew/release-0.92/perlbrew @@ -189,152 +184,6 @@ function install_ninja { touch ninja-stamp } -function build_aom { - if [ -e aom-stamp ]; then return; fi - - group_start "Build aom" - - local cmake_flags=() - - fetch_unpack \ - https://storage.googleapis.com/aom-releases/libaom-$AOM_VERSION.tar.gz - - if [ ! -n "$IS_MACOS" ] && [[ "$MB_ML_VER" == "1" ]]; then - (cd libaom-$AOM_VERSION \ - && patch -p1 -i $CONFIG_DIR/aom-2.0.2-manylinux1.patch) - fi - if [ ! -n "$IS_MACOS" ]; then - cmake_flags+=("-DCMAKE_C_FLAGS=-fPIC") - elif [ "$PLAT" == "arm64" ]; then - cmake_flags+=(\ - -DAOM_TARGET_CPU=arm64 \ - -DCONFIG_RUNTIME_CPU_DETECT=0 \ - -DCMAKE_SYSTEM_PROCESSOR=arm64 \ - -DCMAKE_OSX_ARCHITECTURES=arm64) - fi - if [[ $(type -P ccache) ]]; then - cmake_flags+=(\ - -DCMAKE_C_COMPILER_LAUNCHER=$(type -P ccache) \ - -DCMAKE_CXX_COMPILER_LAUNCHER=$(type -P ccache)) - fi - if [ -n "$IS_ALPINE" ]; then - (cd libaom-$AOM_VERSION \ - && patch -p1 -i $CONFIG_DIR/aom-fix-stack-size.patch) - extra_cmake_flags+=("-DCMAKE_EXE_LINKER_FLAGS=-Wl,-z,stack-size=2097152") - fi - - mkdir libaom-$AOM_VERSION/build/work - (cd libaom-$AOM_VERSION/build/work \ - && cmake \ - -DCMAKE_BUILD_TYPE=Release \ - -DCONFIG_PIC=1 \ - -DCMAKE_INSTALL_PREFIX="${BUILD_PREFIX}" \ - -DCMAKE_INSTALL_LIBDIR=lib \ - -DBUILD_SHARED_LIBS=0 \ - -DENABLE_DOCS=0 \ - -DENABLE_EXAMPLES=0 \ - -DENABLE_TESTDATA=0 \ - -DENABLE_TESTS=0 \ - -DENABLE_TOOLS=0 \ - "${cmake_flags[@]}" \ - ../.. \ - && make install) - - require_package aom - - group_end - touch aom-stamp -} - -function build_dav1d { - if [ -e dav1d-stamp ]; then return; fi - - local cflags="$CFLAGS" - local ldflags="$LDFLAGS" - local meson_flags=() - - local CC=$(type -P "${CC:-gcc}") - local CXX=$(type -P "${CXX:-g++}") - if [[ $(type -P ccache) ]]; then - CC="$(type -P ccache) $CC" - CXX="$(type -P ccache) $CXX" - fi - - group_start "Build dav1d" - fetch_unpack "https://code.videolan.org/videolan/dav1d/-/archive/$DAV1D_VERSION/dav1d-$DAV1D_VERSION.tar.gz" - - cat < dav1d-$DAV1D_VERSION/config.txt -[binaries] -c = 'clang' -cpp = 'clang++' -ar = 'ar' -ld = 'ld' -strip = 'strip' -[built-in options] -c_args = '$CFLAGS' -c_link_args = '$LDFLAGS' -[host_machine] -system = 'darwin' -cpu_family = 'aarch64' -cpu = 'arm' -endian = 'little' -EOF - - if [ "$PLAT" == "arm64" ]; then - cflags="" - ldflags="" - meson_flags+=(--cross-file config.txt) - fi - - (cd dav1d-$DAV1D_VERSION \ - && CFLAGS="$cflags" LDFLAGS="$ldflags" CC="$CC" CXX="$CXX" \ - meson . build \ - "--prefix=${BUILD_PREFIX}" \ - --default-library=static \ - --buildtype=release \ - -D enable_tools=false \ - -D enable_tests=false \ - "${meson_flags[@]}" \ - && SCCACHE_DIR="$SCCACHE_DIR" ninja -vC build install) - group_end - touch dav1d-stamp -} - -function build_svt_av1 { - if [ -e svt-av1-stamp ]; then return; fi - - group_start "Build SVT-AV1" - - fetch_unpack \ - "https://gitlab.com/AOMediaCodec/SVT-AV1/-/archive/v$SVT_AV1_VERSION/SVT-AV1-v$SVT_AV1_VERSION.tar.gz" - - local extra_cmake_flags=() - if [ -n "$IS_ALPINE" ]; then - extra_cmake_flags+=("-DCMAKE_EXE_LINKER_FLAGS=-Wl,-z,stack-size=2097152") - fi - if [[ $(type -P ccache) ]]; then - extra_cmake_flags+=(\ - -DCMAKE_C_COMPILER_LAUNCHER=$(type -P ccache) \ - -DCMAKE_CXX_COMPILER_LAUNCHER=$(type -P ccache)) - fi - (cd SVT-AV1-v$SVT_AV1_VERSION/Build/linux \ - && cmake \ - ../.. \ - -DCMAKE_INSTALL_PREFIX="${BUILD_PREFIX}" \ - -DBUILD_SHARED_LIBS=OFF \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_LIBDIR=lib \ - "${extra_cmake_flags[@]}" \ - && make install \ - && cp SvtAv1Enc.pc $BUILD_PREFIX/lib/pkgconfig) - - require_package SvtAv1Enc - - group_end - - touch svt-av1-stamp -} - function build_rav1e { group_start "Build rav1e" @@ -366,89 +215,35 @@ function build_rav1e { group_end } -function build_libsharpyuv { - if [ -e libsharpyuv-stamp ]; then return; fi - - group_start "Build libsharpyuv" - fetch_unpack https://github.com/webmproject/libwebp/archive/$LIBWEBP_SHA.tar.gz libwebp-$LIBWEBP_SHA.tar.gz - - mkdir -p libwebp-$LIBWEBP_SHA/build - - local cmake_flags=() - if [[ $(type -P ccache) ]]; then - cmake_flags+=(\ - -DCMAKE_C_COMPILER_LAUNCHER=$(type -P ccache) \ - -DCMAKE_CXX_COMPILER_LAUNCHER=$(type -P ccache)) - fi - - (cd libwebp-$LIBWEBP_SHA/build \ - && cmake .. -G Ninja \ - -DCMAKE_INSTALL_PREFIX=$BUILD_PREFIX \ - -DCMAKE_BUILD_TYPE=Release \ - -DBUILD_SHARED_LIBS=OFF \ - "${cmake_flags[@]}" \ - && ninja sharpyuv) - - group_end - touch libsharpyuv-stamp -} - -function build_libyuv { - if [ -e libyuv-stamp ]; then return; fi - - group_start "Build libyuv" - - mkdir -p libyuv-$LIBYUV_SHA - (cd libyuv-$LIBYUV_SHA && \ - fetch_unpack "https://chromium.googlesource.com/libyuv/libyuv/+archive/$LIBYUV_SHA.tar.gz") - mkdir -p libyuv-$LIBYUV_SHA/build - local cmake_flags=() - if [ ! -n "$IS_MACOS" ]; then - cmake_flags+=("-DCMAKE_POSITION_INDEPENDENT_CODE=ON") - fi - if [[ $(type -P ccache) ]]; then - cmake_flags+=(\ - -DCMAKE_C_COMPILER_LAUNCHER=$(type -P ccache) \ - -DCMAKE_CXX_COMPILER_LAUNCHER=$(type -P ccache)) - fi - (cd libyuv-$LIBYUV_SHA/build \ - && cmake -G Ninja .. \ - -DBUILD_SHARED_LIBS=OFF \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ - "${cmake_flags[@]}" .. \ - && ninja yuv) - - group_end - touch libyuv-stamp -} - function build_libavif { LIBAVIF_CMAKE_FLAGS=() if [ -n "$IS_MACOS" ]; then brew remove --ignore-dependencies webp jpeg-xl aom composer gd imagemagick libavif libheif php fi - - build_aom - LIBAVIF_CMAKE_FLAGS+=(-DAVIF_CODEC_AOM=ON) - - build_dav1d - LIBAVIF_CMAKE_FLAGS+=(-DAVIF_CODEC_DAV1D=ON) - + which cmake + cmake --version if [ "$PLAT" == "x86_64" ]; then if [ -n "$IS_MACOS" ]; then - build_svt_av1 - LIBAVIF_CMAKE_FLAGS+=(-DAVIF_CODEC_SVT=ON) + LIBAVIF_CMAKE_FLAGS+=(-DAVIF_CODEC_SVT=LOCAL) elif [[ "$MB_ML_VER" != "1" ]]; then - LDFLAGS=-lrt build_svt_av1 - LIBAVIF_CMAKE_FLAGS+=(-DCMAKE_EXE_LINKER_FLAGS=-lrt) - LIBAVIF_CMAKE_FLAGS+=(-DAVIF_CODEC_SVT=ON) + LIBAVIF_CMAKE_FLAGS+=(-DAVIF_CODEC_SVT=LOCAL) fi fi build_rav1e - LIBAVIF_CMAKE_FLAGS+=(-DAVIF_CODEC_RAV1E=ON) + + # Force libavif to treat system rav1e as if it were local + mkdir -p /tmp/cmake/Modules + cat < /tmp/cmake/Modules/Findrav1e.cmake + add_library(rav1e::rav1e STATIC IMPORTED GLOBAL) + set_target_properties(rav1e::rav1e PROPERTIES + IMPORTED_LOCATION "$BUILD_PREFIX/lib/librav1e.a" + AVIF_LOCAL ON + INTERFACE_INCLUDE_DIRECTORIES "$BUILD_PREFIX/include/rav1e" + ) +EOF + if [ -n "$IS_MACOS" ]; then # Prevent cmake from using @rpath in install id, so that delocate can @@ -457,12 +252,8 @@ function build_libavif { "-DCMAKE_INSTALL_NAME_DIR=$BUILD_PREFIX/lib" \ -DCMAKE_MACOSX_RPATH=OFF) if [ "$PLAT" == "arm64" ]; then - LIBAVIF_CMAKE_FLAGS+=(\ - -DCMAKE_SYSTEM_PROCESSOR=arm64 \ - -DCMAKE_OSX_ARCHITECTURES=arm64) + LIBAVIF_CMAKE_FLAGS+=(-DCMAKE_TOOLCHAIN_FILE=$CONFIG_DIR/toolchain-arm64-macos.cmake) fi - else - LIBAVIF_CMAKE_FLAGS+=("-DCMAKE_POSITION_INDEPENDENT_CODE=ON") fi if [[ $(type -P ccache) ]]; then LIBAVIF_CMAKE_FLAGS+=(\ @@ -478,14 +269,6 @@ function build_libavif { group_end - build_libsharpyuv - mv libwebp-$LIBWEBP_SHA libavif-$LIBAVIF_VERSION/ext/libwebp - LIBAVIF_CMAKE_FLAGS+=(-DAVIF_LOCAL_LIBSHARPYUV=ON) - - build_libyuv - mv libyuv-$LIBYUV_SHA libavif-$LIBAVIF_VERSION/ext/libyuv - LIBAVIF_CMAKE_FLAGS+=(-DAVIF_LOCAL_LIBYUV=ON) - group_start "Build libavif" mkdir -p libavif-$LIBAVIF_VERSION/build @@ -496,6 +279,12 @@ function build_libavif { -DCMAKE_INSTALL_PREFIX=$BUILD_PREFIX \ -DCMAKE_BUILD_TYPE=Release \ -DBUILD_SHARED_LIBS=OFF \ + -DAVIF_LIBSHARPYUV=LOCAL \ + -DAVIF_LIBYUV=LOCAL \ + -DAVIF_CODEC_RAV1E=ON -DCMAKE_MODULE_PATH=/tmp/cmake/Modules \ + -DAVIF_CODEC_AOM=LOCAL \ + -DAVIF_CODEC_DAV1D=LOCAL \ + -DENABLE_NASM=ON \ "${LIBAVIF_CMAKE_FLAGS[@]}" \ && ninja -v install/strip) @@ -637,7 +426,7 @@ function run_tests { $PYTHON_EXE -m pip install mock fi # Runs tests on installed distribution from an empty directory - (cd ../pillow-avif-plugin && pytest) + (cd ../pillow-avif-plugin && pytest -v) } # Work around flakiness of pip install with python 2.7 diff --git a/wheelbuild/toolchain-arm64-macos.cmake b/wheelbuild/toolchain-arm64-macos.cmake new file mode 100644 index 0000000..d7b0568 --- /dev/null +++ b/wheelbuild/toolchain-arm64-macos.cmake @@ -0,0 +1,7 @@ +set(CMAKE_SYSTEM_PROCESSOR "arm64") +set(CMAKE_SYSTEM_NAME "Darwin") +set(CMAKE_OSX_ARCHITECTURES "arm64") +set(CMAKE_C_FLAGS_INIT "-arch arm64") +set(CMAKE_CXX_FLAGS_INIT "-arch arm64") +set(CMAKE_EXE_LINKER_FLAGS_INIT "-arch arm64") +set(CMAKE_ASM_LINKER_DEPFILE_SUPPORTED TRUE) diff --git a/winbuild/Findrav1e.cmake b/winbuild/Findrav1e.cmake new file mode 100644 index 0000000..db62bfb --- /dev/null +++ b/winbuild/Findrav1e.cmake @@ -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" +) diff --git a/winbuild/build_prepare.py b/winbuild/build_prepare.py index 957a8c5..9e1dcaf 100644 --- a/winbuild/build_prepare.py +++ b/winbuild/build_prepare.py @@ -180,54 +180,46 @@ def cmd_msbuild( }, "libavif": { "url": ( - "https://github.com/AOMediaCodec/libavif/archive/" - "ee29bec775ab8e6d555f602775301c14302b96e7.zip" + "https://github.com/fdintino/libavif/archive/" + "88d3dccda111f6ccbcccd925179f67e7d6fdf4ff.zip" ), - "filename": "libavif-ee29bec775ab8e6d555f602775301c14302b96e7.zip", - "dir": "libavif-ee29bec775ab8e6d555f602775301c14302b96e7", + "filename": "libavif-88d3dccda111f6ccbcccd925179f67e7d6fdf4ff.zip", + "dir": "libavif-88d3dccda111f6ccbcccd925179f67e7d6fdf4ff", "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", - "-DAVIF_CODEC_AOM=ON", - "-DAVIF_LOCAL_AOM=ON", - "-DAVIF_LOCAL_LIBYUV=ON", - "-DAVIF_LOCAL_LIBSHARPYUV=ON", - "-DAVIF_CODEC_RAV1E=ON", - "-DAVIF_CODEC_DAV1D=ON", - "-DAVIF_LOCAL_DAV1D=ON", - "-DAVIF_CODEC_SVT=ON", - "-DAVIF_LOCAL_SVT=ON", + cmd_mkdir("build.pillow"), + cmd_cd("build.pillow"), + " ".join( + [ + "{cmake}", + "-DCMAKE_BUILD_TYPE=Release", + "-DCMAKE_VERBOSE_MAKEFILE=ON", + "-DCMAKE_RULE_MESSAGES:BOOL=OFF", # for NMake + "-DCMAKE_C_COMPILER=cl.exe", # for Ninja + "-DCMAKE_CXX_COMPILER=cl.exe", # for Ninja + "-DCMAKE_C_FLAGS=-nologo", + "-DCMAKE_CXX_FLAGS=-nologo", + "-DBUILD_SHARED_LIBS=OFF", + "-DAVIF_CODEC_AOM=ON", + "-DAVIF_LOCAL_AOM=ON", + "-DAVIF_LOCAL_LIBYUV=ON", + "-DAVIF_LOCAL_LIBSHARPYUV=ON", + "-DAVIF_CODEC_RAV1E=ON", + "-DAVIF_RAV1E_ROOT={build_dir}", + "-DCMAKE_MODULE_PATH={winbuild_dir_cmake}", + "-DAVIF_CODEC_DAV1D=ON", + "-DAVIF_LOCAL_DAV1D=ON", + "-DAVIF_CODEC_SVT=ON", + "-DAVIF_LOCAL_SVT=ON", + '-G "Ninja"', + "..", + ] ), + "ninja -v", + cmd_cd(".."), cmd_xcopy("include", "{inc_dir}"), ], - "libs": [r"avif.lib"], + "libs": [r"build.pillow\avif.lib"], }, } @@ -562,6 +554,7 @@ def install_meson(): # Pillow paths "pillow_dir": pillow_dir, "winbuild_dir": winbuild_dir, + "winbuild_dir_cmake": winbuild_dir.replace("\\", "/"), # Build paths "build_dir": args.build_dir, "inc_dir": inc_dir,