使用 Microsoft Visual C++ 构建 libdav1d?

问题描述

我已经build it using MinGW

有没有办法使用 Microsoft Visual C++ 构建它?

我想将它与 FFmpeg 一起使用。我的 FFmpeg 及其所有依赖项都是使用 Visual C++ 编译的,所以我试图避免 possible problems caused by mixing MinGW and Visual C++ libraries

解决方法

我似乎找到了一个可行的解决方案。

  1. 安装介子 (https://github.com/mesonbuild/meson/releases)
  2. 安装 NASM (https://www.nasm.us/)
  3. 将 Meson 和 NASM 添加到系统 PATH 变量
  4. 为 Visual Studio 打开 x64 本机工具命令提示符(以构建 x64 版本)
  5. 应用以下命令:

git clone https://code.videolan.org/videolan/dav1d.git

cd dav1d

meson build

cd build

meson configure -Dbuildtype=release

meson configure -Ddefault_library=static

ninja

但由于未知原因,它生成带有 .a 扩展名而不是 .lib 的静态库。我认为这只是一个错字,重命名生成的库是安全的。

要生成共享库,请使用 meson configure -Ddefault_library=shared