iTranslated by AI

The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
🖼️

Building libavif on Windows

に公開
2024/04/24

Environment Setup

You need three tools: CMake, Ninja, and NASM, so install them.

winget install NASM.NASM Kitware.CMake

For Ninja, download ninja-win.zip from GitHub, extract it, place ninja.exe in an appropriate folder, and add it to your PATH.[1]

nasm --version
clang --version
ninja --version

It is successful if the version information is output after entering the commands above.

Build

Basically, you can just run the commands as described in the GitHub README.
However, at the time of writing, the file that should be generated as .\ext\libwebp\build\libsharpyuv.lib is instead generated as .\ext\libwebp\build\sharpyuv.lib, causing subsequent CMake steps to fail. Therefore, I am using the ren command to rename it.
All other commands are the same as those written in the README.

git clone -b v1.0.3 https://github.com/AOMediaCodec/libavif.git
cd libavif/ext
./aom.cmd
./libyuv.cmd
./libsharpyuv.cmd
./libjpeg.cmd
./zlibpng.cmd
cd ..
ren .\ext\libwebp\build\sharpyuv.lib libsharpyuv.lib
cmake -S . -B build -DBUILD_SHARED_LIBS=OFF -DAVIF_CODEC_AOM=ON -DAVIF_LOCAL_AOM=ON -DAVIF_LOCAL_LIBYUV=ON -DAVIF_LOCAL_LIBSHARPYUV=ON -DAVIF_LOCAL_JPEG=ON -DAVIF_LOCAL_ZLIBPNG=ON -DAVIF_BUILD_APPS=ON
cmake --build build --parallel

aom.lib is generated under .\ext\aom\build.libavif, and avif.lib is generated under .\build\Release.
Additionally, you can generate avifenc.exe and avifdec.exe with the following command:

msbuild ".\build\libavif.sln" /m /verbosity:minimal /p:Configuration=Release
脚注
  1. Technically, winget install Ninja-build.Ninja should work, but it failed in my environment, so I'm using the manual installation method. ↩︎

GitHubで編集を提案

Discussion